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

From: Marc Schwartz <>
Date: Fri, 11 Jul 2008 11:14:20 -0500

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?


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 mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Fri 11 Jul 2008 - 16:37:29 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 11 Jul 2008 - 20:33:27 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive