Using S-Plus 6.2 for Windows XP
I'm trying to fit a simple linear regression model:
The issue is the following:
I have a dataframe with several "response variables" (each
with 200 observations) who should be checked against a number of possible predictors
variables (approx. 50 dummy variables).
Of the 50 dummy variables I know that only 5 – 10 will have
significant effect on a response variable, but I don’t know which ones. For
another predictor I have the same predictor variables, but again I don’t
know in advance witch ones will be significant. It’s my purpose to have
at the end an idea (by means of a matrix) witch variables have a significant impact
on which response variable). The model should not have predictive power and in
the end I’m only interest in a well calculated intercept.
In order to figure this out I thought the best way to do it is by using
a simple stepwise Regression.
Before integrating a loop over the several “response variables”,
I’ve tried to fit it on a single response, so:
menuStep(formula = DATA~VAR5+VAR2+VAR3+…VAR55),formula.lower =
NULL, data = "" na.omit.p = T, direction = "forward", trace.p =
T, print.short.p = F, print.long.p = T, print.anova.p = F, print.correlation.p
= F)
but I got an error if I tried to subscript the model:
menuStep(formula = DATA~as.matrix(FINAL[,5:55]),formula.lower = NULL,
data = "" na.omit.p = T, direction = "forward", trace.p = T,
print.short.p = F, print.long.p = T, print.anova.p = F, print.correlation.p =
F)
Any ideas why this doesn’t work and is the menustep function the best
way to handle my problem.
Comments are well appreciated.
Bert