How to do it...

In the following exercise, we will set up a simple nested model, and we will show that the estimates are different if we contemplate the nesting/don’t contemplate it, because of how the variables are coded:

  1. First, we load a dataset that contains the companies' areas and people working there. We have a numerical variable called Rating.
  1. If we look at the cross tabulation, we can see that each level of the Person factor appears 5 times in each area:
xtabs(~ Group + Person, data) 
  1. Let's look at the results if we treat the results as nested versus crossed. Clearly, the results are different, as the names are the same across ...

Get R Statistics Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.