Makes a basic cross-classified design with random intercepts for subjects and items

sim_mixed_cc(sub_n = 100, item_n = 20, grand_i = 0, sub_sd = 1,
  item_sd = 1, error_sd = 1, empirical = FALSE, seed = NULL)

Arguments

sub_n

the number of subjects

item_n

the number of items

grand_i

the grand intercept (overall mean)

sub_sd

the SD of subject random intercepts (or a sub_n-length named vector of random intercepts for each subject)

item_sd

the SD of item random intercepts (or an item_n-length named vector of random intercepts for each item)

error_sd

the SD of the error term

empirical

Should the returned data have these exact parameters? (versus be sampled from a population with these parameters)

seed

a single value, interpreted as an integer, or NULL (see set.seed)

Value

a tbl

Examples

sim_mixed_cc(10, 10)
#> # A tibble: 100 x 7 #> sub_id item_id y grand_i sub_i item_i err #> <fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 S01 I01 1.97 0 0.0422 1.60 0.327 #> 2 S01 I02 0.854 0 0.0422 0.391 0.421 #> 3 S01 I03 -0.622 0 0.0422 -0.349 -0.316 #> 4 S01 I04 2.65 0 0.0422 1.06 1.55 #> 5 S01 I05 -1.70 0 0.0422 0.225 -1.97 #> 6 S01 I06 -0.0325 0 0.0422 -1.21 1.14 #> 7 S01 I07 -0.781 0 0.0422 -0.681 -0.142 #> 8 S01 I08 0.245 0 0.0422 -0.814 1.02 #> 9 S01 I09 0.835 0 0.0422 1.13 -0.334 #> 10 S01 I10 -0.383 0 0.0422 -1.39 0.962 #> # … with 90 more rows