# Linear regression - are my models nested or non-nested?

I’ve got two main groups, which I am comparing, a) rats and b) rabbits. Each group consists of two subgroups – breed 1 and breed 2.

Using linear regression, I would need to find out, does a model taking into account the subgroups account for more variance than a model with only the main groups.

So I have created two models: \begin{align} Y &= a_1+b1_1(\text{rab})+e_1 \tag{1} \\ Y &= a_2+b1_2(\text{rat2})+b2_2(\text{rab1})+b3_2(\text{rab2})+e_2\ \tag{2} \end{align} Where all variables are dummy variables:

• $\text{rab}\ \ = 1$ for a rabbit and zero otherwise (e.g., rats)
• $\text{rab1} = 1$ for rabbit breed 1
• $\text{rab2} = 1$ for rabbit breed 2
• $\text{rat2}\, = 1$ for rat breed 2

In order to compare the models statistically, I would need to know, whether my models can be considered nested or not.

If the models are considered nested, I would also need advice in how to compare them statistically - preferably with SPSS. With non-nested models I can handle the rest.

• It is safe to make the presumption that breeds between species have nothing to do with each other? That is there is no relationship between rat breed 1 and rabbit breed 1? – Andy W Mar 20 '14 at 12:47
• How many breeds of rabbit are there? – Penguin_Knight Mar 20 '14 at 12:50
• I assume it's safe to consider there's no relationship. However, I can't come up with any examples, what could be such a relationship. – Ina Mar 20 '14 at 12:52
• Two breeds of rabbit, two breeds of rat. – Ina Mar 20 '14 at 12:53
• @gung, if you look at the models closely there are 3 variables for 4 groups (2 species by 2 breeds), the 2 rabbit variables are a different coding of an interaction term. The design matrix will not be singular (as long as all 4 cells have observations). – Greg Snow Mar 20 '14 at 18:51

While your data and model don't fit the formal definition of nested, they are in essence nested because you can redefine the variables in such a way that they do fit the definition. For example change to 2 variables:

rab is 0 for rats and 1 for rabbits

breed is 0 for breed 1 (either species) and 1 for breed 2 (either species)

then fit the model:

$y = a + b1(rab) + b2(breed) + b3(rab \times breed) + e$

Now you can see that your first model is clearly nested in this model and this model will give the exact same predictions and therefore the exact same sums of squares, likelihood, etc. so any test using these values will give the same results for your model and my model, so your 2 models can be treated as nested.

• Nice! And moreover, you can do an F test to check if b2 and b3 are equal to zero. I'm going to delete my solution. – veryshuai Mar 20 '14 at 19:11
• Great, this makes sense. Thank you both for your effort and help. – Ina Mar 20 '14 at 22:15
• When slightly modifying the setting and comparing rats (only one group) to rabbits (still two different breeds), is the following model correct? y=a+b1(rab)+b2(rab×breed)+e – Ina Apr 1 '14 at 11:08

They are in fact nested models. Model 1 can be considered a special case of Model 2 by imposing the following parameter restrictions:

$$b1_2=0$$ $$b2_2=b3_2$$

In effect, this will absorb $rat2$ into the intercept (which already represents $rat1$), and $rab1+rab2$ will be combined into a single vector equivalent to the original $rab$.