| lr_test {RRPP} | R Documentation | 
Likelihood ratio test for a linear model, based on RRPP
Description
Function performs likelihood ratio tests on an lm.rrpp fit, using 
RRPP or FRPP.  Likelihood ratio statistics are calculated for every random 
permutation, and the effect size is estimated from the distribution of 
random statistics.  The likelihood ratio tests has some resemblance to
MANOVA, especially using Wilks' lambda.  Sums of squares and cross-products 
(SSCP) matrices are calculated over the random permutations of 
a lm.rrpp fit.  SSCP matrices are 
computed, as are the inverse of R times H (invR.H), where R is a SSCP 
for the residuals or random effects and H is
the difference between SSCP matrices of full and reduced models 
(see manova.update).   From invR.H, Wilks lambda is first estimated, and the 
likelihood ratio stat is then estimated as -n * log(Wilks).
This function does one of two things.  It either performs an update using
manova.update, using Wilks' lambda as the test statistic, converting 
Wilks' lambda to likelihood ratio statistics or it uses the results from
a previously performed update to calculate new statistics.
Usage
lr_test(fit, verbose = FALSE, ...)
Arguments
| fit | Linear model fit from  | 
| verbose | Logical value for whether to include all random Wilks' lambda and likelihood ratio statistics from random permutations. | 
| ... | Arguments passed onto  | 
Author(s)
Michael Collyer
References
Adams, D. C., and M. L. Collyer. 2024. Extended phylogenetic regression models for comparing within-species patterns across the tree of life. Methods in Ecology and Evolution. In review.
Examples
   
# Body Shape Analysis (Multivariate) ----------------
## Not run: 
data(Pupfish)
# Although not recommended as a practice, this example will use only
# three principal components of body shape for demonstration.  
# A larger number of random permutations should also be used.
Pupfish$shape <- ordinate(Pupfish$coords)$x[, 1:3]
fit <- lm.rrpp(shape ~ log(CS) + Sex, SS.type = "I", 
data = Pupfish, print.progress = FALSE, iter = 499) 
summary(fit, formula = FALSE)
anova(fit) # ANOVA table
# MANOVA
fit.m <- manova.update(fit, print.progress = FALSE, tol = 0.001)
summary(fit.m, test = "Roy")
summary(fit.m, test = "Wilks")
# Likelihood Ratio Test
LRT <- lr_test(fit.m)
summary(LRT)
## End(Not run)