LRT
performs a likelihood ratio (LR) test between two model fits, the ``full'' and the ``null'' model fits,
currently differing only in their fixed effects. Parametric bootstrap p-values can be computed, either using the raw bootstrap distribution of the likelihood ratio, or a bootstrap estimate of the Bartlett correction of the LR statistic.
This function differ from fixedLRT
in its arguments (model fits for LRT
, but all arguments required to fit the models for fixedLRT
), and in the format of its return value. The function will stop or return possibly incorrect results for models differing beyond their fixed effects. By conceptual drift, anova
works as an alias for LRT
.
# S3 method for HLfit
anova(object, object2, ..., method="")
LRT(object, object2, boot.repl=0, nb_cores=NULL, ...)
Two models fits being compared (their order does not matter).
the number of bootstrap replicates.
Number of cores to use for parallel computation of bootstrap. The default is spaMM.getOption("nb_cores")
, and 1 if the latter is NULL. nb_cores=1
prevents the use of parallelisation procedures.
For development purposes, not documented.
Further arguments passed to or from other methods.
An object of class fixedLRT
, actually a list with as-yet unstable format, but here with typical elements (depending on the options)
the HLfit object for the full model;
the HLfit object for the null model;
A data frame including values of the likelihood ratio chi2 statistic, its degrees of freedom, and the p-value;
and, if a bootstrap was performed:
A data frame including values of the likelihood ratio chi2 statistic, its degrees of freedom, and the raw bootstrap p-value;
A data frame including values of the Bartlett-corrected likelihood ratio chi2 statistic, its degrees of freedom, and its p-value;
a list with the following elements:
A table of fitted likelihoods for bootstrap replicates;
The mean likelihood ratio chi-square statistic for boostrap replicates;
A raw bootstrap p-value can be computed from the simulated distribution as (1+sum(t >= t0))/(N+1)
where t0
is the original likelihood ratio, t
the vector of bootstrap replicates and N
its length. See Davison & Hinkley (1997, p. 141) for discussion of the adjustments in this formula. However, a computationally more economical use of the bootstrap is to provide a Bartlett correction for the likelihood ratio test in small samples. According to this correction, the mean value \(m\) of the likelihood ratio statistic under the null hypothesis is computed (here estimated by a parametric bootstrap) and the original LR statistic is multiplied by \(n/m\) where \(n\) is the number of degrees of freedom of the test.
Bartlett, M. S. (1937) Properties of sufficiency and statistical tests. Proceedings of the Royal Society (London) A 160: 268-282.
Davison A.C., Hinkley D.V. (1997) Bootstrap methods and their applications. Cambridge Univ. Press, Cambridge, UK.
See also fixedLRT
.
# NOT RUN {
data("wafers")
## Gamma GLMM with log link
m1 <- HLfit(y ~X1+X2+X1*X3+X2*X3+I(X2^2)+(1|batch),family=Gamma(log),
resid.model = ~ X3+I(X3^2) ,data=wafers,HLmethod="ML")
m2 <- update(m1,formula.= ~ . -I(X2^2))
anova(m1,m2)
# }
Run the code above in your browser using DataLab