[R] Stepwise Regression
Martina Erdbrügge
erdbruegge at statistik.uni-dortmund.de
Wed Dec 6 13:16:19 CET 2000
Dear all,
I would like to carry out a stepwise regression using the function step.
If I use either ~ (A + B + C + D)^4 or explicitly all main effects and
interactions for the scope argument, the procedure only considers the
four main effects for addition or elimination in each iteration step.
What did I do wrong?
I'm using R version 1.1.1 on Windows NT.
(I'm sorry if this is a stupid question but I didn't find the answer in
the help file or the FAQs.)
Thanks in advance for any help.
Martina Erdbrügge
Here is my code with results:
> lm44 <- lm(betamat2[, 2] ~ 1, data = fndaten, weights = fndaten$varin)
> step(lm44, ~ (A + B + C + D)^4)
Start: AIC= -20.5
betamat2[, 2] ~ 1
Df Sum of Sq RSS AIC
+ C 1 1.3500 2.5706 -25.2555
+ B 1 1.2323 2.6882 -24.5393
<none> 3.9206 -20.5016
+ A 1 0.0132 3.9074 -18.5554
+ D 1 0.0072 3.9134 -18.5309
Step: AIC= -25.26
betamat2[, 2] ~ C
Df Sum of Sq RSS AIC
+ B 1 1.430 1.141 -36.255
<none> 2.571 -25.255
+ A 1 0.096 2.475 -23.862
+ D 1 0.002 2.569 -23.265
- C 1 1.350 3.921 -20.502
Step: AIC= -36.26
betamat2[, 2] ~ C + B
Df Sum of Sq RSS AIC
<none> 1.141 -36.255
+ A 1 0.079 1.062 -35.398
+ D 1 0.053 1.088 -35.018
- B 1 1.430 2.571 -25.255
- C 1 1.548 2.688 -24.539
Call:
lm(formula = betamat2[, 2] ~ C + B, data = fndaten, weights =
fndaten$varin)
Coefficients:
(Intercept) C B
1.2245 -0.4140 0.4284
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list