p_ks.test | R Documentation |
Generates one or two sets of continuous data group-level data and returns a p-value under the null that the groups were drawn from the same distribution (two sample) or from a theoretically known distribution (one sample).
p_ks.test(n, p1, p2, n2_n1 = 1, two.tailed = TRUE, parent = NULL, ...)
n |
sample size per group, assumed equal across groups |
p1 |
a function indicating how the data were generated for group 1 |
p2 |
(optional) a function indicating how the data were generated for group 2.
If omitted a one-sample test will be evaluated provided that |
n2_n1 |
sample size ratio. Default uses equal sample sizes |
two.tailed |
logical; should a two-tailed or one-tailed test be used? |
parent |
the cumulative distribution function to use
(e.g., |
... |
additional arguments to be passed to the
|
a single p-value
Phil Chalmers rphilip.chalmers@gmail.com
gen_t.test
# two-sample test from two Gaussian distributions with different locations
p1 <- function(n) rnorm(n)
p2 <- function(n) rnorm(n, mean=-.5)
p_ks.test(n=100, p1, p2)
# one-sample data from chi-squared distribution tested
# against a standard normal distribution
pc <- function(n, df=15) (rchisq(n, df=df) - df) / sqrt(2*df)
p_ks.test(n=100, p1=pc, parent=pnorm, mean=0, sd=1)
# empirical power estimates
p_ks.test(n=100, p1, p2) |> Spower()
p_ks.test(n=100, p1=pc, parent=pnorm, mean=0, sd=1) |> Spower()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.