View source: R/Parameter_estimation_and_hypothesis_testing.R
two.sample.test | R Documentation |
\psi
Likelihood ratio test for the hypotheses H_0: \: \psi_1=\psi_2
and
H_1: \: \psi_1 \neq \psi_2
, where \psi_1
and \psi_2
are the
dispersal parameters of two input samples s1
and s2
.
two.sample.test(s1, s2)
s1, s2 |
The two data vectors to be tested. |
Calculates the Likelihood Ratio Test statistic
-2log(L(\hat{\psi})/L(\hat{\psi}_1, \hat{\psi}_2)),
where L is the likelihood function of observing the two input samples given
a single \psi
in the numerator and two different parameters \psi_1
and \psi_2
for each sample respectively in the denominator. According
to the theory of Likelihood Ratio Tests, this statistic converges in
distribution to a \chi_d^2
-distribution under the null-hypothesis, where d
is the
difference in the amount of parameters between the considered models, which
is 1 here. To calculate the statistic, the Maximum Likelihood Estimate for
\psi_1,\: \psi_2
of H_1
and the shared \psi
of H_0
are calculated.
Gives a vector with the Likelihood Ratio Test -statistic Lambda
, as well as the
p-value of the test p
.
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. <\Sexpr[results=rd]{tools:::Rd_expr_doi("10.1098/rsta.1933.0009")}>.
##Create samples with different n and psi:
set.seed(111)
x<-rPD(500, 15)
y<-rPD(1000, 20)
z<-rPD(800, 30)
##Run tests
two.sample.test(x,y)
two.sample.test(x,z)
two.sample.test(y,z)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.