anova
method for class "manylm" - computes an analysis of variance
table for one or more linear model fits to high-dimensional data, such as
multivariate abundance data in ecology.## S3 method for class 'manylm':
anova(object, \dots, resamp="perm.resid", test="F", p.uni="none",
nBoot=1000, cor.type=object$cor.type, shrink.param=object$shrink.param,
studentize=TRUE, calc.rss = FALSE, tol=1.0e-10, rep.seed=FALSE, bootID=NULL )
## S3 method for class 'anova.manylm':
print(
x, digits = max(getOption("digits") - 3, 3),
signif.stars = getOption("show.signif.stars"),
dig.tst = max(1, min(5, digits - 1)),
eps.Pvalue = .Machine$double.eps, ...)
manylm
, usually, a result of a call to manylm
.anova.manylm
method, these are optional further objects of class manylm
, which are usually a result of a call to manylm
.
for the print.anova.manylm
method thes"LR"
= likelihood ratio statistic, "F"
= Lawley-Hotelling trace statistic or NULL
for no test.cor.type="shrink"
. If not supplied, but needed, it will be estimated by estimated from the data by Cross Validation using the normal likelihood as in Warton (2008).bootID
is supplied, nBoot
is set to the number of rows in bootID
. Default is NULL
."anova.manylm"
, usually, a result of a call to anova.manylm
.TRUE
, "anova.manylm"
. A list containing at least:manylm
object
or for several manylm
objects.p.uni="adjusted"
or p.uni="unadjusted"
the output list also
contains:anova.manylm
objects prints the output in a
anova.manylm
function returns a table summarising the statistical significance of a fitted manylm model, or of the differences between several nested models fitted to the same dataset. If one model is specified, sequential test statistics (and P values) are returned for that fit. If more than one object is specified, the table contains test statistics (and P values) comparing their fits.
The test statistics are determined by the argument test
, and the P-values are calculated by resampling rows of the data using a method determined by the argument resampling
. The four possible resampling methods are residual-permutation (Anderson and Robinson (2001)), score resampling (Wu (1986)), case and residual resampling (Davison and Hinkley (1997, chapter 6)), and involve resampling under the null hypothesis (except for case resampling). These methods ensure approximately valid inference even when the correlation between variables has been misspecified, and for case and score resampling, even when the equal variance assumption of linear models is invalid. By default, studentised residuals (r_i/sqrt(1-h_ii)) are used in residual and score resampling, although raw residuals could be used via the argument studentize=FALSE
. If resamp="none"
, p-values cannot be calculated, however the test statistics are returned.
If you do not have a specific hypothesis of primary interest that you want to test, and are instead interested in which model terms are statistically significant, then the summary.manylm
function is more appropriate.
More than one object should only be specified when the models are nested. In this case the ANOVA table has a column for the residual degrees of freedom and a column for change in degrees of freedom. It is conventional to list the models from smallest to largest, but this is up to the user.
To check model assumptions, use plot.manylm
.
The anova.manylm
function is designed specifically for high-dimensional data (that, is when the number of variables p is not small compared to the number of observations N). In such instances a correlation matrix is computationally intensive to estimate and is numerically unstable, so by default the test statistic is calculated assuming independence of variables (cor.type="I"
). Note however that the resampling scheme used ensures that the P-values are approximately correct even when the independence assumption is not satisfied. However if it is computationally feasible for your dataset, it is recommended that you use cor.type="shrink"
to account for correlation between variables, or cor.type="R"
when p is small. The cor.type="R"
option uses the unstructured correlation matrix (only possible when N>p), such that the standard classical multivariate test statistics are obtained. Note however that such statistics are typically numerically unstable and have low power when p is not small compared to N. The cor.type="shrink"
option applies ridge regularisation (Warton 2008), shrinking the sample correlation matrix towards the identity, which improves its stability when p is not small compared to N. This provides a compromise between "R"
and "I"
, allowing us to account for
correlation between variables, while using a numerically stable test statistic that has good properties. The shrinkage parameter by default is estimated by cross-validation using the multivariate normal likelihood function, although it can be specified via shrink.param
as any value between 0 and 1 (0="I" and 1="R", values closer towards 0 indicate more shrinkage towards "I"). The validation groups are chosen by random assignment and so you may observe some slight variation in the estimated shrinkage parameter in repeat analyses.
See ridgeParamEst
for more details.
Rather than stopping after testing for multivariate effects, it is often of interest to find out which response variables express significant effects. Univariate statistics are required to answer this question, and these are reported if requested. Setting p.uni="unadjusted"
returns the resampling-based univariate ANOVA P-values as well as the multivariate P-values, whereas p.uni="adjusted"
returns adjusted ANOVA P-values (that have been adjusted for
multiple testing), calculated using a step-down resampling algorithm as in Westfall & Young (1993, Algorithm 2.8). This method provides strong control of family-wise error rates, and makes use of resampling (using the method controlled by resampling
) to ensure inferences take into account correlation between variables.manylm
, summary.manylm
, plot.manylm
## Load the spider dataset:
data(spider)
spiddat <- log(spider$abund+1)
spiddat <- mvabund(spiddat)
spidx <- spider$x
## Fit several multivariate linear models:
fit <- manylm( spiddat ~ spidx ) # model with all explanatory variables
## Use the default residual resampling to test the significance of this model:
## return summary of the manylm model
anova(fit)
## intercept model
fit0 <- manylm(spiddat ~ 1)
## include soil and leaf variables
fit1 <- update(fit0, . ~ . + spidx[, c(1, 3)])
## include moss variables
fit2 <- update(fit1, . ~ . + spidx[, 4])
## Use (residual) resampling to test the significance of these models,
## accounting for correlation between variables by shrinking
## the correlation matrix to improve its stability:
anova(fit, fit0, fit1, fit2, cor.type="shrink")
## Use the sum of F statistics to estimate multivariate significance from
## 5000 resamples, and also reporting univariate statistics with
## adjusted P-values:
anova(fit, fit0, fit1, fit2, nBoot=5000, test="F", p.uni="adjust")
Run the code above in your browser using DataLab