Look at:

?update

For example:

lm.obj <- lm (y ~ x1 + ... + x300)

lm.obj1 <- update(lm.obj, . ~ .  - x1)

lm.obj2 <- update(lm.obj1, . ~ .  - x2)


Ravi.

____________________________________________________________________

Ravi Varadhan, Ph.D.
Assistant Professor,
Division of Geriatric Medicine and Gerontology
School of Medicine
Johns Hopkins University

Ph. (410) 502-2619
email: rvarad...@jhmi.edu


----- Original Message -----
From: ph84 <masterods...@gmx.de>
Date: Thursday, March 12, 2009 3:28 pm
Subject: [R]  stats lm() function
To: r-help@r-project.org


>  Hi,
>  
>  Im using the lm() function where the formula is quite big (300 arguments)
>  and the data is a frame of 3000 values.
>  
>  This is running in a loop where in each step the formula is reduced 
> by one
>  argument, and the lm command is called again (to check which 
> arguments are
>  useful) .
>  
>  This takes 1-2 minutes.
>  Is there a way to speed this up?
>  i checked the code of the lm function and its seems that its 
> preparing the
>  data and then calls lm.Fit(). i thought about just doing this praparing
>  stuff first and only call lm.fit() 300 times.
>  
>  
>  -- 
>  View this message in context: 
>  Sent from the R help mailing list archive at Nabble.com.
>  
>  ______________________________________________
>  R-help@r-project.org mailing list
>  
>  PLEASE do read the posting guide 
>  and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to