- object
The class of this object determines which of the methods is used:
There are special methods for output objects from function lm
(or linear model objects inheriting from class lm
generated by other functions like glm
and svyglm
)
and for formula objects.
For all other types of object, the default method is used.
Thus, object can be
a formula (e.g. y~x1+x2+x3+x2:x3
) (cf. below for details)
OR
the output of a linear model call (inheriting from class lm
, but not mlm
);
output objects from lm
, glm
, svyglm
or aov
work
(if linear with identity link in case of glm's);
there may be further functions that output objects inheriting from lm
which may or may not work reasonably with calc.relimp
;
for calc.relimp
to be appropriate, the underlying model must at least be linear!
The restrictions on usage of interactions listed under item formula below also
apply to linear model objects.
OR
the covariance matrix of a response y and regressors x,
(e.g. obtained by cov(cbind(y,x)), if y is a column vector of response values
and x a corresponding matrix of regressors)
OR
a (raw) data matrix or data frame with the response variable in the first column
OR
a response vector or one-column matrix,
if x
contains the corresponding matrix or data frame of regressors.
- formula
The first object, if a formula is to be given;
one response only.
Interaction terms are currently limited to second-order.
Note: If several interaction terms are given, calculations may be very
resource intensive, if these are all connected (e.g. with A:B, B:C, C:D, all A,B,C,D are connected,
while with A:B, C:D, D:E there are separate groups A,B and C,D,E).
Interaction terms occurring in always do not increase resource usage
(but are only permitted if the respective main effects also occur in always).
Interactions and groups currently cannot be used simultaneously.
- x
a (raw) data matrix or data frame containing the regressors,
if object
is a response vector or one-column matrix
OR
NULL, if object
is anything else
- type
can be a character string, character vector or list of character strings.
It is the collection of metrics that are to be calculated.
Available metrics: lmg
, pmvd
(non-US version only), last
, first
,
betasq
, pratt
, genizi
and car
. For brief sketches of their meaning cf. details section.
- diff
logical; if TRUE, pairwise differences between the relative contributions are calculated; default FALSE
- rank
logical; if TRUE, ranks of regressors in terms of relative contributions are calculated; default TRUE
- rela
is a logical requesting relative importances summing to 100% (rela=TRUE
).
If rela is FALSE (default), some of the metrics sum to \(R^2\) (lmg
, pmvd
, pratt
),
others do not have a meaningful sum (last
, first
, betasq
).
- always
is a vector of column numbers or names of variables to be always in the
model (adjusted for). Valid numbers are 2 to (number of regressors + 1) (1 is reserved for the response),
valid character strings are all column names of object
or x
respectively
that refer to regressor variables. Numbers and names cannot be mixed.
Relative importance is only assessed for the variables not selected in always
.
This option currently does not work for metrics genizi
and car
.
- groups
is a list of vectors of column numbers or names of variables to be combined into groups.
If only one group is needed, a vector can be given. The numbers and character strings needed are of the same form
as for always
.
Relative importance is only allocated between groups of regressors, no subdivision within groups is calculated.
Regressors that do not occur in any group are included as singletons.
A regressor must not occur in always
and in groups
. Also, groups cannot be used with a linear model or a formula
in case of higher order effects (interactions). Finally, groups
only works with the four metrics
lmg
, pmvd
, last
and first
.
- groupnames
is a vector of names for the variable groups to be used for annotation of output.
- weights
is a vector of case weights for the observations in the data frame (or matrix).
You can EITHER specify weights
OR a design
.
Note that weights must not be specified for linear model objects (since these should contain their weights as
part of the model).
- design
is a design object of class survey.design
(cf. package survey).
You can EITHER specify a design
OR weights
. For calc.relimp
, the design is used
for calculating weights only.
Note that it is discouraged (though possible) to specify a design for a conventional linear model object
(since a survey-specific linear model should be used for survey data, cf. function svyglm
).
Also note that care is needed when using subset
together with design
:
the subset
-Option only treats the data
handed directly to calc.relimp
,
the design
has to be equivalently treated beforehand.
- data
if first object is of class formula:
an optional matrix or data frame that the variables in formula and subset come from;
if it is omitted, all names must be meaningful in the environment from which calc.relimp is called
- subset
if first object is of class formula:
an optional expression indicating the subset of the observations of data
that should be used in the fit.
This can be a logical vector, or a numeric vector indicating which observation numbers are to be included,
or a character vector of the row names to be included. All (non-missing) observations are included by
default.
- na.action
if first object is of class formula:
an optional function that indicates what should happen when the data contain 'NA's.
The default is first, any na.action attribute of data, second the setting given in the call to calc.relimp,
third the na.action setting of options. Possible choices are "na.fail",
(print an error message and terminate if there are any incomplete observations),
"na.omit" or "na.exclude" (equivalent for package relaimpo
,
both analyse complete cases only and print a warning, this is also what is done the default method ).
- ...
usable for further arguments,
particularly most arguments of default method can be given to all other methods
(exception: weights and design cannot be given to lm-method)