I am trying to learn R after learning SPSS and using SPSS for my statistics on a couple papers. I have been using my data to help me learn and understand R as well. In my data, i had to find some Linear Regressions in SPSS using a stepwise comparison to eliminate variables that do not "fit" the model. I tried using stepAIC with the MASS package, because i thought it was the equivalent, and got some completely different output, as well as stuff i did not understand and had to look up. My question is, what are the differences between stepwise in SPSS and stepAIC? (is stepwise more conservative than stepAIC?) Is there a way to write stepAIC code that would be equivalent to stepwise? Or is there a different package that could help me out?
Here is my code:
mydata <- read.csv("Eric.csv")
AveSBP <- mydata[, 3]
MaxVi <- mydata[, 7]
PeakForce <- mydata[, 8]
MaxPO <- mydata[, 9]
Height <- mydata[, 10]
BMI <- mydata[, 11]
NeckCirc <- mydata[, 12]
ArmLength <- mydata[, 13]
ArmSpan <- mydata[, 14]
WaistCircum <- mydata[, 15]
LegLength <- mydata[, 16]
FatAth <- mydata[, 17]
Diff <- mydata[, 18]
Ratio <- mydata[, 19]
lm1 <- lm(AveSBP ~ MaxVi + PeakForce + MaxPO + Height + BMI + NeckCirc + ArmLength + ArmSpan + WaistCircum + LegLength + FatAth + Diff + Ratio)
summary(lm1)
stepAIC(lm1, directions="both")
I am running them on Windows 7 Pro x64, R x64 3.1.0, and SPSS x64 v21.