Description Usage Arguments Details Value Author(s) References See Also Examples
Performs bootstrapping with the Kolmogorov-Smirnov test to estimate differences between frequencies
1 |
x |
The first vector |
y |
The second vector |
nboots |
The number of bootstraps to perform |
alternative |
The type of alternative hypothesis (the default is "two.sided") |
This bootstrap version of the Kolmogorov-Smirnov test is suitable for estimating not only continuous but also frequency distributions. This is because bootstrap theories suggest that the asymptotic theory of estimates (which is built on the bootstrapping data) is, in a sense, similar to the asymptotic theory of large data sets. Hence, although the Kolmogorov-Smirnov test is initially designed for continuous distributions, in bootstrapping, it is possible to apply this method to discrete random variables, for which an empirical distribution function is built on the observed frequencies (see Abadie 2002 for an example).
The list with the following components: "ksboot.pvalue" for the bootstrap p-value of the Kolmogorov-Smirnov test, calculated for the null hypothesis that the probability densities of two compared distributions are the same; "nboots" for the number of the completed bootstraps.
Jasjeet S. Sekhon, Alexey Shipunov
Abadie A. 2002. Bootstrap tests for distributional treatment effects in instrumental variable models. Journal of the American statistical Association. 97: 284-292.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | data <- stack(data.frame(V1=c(1213, 57683, 74466, 44419, 17481, 3403, 42252, 7045,
29445, 15004, 21337, 1892, 21861, 238, 26574, 17579),
V2=c(3185, 29692, 12570, 26081, 4992, 1659, 16592, 1748, 37583, 6751, 10188, 355,
8116, 9, 5064, 1846)))
ksboot(data$values[data$ind == "V1"], data$values[data$ind == "V2"])
pairwise.table(function(i, j)
suppressWarnings(ksboot(data$values[as.integer(data$ind) == i],
data$values[as.integer(data$ind) == j])$ksboot.pvalue),
levels(data$ind), p.adjust.method="bonferroni")
pairwise.table(function(i, j)
suppressWarnings(ksboot(data$values[as.integer(data$ind) == i],
data$values[as.integer(data$ind) == j])$ksboot.pvalue),
levels(data$ind), p.adjust.method="none")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.