Learn R Programming

rms (version 8.1-0)

fastbw: Fast Backward Variable Selection

Description

Performs a slightly inefficient but numerically stable version of fast backward elimination on factors, using a method based on Lawless and Singhal (1978). This method uses the fitted complete model and computes approximate Wald statistics by computing conditional (restricted) maximum likelihood estimates assuming multivariate normality of estimates. fastbw deletes factors, not columns of the design matrix. Factors requiring multiple d.f. will be retained or dropped as a group. The function prints the deletion statistics for each variable in turn, and prints approximate parameter estimates for the model after deleting variables. The approximation is better when the number of factors deleted is not large. For ols, the approximation is exact for regression coefficients, and standard errors are only off by a factor equal to the ratio of the mean squared error estimate for the reduced model to the original mean squared error estimate for the full model.

If the fit was from ols, fastbw will compute the usual \(R^2\) statistic for each model.

Usage

fastbw(fit, rule=c("aic", "p"),
       type=c("residual", "individual", "total"),
       sls=.05, aics=0, eps=.Machine$double.eps,
       k.aic=2, force=NULL)

# S3 method for fastbw print(x, digits=4, estimates=TRUE, ...)

Arguments

Value

a list with an attribute kept if bw=TRUE, and the following components:

result

matrix of statistics with rows in order of deletion.

names.kept

names of factors kept in final model.

factors.kept

the subscripts of factors kept in the final model

factors.deleted

opposite of factors.kept.

parms.kept

column numbers in design matrix corresponding to parameters kept in the final model.

parms.deleted

opposite of parms.kept.

coefficients

vector of approximate coefficients of reduced model.

var

approximate covariance matrix for reduced model.

Coefficients

matrix of coefficients of all models. Rows correspond to the successive models examined and columns correspond to the coefficients in the full model. For variables not in a particular sub-model (row), the coefficients are zero.

References

Lawless, J. F. and Singhal, K. (1978): Efficient screening of nonnormal regression models. Biometrics 34:318--327.

See Also

rms, ols, lrm, cph, psm, validate, solvet, rmsMisc

Examples

Run this code
if (FALSE) {
fastbw(fit, optional.arguments)     # print results
z <- fastbw(fit, optional.args)     # typically used in simulations
lm.fit(X[,z$parms.kept], Y)         # least squares fit of reduced model
}

Run the code above in your browser using DataLab