best.r.sq | R Documentation |
Finds the subset of explanatory variables in a formula that best explain the variation in a multivariate response, as measured by a chosen definition of R^2. Modifications are included for high dimensional data, such as multivariate abundance data in ecology.
best.r.sq(formula, data = parent.frame(), subset, var.subset, n.xvars= min(3, length(xn)), R2="h", ...)
formula |
a mvformula, a multivariate formula. |
data |
optional, the data.frame (or list) from which the variables in formula should be taken. |
subset |
an optional vector specifying a subset of observations to be used in the fitting process. |
var.subset |
an optional vector specifying the subset of the responses to be used. |
n.xvars |
the number of independent variables with the highest average R^2 that should be found. |
R2 |
the type of R^2 (correlation coefficient) that should be shown, possible values are: |
... |
further arguments that are passed on to lm. |
best.r.sq
finds the n.xvars
influence variables obtained by a
forward selection in a multivariate linear model given by formula
.
Only the response variables given by var.subset
are considered. However,
if var.subset
is NULL
all response variables are considered.
Interactions are excluded from the search mechanism, however the indices that are
returned correspond to the indices in the model. This function is intended as an
exploratory tool which can be used for example in plotting, and is not intended
as a tool for formal model selection.
choose 'all possible subsets'
the moment)
This function returns a list consisting of:
a vector of indices of independent variables with the greatest explanatory power, as previously.
a vector of total R^2 from sequential model fits including each of
the model terms identified in xs
.
a matrix containing the total R^2 for each term in the model at each addition step (steps in columns and model terms in rows).
Ulrike Naumann and David Warton <David.Warton@unsw.edu.au>.
data(spider) spiddat <- mvabund(spider$abund) X <- as.matrix(spider$x) best.r.sq( spiddat~X )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.