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)
A two dimensional vector containing the \(p\)-values.
The test statistics for the original samples.
A \(M \times 2\) matrix containing the test statistics for all the permutations.
First data sample.
Second data sample.
Indicate for which type of estimate the test statistic should be computed.
Number of permutations.
Number of grid points in computation of maximal difference between smoothed log-concave CDFs. See maxDiffCDF
for details.
If TRUE
progress of computations is shown.
Set seed to reproduce results.
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
Lutz Duembgen, duembgen@stat.unibe.ch,
https://www.imsv.unibe.ch/about_us/staff/prof_dr_duembgen_lutz/index_eng.html
Given two i.i.d. samples \(x_1, \ldots, x_{n_1}\) and \(y_1, \ldots, 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.
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. tools:::Rd_expr_doi("https://doi.org/10.18637/jss.v039.i06")
if (FALSE) {
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)
}
Run the code above in your browser using DataLab