How to test a reduced linear model passing through the origin? For simple ordinary linear regression $y=a+bx$, if I want to use the reduced model $y=bx$, i.e. passing through the origin, how to do statistical tests on the validity of such a linear model?
 A: The following hopefully gives a few ideas about how you might perform a comparison of a linear model with and without a constant using R.
1. Create simulated data
First, let's create some simulated data.
> set.seed(4444)
> x <- 1:100
> y1 <- x + rnorm(100)
> y2 <- 2 + x + rnorm(100)



*

*I've set the seed for the random number generator to make the results replicable.

*x is a vector with values 1 to 100.

*y1 is generated from a model where $y = bx$ (i.e., no need for a constant). Specifically, $y = 1x + \epsilon$ where $\epsilon \sim N(0, 1)$.

*y2 is generated from a model where $y = a + bx$  (i.e., constant is required). Specifically, $y = 2 + 1x + \epsilon$ where $\epsilon \sim N(0, 1)$.


2. Compare fits for data generated without constant
In theory, y1 should not need a constant to fit the data well, and y2 should require a constant to fit the data well.
So, let's fit models without (m1) and with (m2) a constant and compare the fit using anova.
> y1_m1 <- lm(y1 ~ x-1)
> y1_m2 <- lm(y1 ~ x)
> anova(y1_m1, y1_m2)
Analysis of Variance Table

Model 1: y1 ~ x - 1
Model 2: y1 ~ x
  Res.Df    RSS Df Sum of Sq      F Pr(>F)
1     99 108.69                           
2     98 108.68  1 0.0090647 0.0082 0.9281



*

*lm(y1 ~ x-1) fits the model without the constant. By default lm assumes that a constant is present. Thus, you use -1 to indicate the absence of the constant.

*Thus, the first two lines save the fits without and with the constant present.

*anova... compares the fit of the two models. We can see that the difference in residual sums of squares (RSS) is small between the models. The non-significance of the F test could be used to justify the preference of the simpler model without the constant.


3. Compare fits for data generated with constant
Now, let's repeat the above process for the data that was simulated from a model that included a constant.
> y2_m1 <- lm(y2 ~ x-1)
> y2_m2 <- lm(y2 ~ x)
> anova(y2_m1, y2_m2)
Analysis of Variance Table

Model 1: y2 ~ x - 1
Model 2: y2 ~ x
  Res.Df     RSS Df Sum of Sq      F    Pr(>F)    
1     99 226.857                                  
2     98  95.419  1    131.44 134.99 < 2.2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 



*

*Here we see that the model that included the constant has significantly better fit.

