Hi all,

I get the expected behaviour of getting a useful model if I do the following

fit<-lm(
expressions[,i]~expressions[,pa_all[1]]+expressions[,pa_all[2]]+expressions[,pa_all[3]]+expressions[,pa_all[4]]+expressions[,pa_all[5]])
step<-stepAIC(fit, direction="both")

Output:
Step: AIC=-78.75

expressions[, i] ~ expressions[, pa_all[5]]

                           Df Sum of Sq    RSS     AIC
<none>                                  43.714 -78.750
+ expressions[, pa_all[4]]  1   0.83982 42.874 -78.690
+ expressions[, pa_all[2]]  1   0.80449 42.909 -78.608
- expressions[, pa_all[5]]  1   1.13431 44.848 -78.188
+ expressions[, pa_all[1]]  1   0.08445 43.630 -76.944
+ expressions[, pa_all[3]]  1   0.07620 43.638 -76.925




but if I do this instead, stepAIC isn't deleting any of the unwanted
columns. It seems to think it can only delete the entire set or none at all.

fit<-lm(expressions[,i]~expressions[,pa_all[1:5]])step<-stepAIC(fit,
direction="both")


Output:

Start:  AIC=-74.42
expressions[, i] ~ expressions[, pa_all[1:5]]

                             Df Sum of Sq    RSS     AIC
- expressions[, pa_all[1:5]]  5    2.7111 44.848 -78.188
<none>                                    42.137 -74.424

Step:  AIC=-78.19
expressions[, i] ~ 1

                             Df Sum of Sq    RSS     AIC
<none>                                    44.848 -78.188
+ expressions[, pa_all[1:5]]  5    2.7111 42.137 -74.424


Thanks,

Sachin

        [[alternative HTML version deleted]]

______________________________________________
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