1
$\begingroup$

There are a number of posts on Cross Validated explaining the difference between nested and crossed random-effects. In this example, it is noted that all feasible random effects categories are linked to all other random effects categories, i.e. "all participants perform all tasks."

In this example, the same is noted: "which means that every class belongs to every school."

However, what happens when there is no specific nested structure, but there are some instances where some categories are not linked with others. Example:

Let's say I'm conducting field work and I visit around 5 sites per year of a possible 10 sites, call them Sites 1-10. The number of sites does not vary, but the exact sites selected for sampling do. This study is ongoing and there are 5 years of data. The code below generates some artificial data of that design using r:

sites = c(1:10)
years = c(1:5)
set.seed(1)
for(i in unique(years)){
if(i==1){
  df = data.frame(year = rep(i,5),
                  site = sample(x = sites,
                                size = 5,
                                replace = F),
                  visit = c(1:5))}
  if(i>1){
    df2 = data.frame(year = rep(i,5),
                     site = sample(x = sites,
                                   size = 5,
                                   replace = F),
                     visit = c(1:5))
    df = rbind(df2,df)}}

The data:

df
#>    year site visit
#> 1     5    5     1
#> 2     5    9     2
#> 3     5    1     3
#> 4     5    6     4
#> 5     5   10     5
#> 6     4   10     1
#> 7     4    7     2
#> 8     4    1     3
#> 9     4    9     4
#> 10    4    5     5
#> 11    3    5     1
#> 12    3   10     2
#> 13    3    2     3
#> 14    3    6     4
#> 15    3    7     5
#> 16    2    7     1
#> 17    2    2     2
#> 18    2    3     3
#> 19    2    8     4
#> 20    2    1     5
#> 21    1    9     1
#> 22    1    4     2
#> 23    1    7     3
#> 24    1    1     4
#> 25    1    2     5

Where the combinations of sites and year are as follows:

Site visit frequency:

library(dplyr)
df %>%
  group_by(site) %>%
  summarize(tot = n())
#> # A tibble: 10 × 2
#>     site   tot
#>    <int> <int>
#>  1     1     4
#>  2     2     3
#>  3     3     1
#>  4     4     1
#>  5     5     3
#>  6     6     2
#>  7     7     4
#>  8     8     1
#>  9     9     3
#> 10    10     3

Yearly sampling frequency:

df %>%
  group_by(year) %>%
  summarize(tot=n())
#> # A tibble: 5 × 2
#>    year   tot
#>   <int> <int>
#> 1     1     5
#> 2     2     5
#> 3     3     5
#> 4     4     5
#> 5     5     5

Frequency of combinations:

df %>%
  group_by(site,year) %>%
  summarize(tot=n())
#> `summarise()` has grouped output by 'site'. You can override using the
#> `.groups` argument.
#> # A tibble: 25 × 3
#> # Groups:   site [10]
#>     site  year   tot
#>    <int> <int> <int>
#>  1     1     1     1
#>  2     1     2     1
#>  3     1     4     1
#>  4     1     5     1
#>  5     2     1     1
#>  6     2     2     1
#>  7     2     3     1
#>  8     3     2     1
#>  9     4     1     1
#> 10     5     3     1
#> # … with 15 more rows

We see that all years occur and all sites occur, but not all combinations of year and sites occur.

Does such a design count as a crossed design, even though some combinations of sites and years do not occur? If not, what is the name of such a design?

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.