model.list
.
lm.model.list(formula, ...) glm.model.list(formula, ...) censorReg.model.list(formula, ...)
"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.
"Examples"
for an example of this.)
censorRegList
representing the fit. See
,
etc. for 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.
# 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