Learn R Programming

PEkit (version 1.0.0.1000)

mult.sample.test: Test for \(\psi\) of multiple samples

Description

Likelihood ratio test for the hypotheses \(H_0: \: \psi_1=\psi_2=...=\psi_d\) and \(H_1: \: \psi_1 \neq \psi_2 \neq ... \neq \psi_d\), where \(\psi_1,\psi_2,\)...\(,\psi_d\) are the dispersal parameters of the \(d\) samples in the columns of the input data array x.

Usage

mult.sample.test(x)

Arguments

x

The data array to be tested. Each column of x is an independent sample.

Value

Gives a vector with the Likelihood Ratio Test -statistic Lambda, as well as the p-value of the test p.

Details

Calculates the Likelihood Ratio Test statistic $$-2log(L(\hat{\psi})/L(\hat{\psi}_1, \hat{\psi}_2, ..., \hat{\psi}_d)),$$ where L is the likelihood function of observing the \(d\) input samples given a single \(\psi\) in the numerator and \(d\) different parameters \(\psi_1,\psi_2,\)...\(,\psi_d\) for each sample respectively in the denominator. According to the theory of Likelihood Ratio Tests, this statistic converges in distribution to a \(\chi_{d-1}^2\)-distribution when the null-hypothesis is true, where \(d-1\) is the difference in the amount of parameters between the considered models. To calculate the statistic, the Maximum Likelihood Estimate for \(\psi_1,\: \psi_2,\: ..., \: \psi_d\) of \(H_1\) and the shared \(\psi\) of \(H_0\) are calculated.

References

Neyman, J., & Pearson, E. S. (1933). On the problem of the most efficient tests of statistical hypotheses. Philosophical Transactions of the Royal Society of London. Series A, Containing Papers of a Mathematical Or Physical Character, 231(694-706), 289-337. <10.1098/rsta.1933.0009>.

Examples

Run this code
# NOT RUN {
##Create samples with different n and psi:
set.seed(111)
x<-rPD(1200, 15)
y<-c( rPD(1000, 20), rep(NA, 200) )
z<-c( rPD(800, 30), rep(NA, 400) )
samples<-cbind(cbind(x, y), z)
##Run test
mult.sample.test(samples)
# }

Run the code above in your browser using DataLab