# Nested GLM Models

I know that GLM models are nested when one can obtain the smaller model by removing $$\beta$$'s from the larger model. However, when doing some exercises I found on the internet, I stumbled about doing a partial deviance test for the following two models:

Here, let covariate A be a continuous covariate and B be a factor covariate with 2 levels

Model 1: Intercept, A

Model 2: No Intercept, A, B coded as [0, 1] and [1, 0] for the two levels.

In the exercise, it has been claimed that Model 1 is nested within Model 2.

Here, obtaining Model 1 by setting parameters of Model 2 to zero is not really possible. However, Model 1 is kind of included when we take $$\beta_{intercept} = \beta_{factor1} + \beta_{factor2}$$. Does this then imply that the two models are nested? I always thought that the same covariates must be included in the model to have nested models.

Such a definition is necessary to take account of different parametrizations, your example case is the same linear model parametrized in two different ways. In the case of linear models $$Y_1=X\beta_1 + \epsilon_1, Y_2=Z\beta_2 + \epsilon_2$$, this can be paraphrased using the concept (from linear algebra formulation of linear models) of model space, which is the rank space of the design matrix, that is, $$R(X)=\{ x\beta \colon \beta\in\mathbb{R}^p \}$$ that is, the space of all possible expected values the model can produce. Model 1 is then nested in model 2 if $$R(X) \subseteq R(Z)$$. With this definition nesting is independent of parametrization.