Updating fitted models. The ditto name ``<tt>.</tt>''



next up previous contents
Next: Generalized linear models; Up: Statistical models in Previous: ANOVA tables

Updating fitted models. The ditto name ``.''

The update() function is largely a convenience function that allows a model to be fitted that differs from one previously fitted usually by just a few additional or removed terms. Its form is

new.model <- update(old.model, new.formula)

In the new.formula the special name consisting of a period, ``.'', only, can be used to stand for ``the corresponding part of the old model formula''. For example

> fm05 <- lm(y ~ x1 + x2 + x3 + x4 + x5, data=production)
> fm6  <- update(fm05, . ~ . + x6)
> smf6 <- update(fm6, sqrt(.) ~ .)
would fit a five variate multiple regression with variables (presumably) from the data frame production, fit an additional model including a sixth regressor variable, and fit a variant on the model where the response had a square root transform applied.

Note especially that if the data= argument is specified on the original call to the model fitting function, this information is passed on through the fitted model object to update() and its allies.

The name ``.'' can also be used in other contexts, but with slightly different meaning. For example

> fmfull <- lm(y ~. , data=production)

would fit a model with response y and regressor variables all other variables in the data frame production.

Other functions for exploring incremental sequences of models are add1(), drop1(), step() and stepwise(). The names of these give a good clue to their purpose, but for full details see the help document.



Erik Moledor
Tue Jan 31 21:02:18 EST 1995
s