Kuiper2gof {Dogoftest}R Documentation

Two-Sample Kuiper Test with Bootstrap

Description

Performs a two-sample Kuiper test using bootstrap resampling to test whether two independent samples come from the same distribution.

Usage

Kuiper2gof(
  x,
  y,
  alternative = c("two.sided", "less", "greater"),
  nboots = 2000,
  keep.boots = FALSE
)

Arguments

x, y

Numeric vectors of data values for the two samples.

alternative

Character string indicating the alternative hypothesis. Must be one of "two.sided", "less", or "greater".

nboots

Integer. Number of bootstrap resamples to compute the empirical null distribution (default: 2000).

keep.boots

Logical. If TRUE, returns all bootstrap test statistics.

Details

The Kuiper test is a nonparametric test similar to the Kolmogorov–Smirnov test, but sensitive to discrepancies in both location and shape between two distributions. This implementation uses bootstrap resampling to estimate the p-value.

The two.sided test uses the sum of maximum positive and negative ECDF differences. The greater and less options use one-sided variations.

If the observed test statistic exceeds all bootstrap values, the p-value is set to 1 / (2 * nboots) to avoid zero.

Value

An object of class "htest" containing:

statistic

The observed Kuiper statistic.

p.value

The p-value computed from the bootstrap distribution.

alternative

The specified alternative hypothesis.

method

A character string describing the test.

bootstraps

(If requested) A numeric vector of bootstrap statistics.

Examples

set.seed(123)
x <- rnorm(100, 0, 4)
y <- rnorm(100, 2, 4)
Kuiper2gof(x, y)


[Package Dogoftest version 0.2 Index]