Learn R Programming

forward (version 1.0.2)

fwdlm: Forward Search in Linear Regression

Description

This function applies the forward search approach to robust analysis in linear regression models.

Usage

fwdlm(formula, data, nsamp = "best", x = NULL, y = NULL, intercept = TRUE, 
      na.action, trace = TRUE)

Arguments

formula
a symbolic description of the model to be fit. The details of the model are the same as for lm.
data
an optional data frame containing the variables in the model. By default the variables are taken from the environment from which the function is called.
nsamp
the initial subset for the forward search in linear regression is found by fitting the regression model with the R function lmsreg (in package `lqs'. This argument allows to control how many subsets are used in the Least Median of Squares re
x
A matrix of predictors values (if no formula is provided).
y
A vector of response values (if no formula is provided).
intercept
Logical for the inclusion of the intercept (if no formula is provided).
na.action
a function which indicates what should happen when the data contain `NA's. The default is set by the `na.action' setting of `options', and is `na.fail' if that is unset. The default is `na.omit'.
trace
logical, if TRUE a message is printed for every ten iterations completed during the forward search.

Value

  • The function returns an object of class `fwdlm' with the following components:
  • callthe matched call.
  • Residualsa $(n \times (n-p+1))$ matrix of residuals.
  • Unita matrix of units added (to a maximum of 5 units) at each step.
  • includeda list with each element containing a vector of units included at each step of the forward search.
  • Coefficientsa $((n-p+1) \times p)$ matrix of coefficients.
  • tStatisticsa $((n-p+1) \times p)$ matrix of t statistics for the coefficients.
  • CookDista $((n-p) \times 1)$ matrix of forward Cook's distances.
  • ModCookDista $((n-p) \times 5)$ matrix of forward modified Cook's distances for the units (to a maximum of 5 units) included at each step.
  • Leveragea $(n \times (n-p+1))$ matrix of leverage values.
  • S2a $((n-p+1) \times 2)$ matrix with 1st column containing $S^2$ and the 2nd column $R^2$.
  • MaxResa $((n-p) \times 1)$ matrix of max studentized residuals.
  • MinDelResa $((n-p-1) \times 1)$ matrix of minimum deletion residuals.
  • StartingModela `lqs' object providing the the Least Median of Squares regression fit used to select the starting subset.

References

Atkinson, A.C. and Riani, M. (2000), Robust Diagnostic Regression Analysis, First Edition. New York: Springer, Chapters 2-3.

See Also

summary.fwdlm, plot.fwdlm, fwdsco, fwdglm.

Examples

Run this code
data(forbes)
plot(forbes, xlab="Boiling point", ylab="100 x log(pressure)")
mod <- fwdlm(y ~ x, data=forbes)
summary(mod)
plot(mod)
plot(mod, 1)
plot(mod, 6, ylim=c(-3, 1000))

Run the code above in your browser using DataLab