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.58490530 0 1.87398021 -0.2613394 -1.02773555
#> 15 S01 I02 2.17698846 0 1.87398021 0.6212151 -0.31820679
#> 29 S01 I03 1.56408077 0 1.87398021 1.1420901 -1.45198952
#> 31 S01 I04 0.77774833 0 1.87398021 0.7948985 -1.89113039
#> 44 S01 I05 3.74906843 0 1.87398021 0.4678206 1.40726766
#> 58 S01 I06 1.72523938 0 1.87398021 0.2460484 -0.39478919
#> 61 S01 I07 3.47684608 0 1.87398021 0.4346070 1.16825885
#> 73 S01 I08 -0.62864517 0 1.87398021 -1.3663042 -1.13632115
#> 87 S01 I09 2.44833520 0 1.87398021 -0.7750488 1.34940384
#> 91 S01 I10 2.73438396 0 1.87398021 1.2193909 -0.35898715
#> 7 S02 I01 1.41445726 0 0.75523250 -0.2613394 0.92056411
#> 17 S02 I02 1.99988611 0 0.75523250 0.6212151 0.62343856
#> 30 S02 I03 1.19914965 0 0.75523250 1.1420901 -0.69817293
#> 36 S02 I04 1.89123560 0 0.75523250 0.7948985 0.34110459
#> 46 S02 I05 2.28847858 0 0.75523250 0.4678206 1.06542552
#> 59 S02 I06 0.44171982 0 0.75523250 0.2460484 -0.55956104
#> 69 S02 I07 -0.20581315 0 0.75523250 0.4346070 -1.39565267
#> 75 S02 I08 1.60657912 0 0.75523250 -1.3663042 2.21765085
#> 88 S02 I09 0.99380190 0 0.75523250 -0.7750488 1.01361824
#> 98 S02 I10 2.48014291 0 0.75523250 1.2193909 0.50551950
#> 4 S03 I01 1.34215982 0 0.10942267 -0.2613394 1.49407650
#> 18 S03 I02 0.80233786 0 0.10942267 0.6212151 0.07170015
#> 23 S03 I03 0.41989567 0 0.10942267 1.1420901 -0.83161708
#> 33 S03 I04 1.46519909 0 0.10942267 0.7948985 0.56087790
#> 47 S03 I05 1.48198913 0 0.10942267 0.4678206 0.90474591
#> 60 S03 I06 1.08208155 0 0.10942267 0.2460484 0.72661052
#> 62 S03 I07 0.84226818 0 0.10942267 0.4346070 0.29823848
#> 76 S03 I08 -0.70792512 0 0.10942267 -1.3663042 0.54895643
#> 89 S03 I09 0.65775794 0 0.10942267 -0.7750488 1.32338412
#> 95 S03 I10 0.33444075 0 0.10942267 1.2193909 -0.99437283
#> 5 S04 I01 -2.35967385 0 -2.11262910 -0.2613394 0.01429460
#> 19 S04 I02 -0.94644267 0 -2.11262910 0.6212151 0.54497138
#> 21 S04 I03 0.37592052 0 -2.11262910 1.1420901 1.34645954
#> 34 S04 I04 -0.70518765 0 -2.11262910 0.7948985 0.61254294
#> 48 S04 I05 0.56883401 0 -2.11262910 0.4678206 2.21364255
#> 51 S04 I06 -3.52953299 0 -2.11262910 0.2460484 -1.66295225
#> 63 S04 I07 -0.72563081 0 -2.11262910 0.4346070 0.95239126
#> 77 S04 I08 -2.04181398 0 -2.11262910 -1.3663042 1.43711935
#> 90 S04 I09 -1.84585696 0 -2.11262910 -0.7750488 1.04182099
#> 92 S04 I10 -0.74735132 0 -2.11262910 1.2193909 0.14588686
#> 2 S05 I01 0.02236202 0 -1.00083303 -0.2613394 1.28453439
#> 16 S05 I02 -1.23025380 0 -1.00083303 0.6212151 -0.85063583
#> 22 S05 I03 1.79272384 0 -1.00083303 1.1420901 1.65146679
#> 35 S05 I04 1.31531510 0 -1.00083303 0.7948985 1.52124961
#> 45 S05 I05 -0.20721379 0 -1.00083303 0.4678206 0.32579867
#> 52 S05 I06 -0.83373267 0 -1.00083303 0.2460484 -0.07894801
#> 64 S05 I07 -1.38402332 0 -1.00083303 0.4346070 -0.81779732
#> 74 S05 I08 -2.65042619 0 -1.00083303 -1.3663042 -0.28328894
#> 81 S05 I09 -1.09056830 0 -1.00083303 -0.7750488 0.68531357
#> 93 S05 I10 2.04304953 0 -1.00083303 1.2193909 1.82449164
#> 8 S06 I01 -0.36156256 0 0.02378202 -0.2613394 -0.12400524
#> 20 S06 I02 -0.45796448 0 0.02378202 0.6212151 -1.10296155
#> 27 S06 I03 0.90768470 0 0.02378202 1.1420901 -0.25818741
#> 37 S06 I04 1.80264956 0 0.02378202 0.7948985 0.98396902
#> 49 S06 I05 0.65536466 0 0.02378202 0.4678206 0.16376208
#> 56 S06 I06 0.66951318 0 0.02378202 0.2460484 0.39968279
#> 66 S06 I07 0.68874581 0 0.02378202 0.4346070 0.23035676
#> 79 S06 I08 -1.32415143 0 0.02378202 -1.3663042 0.01837077
#> 85 S06 I09 -0.09233512 0 0.02378202 -0.7750488 0.65893170
#> 99 S06 I10 0.71638799 0 0.02378202 1.2193909 -0.52678495
#> 9 S07 I01 -0.91143951 0 0.10227880 -0.2613394 -0.75237896
#> 11 S07 I02 2.01606424 0 0.10227880 0.6212151 1.29257038
#> 24 S07 I03 0.56198998 0 0.10227880 1.1420901 -0.68237891
#> 38 S07 I04 1.15304684 0 0.10227880 0.7948985 0.25586952
#> 50 S07 I05 0.36015252 0 0.10227880 0.4678206 -0.20994685
#> 53 S07 I06 -1.50869145 0 0.10227880 0.2460484 -1.85701862
#> 67 S07 I07 0.77278079 0 0.10227880 0.4346070 0.23589496
#> 80 S07 I08 -2.24794107 0 0.10227880 -1.3663042 -0.98391565
#> 82 S07 I09 0.07203433 0 0.10227880 -0.7750488 0.74480437
#> 96 S07 I10 2.25296932 0 0.10227880 1.2193909 0.93129960
#> 6 S08 I01 -0.36060061 0 0.64493505 -0.2613394 -0.74419631
#> 12 S08 I02 0.04991092 0 0.64493505 0.6212151 -1.21623918
#> 25 S08 I03 0.51316895 0 0.64493505 1.1420901 -1.27385618
#> 39 S08 I04 -2.09733216 0 0.64493505 0.7948985 -3.53716572
#> 41 S08 I05 0.84172099 0 0.64493505 0.4678206 -0.27103462
#> 54 S08 I06 0.59771123 0 0.64493505 0.2460484 -0.29327218
#> 68 S08 I07 1.50452032 0 0.64493505 0.4346070 0.42497824
#> 78 S08 I08 -0.07163152 0 0.64493505 -1.3663042 0.64973766
#> 83 S08 I09 -0.48072851 0 0.64493505 -0.7750488 -0.35061471
#> 97 S08 I10 2.50943372 0 0.64493505 1.2193909 0.64510776
#> 3 S09 I01 2.54963104 0 0.19618943 -0.2613394 2.61478096
#> 13 S09 I02 0.54324401 0 0.19618943 0.6212151 -0.27416047
#> 26 S09 I03 3.11500905 0 0.19618943 1.1420901 1.77672954
#> 32 S09 I04 1.08139848 0 0.19618943 0.7948985 0.09031053
#> 42 S09 I05 2.25963983 0 0.19618943 0.4678206 1.59562984
#> 55 S09 I06 0.81611350 0 0.19618943 0.2460484 0.37387571
#> 65 S09 I07 1.37758863 0 0.19618943 0.4346070 0.74679217
#> 71 S09 I08 -1.95767353 0 0.19618943 -1.3663042 -0.78755873
#> 84 S09 I09 -0.79084435 0 0.19618943 -0.7750488 -0.21198493
#> 94 S09 I10 1.50869394 0 0.19618943 1.2193909 0.09311360
#> 10 S10 I01 0.19271443 0 0.74414432 -0.2613394 -0.29009053
#> 14 S10 I02 0.27342369 0 0.74414432 0.6212151 -1.09193568
#> 28 S10 I03 2.33563855 0 0.74414432 1.1420901 0.44940415
#> 40 S10 I04 1.28268711 0 0.74414432 0.7948985 -0.25635572
#> 43 S10 I05 0.69328707 0 0.74414432 0.4678206 -0.51867781
#> 57 S10 I06 0.30520584 0 0.74414432 0.2460484 -0.68498684
#> 70 S10 I07 1.36357828 0 0.74414432 0.4346070 0.18482694
#> 72 S10 I08 -1.72895461 0 0.74414432 -1.3663042 -1.10679470
#> 86 S10 I09 -0.04708386 0 0.74414432 -0.7750488 -0.01617933
#> 100 S10 I10 2.42466743 0 0.74414432 1.2193909 0.46113220