Skip to content
Back to formatted view

Raw Message

Message-ID: <f97ef02f457c.49b92b96@johnshopkins.edu>
Date: 2009-03-12T19:34:46Z
From: Ravi Varadhan
Subject: stats lm() function
In-Reply-To: <22482054.post@talk.nabble.com>

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: rvaradhan at jhmi.edu


----- Original Message -----
From: ph84 <masterodspam at gmx.de>
Date: Thursday, March 12, 2009 3:28 pm
Subject: [R]  stats lm() function
To: r-help at 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 at r-project.org mailing list
>  
>  PLEASE do read the posting guide 
>  and provide commented, minimal, self-contained, reproducible code.