Description Usage Arguments Examples

Helper function handling specification of which variables to join a
cross-classified data on, and what kind of correlation structure needed.
Correlation structures can only be provided if the underlying call is
a `link_levels()`

call.

1 |

`...` |
A series of two or more variable names, unquoted, to join on in order to create cross-classified data. |

`rho` |
A fixed (Spearman's rank) correlation coefficient between the
variables being joined on: note that if it is not possible to make a
correlation matrix from this coefficient (e.g. if you are joining on three
or more variables and rho is negative) then the |

`sigma` |
A matrix with dimensions equal to the number of variables you
are joining on, specifying the correlation for the resulting joined data.
Only one of rho and sigma should be provided. Do not provide |

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ```
panels <- fabricate(
countries = add_level(N = 150, country_fe = runif(N, 1, 10)),
years = add_level(N = 25, year_shock = runif(N, 1, 10), nest = FALSE),
obs = cross_levels(
by = join(countries, years),
new_variable = country_fe + year_shock + rnorm(N, 0, 2)
)
)
schools_data <- fabricate(
primary_schools = add_level(N = 20, ps_quality = runif(N, 1, 10)),
secondary_schools = add_level(
N = 15,
ss_quality = runif(N, 1, 10),
nest = FALSE),
students = link_levels(
N = 1500,
by = join(primary_schools, secondary_schools),
SAT_score = 800 + 13 * ps_quality + 26 * ss_quality + rnorm(N, 0, 50)
)
)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.