Makes a basic cross-classified design with random intercepts for subjects and items. See vignette("sim_mixed", package = "faux")
for examples and details.
Usage
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
DEPRECATED use set.seed() instead before running this function
Examples
sim_mixed_cc(10, 10)
#> sub_id item_id y grand_i sub_i item_i err
#> 1 S01 I01 -0.46476125 0 -0.6422443 -0.371345905 0.54882892
#> 15 S01 I02 -1.86299317 0 -0.6422443 0.004544046 -1.22529295
#> 29 S01 I03 0.25862438 0 -0.6422443 -0.031182015 0.93205066
#> 31 S01 I04 -3.07839266 0 -0.6422443 -2.263975927 -0.17217247
#> 44 S01 I05 0.51480664 0 -0.6422443 1.291323709 -0.13427281
#> 58 S01 I06 0.89299887 0 -0.6422443 0.697006282 0.83823685
#> 61 S01 I07 -1.02385268 0 -0.6422443 1.181308767 -1.56291718
#> 73 S01 I08 0.62936670 0 -0.6422443 -0.360101631 1.63171259
#> 87 S01 I09 -1.88337561 0 -0.6422443 -1.513915289 0.27278394
#> 91 S01 I10 -2.10764046 0 -0.6422443 -1.143754038 -0.32164216
#> 7 S02 I01 -2.98820823 0 -1.2016318 -0.371345905 -1.41523048
#> 17 S02 I02 -1.67192303 0 -1.2016318 0.004544046 -0.47483523
#> 30 S02 I03 -0.09195816 0 -1.2016318 -0.031182015 1.14085570
#> 36 S02 I04 -4.32085172 0 -1.2016318 -2.263975927 -0.85524395
#> 46 S02 I05 0.43708637 0 -1.2016318 1.291323709 0.34739451
#> 59 S02 I06 -0.30525554 0 -1.2016318 0.697006282 0.19937002
#> 69 S02 I07 0.28749986 0 -1.2016318 1.181308767 0.30782294
#> 75 S02 I08 -0.62543300 0 -1.2016318 -0.360101631 0.93630047
#> 88 S02 I09 -2.22310438 0 -1.2016318 -1.513915289 0.49244276
#> 98 S02 I10 -0.95142380 0 -1.2016318 -1.143754038 1.39396208
#> 4 S03 I01 3.00446237 0 1.1916702 -0.371345905 2.18413804
#> 18 S03 I02 1.34592340 0 1.1916702 0.004544046 0.14970912
#> 23 S03 I03 0.76292857 0 1.1916702 -0.031182015 -0.39755965
#> 33 S03 I04 0.79399652 0 1.1916702 -2.263975927 1.86630222
#> 47 S03 I05 2.89247037 0 1.1916702 1.291323709 0.40947643
#> 60 S03 I06 3.41166661 0 1.1916702 0.697006282 1.52299010
#> 62 S03 I07 4.18042085 0 1.1916702 1.181308767 1.80744185
#> 76 S03 I08 -1.11720138 0 1.1916702 -0.360101631 -1.94876998
#> 89 S03 I09 -2.04716421 0 1.1916702 -1.513915289 -1.72491915
#> 95 S03 I10 -1.48377722 0 1.1916702 -1.143754038 -1.53169341
#> 5 S04 I01 -2.19038732 0 -0.7658457 -0.371345905 -1.05319575
#> 19 S04 I02 -0.72408730 0 -0.7658457 0.004544046 0.03721432
#> 21 S04 I03 -1.20712613 0 -0.7658457 -0.031182015 -0.41009845
#> 34 S04 I04 -2.21268064 0 -0.7658457 -2.263975927 0.81714095
#> 48 S04 I05 -1.16344598 0 -0.7658457 1.291323709 -1.68892403
#> 51 S04 I06 -0.10509892 0 -0.7658457 0.697006282 -0.03625954
#> 63 S04 I07 0.46608483 0 -0.7658457 1.181308767 0.05062172
#> 77 S04 I08 -0.38256657 0 -0.7658457 -0.360101631 0.74338073
#> 90 S04 I09 -0.96895347 0 -0.7658457 -1.513915289 1.31080748
#> 92 S04 I10 -1.43037133 0 -0.7658457 -1.143754038 0.47922837
#> 2 S05 I01 -1.25516685 0 0.4386248 -0.371345905 -1.32244577
#> 16 S05 I02 1.04339094 0 0.4386248 0.004544046 0.60022207
#> 22 S05 I03 -0.05453529 0 0.4386248 -0.031182015 -0.46197810
#> 35 S05 I04 -1.68759422 0 0.4386248 -2.263975927 0.13775689
#> 45 S05 I05 1.68063809 0 0.4386248 1.291323709 -0.04931044
#> 52 S05 I06 -0.83726922 0 0.4386248 0.697006282 -1.97290032
#> 64 S05 I07 3.22663816 0 0.4386248 1.181308767 1.60670457
#> 74 S05 I08 -0.59854785 0 0.4386248 -0.360101631 -0.67707104
#> 81 S05 I09 0.28035201 0 0.4386248 -1.513915289 1.35564247
#> 93 S05 I10 -1.81571202 0 0.4386248 -1.143754038 -1.11058280
#> 8 S06 I01 -1.40528569 0 -0.4205498 -0.371345905 -0.61339002
#> 20 S06 I02 -0.97930973 0 -0.4205498 0.004544046 -0.56330402
#> 27 S06 I03 -2.20909543 0 -0.4205498 -0.031182015 -1.75736366
#> 37 S06 I04 -2.26968236 0 -0.4205498 -2.263975927 0.41484332
#> 49 S06 I05 -1.45658091 0 -0.4205498 1.291323709 -2.32735486
#> 56 S06 I06 -0.12543952 0 -0.4205498 0.697006282 -0.40189605
#> 66 S06 I07 0.03913269 0 -0.4205498 1.181308767 -0.72162632
#> 79 S06 I08 -1.34939826 0 -0.4205498 -0.360101631 -0.56874687
#> 85 S06 I09 -2.06233492 0 -0.4205498 -1.513915289 -0.12786987
#> 99 S06 I10 -0.13959161 0 -0.4205498 -1.143754038 1.42471219
#> 9 S07 I01 1.58857059 0 0.4219298 -0.371345905 1.53798672
#> 11 S07 I02 0.40728953 0 0.4219298 0.004544046 -0.01918429
#> 24 S07 I03 -2.15858188 0 0.4219298 -0.031182015 -2.54932964
#> 38 S07 I04 -3.11921881 0 0.4219298 -2.263975927 -1.27717266
#> 50 S07 I05 2.50193707 0 0.4219298 1.291323709 0.78868359
#> 53 S07 I06 2.89545328 0 0.4219298 0.697006282 1.77651722
#> 67 S07 I07 3.10774243 0 0.4219298 1.181308767 1.50450388
#> 80 S07 I08 -1.05939590 0 0.4219298 -0.360101631 -1.12122404
#> 82 S07 I09 -0.59374069 0 0.4219298 -1.513915289 0.49824482
#> 96 S07 I10 -0.59536619 0 0.4219298 -1.143754038 0.12645807
#> 6 S08 I01 0.56840890 0 -0.4775940 -0.371345905 1.41734886
#> 12 S08 I02 -0.82069912 0 -0.4775940 0.004544046 -0.34764911
#> 25 S08 I03 -1.22713441 0 -0.4775940 -0.031182015 -0.71835835
#> 39 S08 I04 -2.35274176 0 -0.4775940 -2.263975927 0.38882822
#> 41 S08 I05 -1.08406836 0 -0.4775940 1.291323709 -1.89779802
#> 54 S08 I06 1.62117912 0 -0.4775940 0.697006282 1.40176689
#> 68 S08 I07 1.65411120 0 -0.4775940 1.181308767 0.95039648
#> 78 S08 I08 -2.13403939 0 -0.4775940 -0.360101631 -1.29634371
#> 83 S08 I09 -3.39748984 0 -0.4775940 -1.513915289 -1.40598050
#> 97 S08 I10 -0.83400325 0 -0.4775940 -1.143754038 0.78734483
#> 3 S09 I01 1.27049478 0 -0.8194951 -0.371345905 2.46133582
#> 13 S09 I02 -0.32439622 0 -0.8194951 0.004544046 0.49055487
#> 26 S09 I03 -2.64709686 0 -0.8194951 -0.031182015 -1.79641971
#> 32 S09 I04 -2.96398075 0 -0.8194951 -2.263975927 0.11949031
#> 42 S09 I05 0.44243067 0 -0.8194951 1.291323709 -0.02939790
#> 55 S09 I06 -0.17807695 0 -0.8194951 0.697006282 -0.05558810
#> 65 S09 I07 0.98484863 0 -0.8194951 1.181308767 0.62303500
#> 71 S09 I08 -3.07810682 0 -0.8194951 -0.360101631 -1.89851006
#> 84 S09 I09 -0.27609533 0 -0.8194951 -1.513915289 2.05731510
#> 94 S09 I10 -0.69605297 0 -0.8194951 -1.143754038 1.26719620
#> 10 S10 I01 -0.68377791 0 -0.2600069 -0.371345905 -0.05242509
#> 14 S10 I02 -0.21655097 0 -0.2600069 0.004544046 0.03891190
#> 28 S10 I03 -1.05573486 0 -0.2600069 -0.031182015 -0.76454593
#> 40 S10 I04 -2.62646414 0 -0.2600069 -2.263975927 -0.10248130
#> 43 S10 I05 0.26850455 0 -0.2600069 1.291323709 -0.76281225
#> 57 S10 I06 -0.16450169 0 -0.2600069 0.697006282 -0.60150105
#> 70 S10 I07 0.83890927 0 -0.2600069 1.181308767 -0.08239258
#> 72 S10 I08 0.30078395 0 -0.2600069 -0.360101631 0.92089250
#> 86 S10 I09 -1.28061966 0 -0.2600069 -1.513915289 0.49330254
#> 100 S10 I10 -0.99540828 0 -0.2600069 -1.143754038 0.40835268