Description Usage Arguments Details Value References Examples

Perform a one- or *K*-sample (*K > 1*) hypothesis testing via dynamic slicing.

1 |

`y` |
A numeric vector of data values. |

`x` |
Either an integer vector of data values, from 0 to |

`...` |
Parameters of the distribution specified (as a character string) by |

`type` |
Methods applied for dynamic slicing. " |

`lambda` |
Penalty for introducing an additional slice, which is used to avoid making too many slices. It corresponds to the type I error under the scenario that the two variables are independent. |

`alpha` |
Penalty required for " |

`rounds` |
Number of permutations for estimating empirical |

If `x`

is an integer vector, `ds_test`

performs *K*-sample test (*K > 1*).

Under this scenario, suppose that there are observations `y`

drawn from some *continuous* populations. Let `x`

be a vector that stores values of indicator of samples from different populations, *i.e.*, `x`

has values *0, 1, …, K-1*. The null hypothesis is that these populations have the same distribution.

If `x`

is a character string naming a continuous (cumulative) distribution function, `ds_test`

performs one-sample test with the null hypothesis that the distribution function which generated `y`

is distribution `x`

with parameters specified by *…*. The parameters specified in *…* must be pre-specified and not estimated from the data.

Only empirical *p*-values are available by specifying the value of parameter `rounds`

, the number of permutation. `lambda`

and `alpha`

(for one-sample test with type "`ds`

") contributes to *p*-value.

The procedure of choosing parameter `lambda`

was described in Jiang, Ye & Liu (2015). Refer to http://www.people.fas.harvard.edu/~junliu/DS/lambda-table.html for the empirical relationship of `lambda`

, sample size and type I error.

A list with class "`htest`

" containing the following components:

`statistic` |
The value of the dynamic slicing statistic. |

`p.value` |
The |

`alternative` |
A character string describing the alternative hypothesis. |

`method` |
A character string indicating what type of test was performed. |

`data.name` |
A character string giving the name(s) of the data. |

`slices` |
Slicing strategy that maximize dynamic slicing statistic in |

Jiang, B., Ye, C. and Liu, J.S. Non-parametric *K*-sample tests via dynamic slicing. *Journal of the American Statistical Association*, 110(510): 642-653, 2015.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ```
## One-sample test
n <- 100
mu <- 0.5
y <- rnorm(n, mu, 1)
lambda <- 1.0
alpha <- 1.0
dsres <- ds_test(y, "pnorm", 0, 1, lambda = 1, alpha = 1, rounds = 100)
dsres <- ds_test(y, "pnorm", 0, 1, type = "ds", lambda = 1, alpha = 1)
dsres <- ds_test(y, "pnorm", 0, 1, type = "eqp", lambda = 1, rounds = 100)
dsres <- ds_test(y, "pnorm", 0, 1, type = "eqp", lambda = 1)
## K-sample test
n <- 100
mu <- 0.5
y <- c(rnorm(n, -mu, 1), rnorm(n, mu, 1))
## generate x in this way:
x <- c(rep(0, n), rep(1, n))
x <- as.integer(x)
## or in this way:
x <- c(rep("G1", n), rep("G2", n))
x <- relabel(x)
lambda <- 1.0
dsres <- ds_test(y, x, lambda = 1, rounds = 100)
dsres <- ds_test(y, x, type = "eqp", lambda = 1, rounds = 100)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.