3
$\begingroup$

I have to implement a regression model and I have about 30 variables in the model. Some of the variables do not have much influence on the model, but I need to use a formalized method for eliminating variables. I ended up with the AIC and BIC methods and I have been using the step function in R. The problem is that I need to do a regression model that goes through the origin. In R I use the following statement for regression through the origin,

g <- lm(Pcubes ~ 0 + ., data)

and a regression with intercept

g <- lm(Pcubes ~ ., data)

I then use the step function as

l <- step(g)

and the summary for the new the regression model l, summary(l). Whenever I use the regression through the origin, I get a summary from summary(l) where some variables are not significant to the model and I also get a new regression model that looks as follows,

lm(formula = Pcubes ~ X1 + X4 + X6 + X7 + X8 + X13 + X14 + X17 + 
    X18 + X23 + X24 + X25 + X29 + X30 + X40 + X41 + X44 + X45 + 
    X46 + X48 + X52 + X53 + X54 + X55 + X71 + X82 + X91 + X96 - 1, data = data)

The new model subtracts a 1. And the step function also results in different variables for regression through the origin and regression with intercept. So my questions are, can I use the step function in R for regression through the origin or can I just ignore the -1 in the model or should I use the regression with intercept to choose the best variables and implement the regression through the origin with those variables?

$\endgroup$
2
  • 6
    $\begingroup$ The R function step does stepwise regression, not a step function. (Search on stepwise here or for the [stepwise-regression] tag for lots of discussion of the problems with this.) $\endgroup$
    – Glen_b
    May 7, 2014 at 8:48
  • 3
    $\begingroup$ Are you aware that a "-1" is the same as "+0" in R formulas? $\endgroup$
    – Michael M
    May 7, 2014 at 11:52

1 Answer 1

2
$\begingroup$

For the lm model with intercept lm(y~.), the simplest model to consider by step function is lm(y~1). So it will try to drop the intercept at all.

For the lm model without intercept lm(y~-1+.), step function will compare the model family all without intercept but different predictor x.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.