fitcomp: Component Effects for a Model Fit

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/regr.R

Description

Determines effects of varying each of the given variables while all others are held constant. This function is mainly used to produce plots of residuals versus explanatory variables, also showing component effects.

Usage

1
2
fitcomp(object, data = NULL, vars=NULL, se = FALSE, 
  xm = NULL, xfromdata = FALSE, noexpand=NULL, nxcomp = 51)

Arguments

object

a model fit, result of a fitting function

data

data frame in which the variables are found

vars

character vector of names of variables for which components are required. Only variables that appear in data will be used.

se

if TRUE, standard errors will be returned

xm

named vector of values of the fixed (central) point from which the individual variables are varied in turn.
Defaults to the componentwise median of quantitative variables and the modes of factors.

xfromdata

if TRUE, the components effects will be evaluated for the data values in data, otherwise, the range of each variable is filled with nxcomp equidistant points. This is useful for residual plots with component effects

noexpand

vector determining which variables should not be “filled in”, probably because they are used like factors. Either a character vector of variable names or a vector of logical or numerical values with names, in which case the names corresponding to positive values will be identified.

nxcomp

number of points used for each (quantitative) variable if xfromdata is FALSE

Details

The component effect is defined as the curve of fitted values obtained by varying the explanatory variable, keeping all the other variables at their "central value" (the mean of continuous variables and the mode of factors).

Value

A list consisting of

comp

component effects

x

the values of the x variables for which the effects have been calculated

xm

the values of the x variables that are held fixed while one of the variables is varied

se

standard errors of the component effects, if required by the argument se

Author(s)

Werner A. Stahel, ETH Zurich

See Also

predict

Examples

1
2
3
4
data(d.blast)
t.r <- regr(log10(tremor)~location+log10(distance)+log10(charge), data=d.blast)
t.fc <- fitcomp(t.r,se=TRUE)
t.fc$comp[1:10,]

regr0 documentation built on May 31, 2017, 2:26 a.m.