[R] More compact form of lm object that can be used for prediction?

Marc Schwartz marc_schwartz at comcast.net
Fri Jul 11 18:14:20 CEST 2008


on 07/11/2008 10:50 AM Woolner, Keith wrote:
> Hi everyone,
> 
>  
> 
> Is there a way to take an lm() model and strip it to a minimal form (or
> convert it to another type of object) that can still used to predict the
> dependent variable?

<snip>

Depending upon how much memory you need to conserve and what else you 
may need to do with the model object:


1. lm(YourFormula, data = YourData, model = FALSE)

'model = FALSE' will result in the model frame not being retained.



2. lm(YourFormula, data = YourData, model = FALSE, x = FALSE)

'x = FALSE' will result in the model matrix not being retained.


See ?lm for more information.

HTH,

Marc Schwartz



More information about the R-help mailing list