logconTwoSample: Compute p-values for two-sample test based on log-concave CDF...

View source: R/logconTwoSample.r

logconTwoSampleR Documentation

Compute p-values for two-sample test based on log-concave CDF estimates

Description

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.

Usage

logconTwoSample(x, y, which = c("MLE", "smooth"), M = 999, 
    n.grid = 500, display = TRUE, seed0 = 1977)

Arguments

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 maxDiffCDF for details.

display

If TRUE progress of computations is shown.

seed0

Set seed to reproduce results.

Details

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.

Value

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.

Warning

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.

Author(s)

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

References

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. \Sexpr[results=rd]{tools:::Rd_expr_doi("https://doi.org/10.18637/jss.v039.i06")}

Examples

## 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)

logcondens documentation built on Aug. 22, 2023, 5:06 p.m.