Fit Model From a Model List.

DESCRIPTION:

Returns a fitted model, based on an object of class model.list.

USAGE:

lm.model.list(formula, ...) 
glm.model.list(formula, ...) 
censorReg.model.list(formula, ...) 

REQUIRED ARGUMENTS:

formula
a "model.list" object, typically created by a call to the modeling function using "method=model.list". See for a description of the model.list object.

OPTIONAL ARGUMENTS:

Remaining arguments are the same as for the default methods and are usually not needed, since the data they represent are embedded in the model list. If extra arguments are provided, however, the model is refit using the original arguments used to create the model list, superceded by those provided in this call. (See "Examples" for an example of this.)

VALUE:

a fitted model object of class , , , or censorRegList representing the fit. See , etc. for details.

DETAILS:

These routines are designed to support the function, which may call modeling functions hundreds of times. The construction of a fitted model object from scratch follows three basic steps: construction of the model frame from the data; combining the relevant pieces from the model frame and fitting parameters into the model list; and fitting the results. The first two steps are redundant from the point of view of . Therefore, modeling functions , and provide the option of returning the model list (without fitting) via the method argument. Functions lm.model.list, etc. (which are called repeatedly by , etc.) then perform the fit given the model list.

SEE ALSO:

, , , , , , ,

EXAMPLES:

# Equivalent ways of making an lm object. 
weights <- runif(60) 
fitform <- Mileage~Weight+Fuel 
fit1 <- lm(fitform,fuel.frame,weights=weights) 
ml <- lm(fitform,fuel.frame,weights=weights,method="model.list") 
fit2 <- lm(ml)  # calls lm.model.list 
 
# All equal but the calls 
all.equal(fit1[names(fit1)!="call"], fit2[names(fit2)!="call"])  # T 
 
## Using lm with bootstrap 
# slow 
wdata <- data.frame(fuel.frame,weights) 
b1 <- bootstrap(wdata, coef(lm(fitform, data=wdata, weights=weights)), 
                B=200, seed=0) 
# fast: calls lm.model.list 
b2 <- bootstrap(ml, coef(lm(ml)), B=200, seed=0) 
# also fast: dispatches to bootstrap.lm, which calls lm.model.list 
b3 <- bootstrap(fit1, coef, B=200, seed=0) 
all.equal(b1[names(b1)!="call"], b2[names(b2)!="call"])  # T 
all.equal(b2[names(b2)!="call"], b3[names(b3)!="call"])  # T 
# 
# Use lm.model.list to add weights 
# 
ml <- lm(fitform, fuel.frame, method = "model.list") 
fit3 <- lm(ml, weights = weights)  # same as fit2, except for call