Hi,

I would like to fit a linear model where some but not all explanators are 
chosen stepwise - ie I definitely want to include some terms, but others only 
if they are deemed significant (by AIC or whatever other approach is 
available).  For example if I wanted to definitely include x1 and x2, but only 
include z1 and z2 if they are significant, something like this:

df <- data.frame(y=c(4,2,6,7,3,9,5,7,6,2), x1=c(2,3,4,0,5,8,8,1,1,2), 
x2=c(0,0,0,0,1,1,0,0,0,1), z1=c(0,1,0,0,0,1,1,0,1,1), z2=c(1,1,1,0,0,1,1,1,1,0))
model <- lm(y  ~ x1 + x2 + stepwise(z1 + z2))

Any help would be appreciated.

Cheers,
Andre
**********************************************************************
This email and any attachments are confidential, protect...{{dropped:22}}

______________________________________________
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