Thanks a lot for help in advance. I am switching from matlab to R and I guess I
need some time to get rolling. I was wondering why this code :
> fit.0 <- lm( Response ~ 1, data = ds3)
> step(fit.0,scope=list(upper=~.,lower=~1),data=ds3)
Start: AIC= -32.66
Response ~ 1
Call:
lm(formula = Response ~ 1, data = ds3)
Coefficients:
(Intercept)
1.301
is not working different from the following:
>
> cnames <- dimnames(ds3)[[2]]
> cnames <- cnames[-444] # last col is Response
>
> fmla <- as.formula(paste(" ~ ",paste(cnames,collapse="+")))
> step(fit.0,scope=list(upper=fmla,lower=~1),data=ds3)
Start: AIC= -32.66
Response ~ 1
> fmla <- as.formula(paste(" ~ ",paste(cnames,collapse="+")))
> fit.s <- step(fit.0,scope=list(upper=fmla,lower=~1),data=ds3)
Step: AIC= -Inf
Response ~ ENTP9324 + CH1W0281
Df Sum of Sq RSS AIC
<none> 0 -Inf
- CH1W0281 3 0.00381 0.00381 -115
- ENTP9324 9 1 1 -34
The dataframe ds3 is 17 by 444 and I understand it is not smart thing to run
stepwise regression. What I wondered is if I pass the 'upper=~.' , it seems
step() thinks the full model is current one. Not adding anymore. If this is the
right answer, is there a better way than creating fmla argument in the above?
Thanks!
-Young.
---------------------------------
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html