1

I have built two linear model in R using 'lm' function with some tricks as follows:

Model-1: With default option

l1 <- lm(dist ~ speed, data = cars)

Model-2: Supplying the constant intercept (=1) variable manually and 'without Intercept' option

Intercept = rep(1,50)
l2 <- lm(dist ~ 0 + Intercept + speed, data = cars)

summary(l1) # Multiple R-squared: 0.6511, Adjusted R-squared: 0.6438 summary(l2) # Multiple R-squared: 0.9091, Adjusted R-squared: 0.9053

I have noticed, though both the model equation are identical but the R-squared and Adjusted R-squared has been increased significantly in the 2nd model. My questions are:

  1. Why it is happening?
  2. What are the alternative of R-squared, Adjusted R-squared which can catch this loophole?
  3. Will this method give higher R-squared, Adjusted R-squared for any data?
Raja
  • 11
  • If you replace lm by model.matrix and inspect the results, you will get a useful clue. If that's not enough, compare your results to l3 <- lm(dist ~ Intercept + speed, data = cars). These will show the issue concerns the special way in which summary treats an intercept. – whuber Jul 21 '20 at 17:01
  • 1
    @whuber Thanks for your comment. I think, it is due to R sq. calculation. As per the link the calculation is not same for 'With intercept' and 'Without Intercept' – Raja Jul 21 '20 at 17:18

0 Answers0