Compute p-values for two-sample test based on log-concave CDF estimates
Compute p-values for a test for the null hypothesis of equal CDFs of two samples. The test statistic is reminiscient of Kolmogorv-Smirnov's, but instead of computing it for the empirical CDFs, this function computes it based on log-concave estimates for the CDFs.
logconTwoSample(x, y, which = c("MLE", "smooth"), M = 999, n.grid = 500, display = TRUE, seed0 = 1977)
x |
First data sample. |
y |
Second data sample. |
which |
Indicate for which type of estimate the test statistic should be computed. |
M |
Number of permutations. |
n.grid |
Number of grid points in computation of maximal difference between smoothed log-concave CDFs. See |
display |
If |
seed0 |
Set seed to reproduce results. |
Given two i.i.d. samples x_1, …, x_{n_1} and y_1, …, y_{n_2} this function computes a permutation test p-value that provides evidence against the null hypothesis
H_0 : F_1 = F_2
where F_1, F_2 are the CDFs of the samples, respectively. A test either based on the log-concave MLE or on its smoothed version (see Duembgen and Rufibach, 2009, Section 3) are provided. Note that computation of the smoothed version takes considerably more time.
p.value |
A two dimensional vector containing the p-values. |
test.stat.orig |
The test statistics for the original samples. |
test.stats |
A M \times 2 matrix containing the test statistics for all the permutations. |
Note that the algorithm that finds the maximal difference for the smoothed estimate is of approximative nature only. It may fail for very large sample sizes.
Kaspar Rufibach, kaspar.rufibach@gmail.com,
http://www.kasparrufibach.ch
Duembgen, L. and Rufibach, K. (2009) Maximum likelihood estimation of a log–concave density and its distribution function: basic properties and uniform consistency. Bernoulli, 15(1), 40–68.
Duembgen, L. and Rufibach, K. (2011) logcondens: Computations Related to Univariate Log-Concave Density Estimation. Journal of Statistical Software, 39(6), 1–28. http://www.jstatsoft.org/v39/i06
## Not run: n1 <- 30 n2 <- 25 x <- rgamma(n1, 2, 1) y <- rgamma(n2, 2, 1) + 1 twosample <- logconTwoSample(x, y, which = c("MLE", "smooth")[1], M = 999) ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.