Skip to contents

This function simulates a meta-analytic dataset based on the random-effects model. The simulated effect size is Hedges' G, an estimator of the Standardized Mean Difference (Hedges, 1981; Li, Dusseldorp, & Meulman, 2017). The functional form of the model can be specified, and moderators can be either normally distributed or Bernoulli-distributed. See Van Lissa, in preparation, for a detailed explanation of the simulation procedure.

Usage

simulate_smd(
  k_train = 20,
  k_test = 100,
  mean_n = 40,
  es = 0.5,
  tau2 = 0.04,
  alpha = 0,
  moderators = 5,
  distribution = "normal",
  model = "es * x[, 1]"
)

Arguments

k_train

Atomic integer. The number of studies in the training dataset. Defaults to 20.

k_test

Atomic integer. The number of studies in the testing dataset. Defaults to 100.

mean_n

Atomic integer. The mean sample size of each simulated study in the meta-analytic dataset. Defaults to 40. For each simulated study, the sample size n is randomly drawn from a normal distribution with mean mean_n, and sd mean_n/3.

es

Atomic numeric vector. The effect size, also known as beta, used in the model statement. Defaults to .5.

tau2

Atomic numeric vector. The residual heterogeneity. For a range of realistic values encountered in psychological research, see Van Erp, Verhagen, Grasman, & Wagenmakers, 2017. Defaults to 0.04.

alpha

Vector of slant parameters, passed to sn::rsn.

moderators

Atomic integer. The number of moderators to simulate for each study. Make sure that the number of moderators to be simulated is at least as large as the number of moderators referred to in the model parameter. Internally, the matrix of moderators is referred to as "x". Defaults to 5.

distribution

Atomic character. The distribution of the moderators. Can be set to either "normal" or "bernoulli". Defaults to "normal".

model

Expression. An expression to specify the model from which to simulate the mean true effect size, mu. This formula may use the terms "es" (referring to the es parameter of the call to simulate_smd), and "x\[, \]" (referring to the matrix of moderators, x). Thus, to specify that the mean effect size, mu, is a function of the effect size and the first moderator, one would pass the value model = "es * x\[ , 1\]". Defaults to "es * x\[ , 1\]".

Value

List of length 4. The "training" element of this list is a data.frame with k_train rows. The columns are the variance of the effect size, vi; the effect size, yi, and the moderators, X. The "testing" element of this list is a data.frame with k_test rows. The columns are the effect size, yi, and the moderators, X. The "housekeeping" element of this list is a data.frame with k_train + k_test rows. The columns are n, the sample size n for each simulated study; mu_i, the mean true effect size for each simulated study; and theta_i, the true effect size for each simulated study.

Examples

set.seed(8)
simulate_smd()
#> $training
#>            vi          yi         X1          X2           X3         X4
#> 1  0.10123023 -0.16012845 -1.1444094 -1.04043881  0.062535228  1.0148301
#> 2  0.08088794 -0.80729991 -1.7215353  0.02465913  0.231113964 -0.8321755
#> 3  0.11803209  0.63219536 -0.3696855  0.86220033  1.517608501 -1.4727851
#> 4  0.12802095  0.76916686  1.8220755  0.70828681 -0.498742894  0.4537334
#> 5  0.08189427  0.66239160  0.4775898 -0.63656810  0.004252849  0.6631271
#> 6  0.10243131 -0.34194013  0.1405485  0.90875200  0.359516304 -0.7153895
#> 7  0.10480936 -0.54557741 -1.7260245 -0.58273245  2.082965890  2.0207644
#> 8  0.14436434  0.06504549  0.2765317  0.08109775 -1.408034082  1.9224919
#> 9  0.38418205  0.31267138 -1.3627597 -0.04364549  1.217850494 -0.5379136
#> 10 0.12307917  0.52473228  0.8354238  0.27538614  0.721791139 -1.1210611
#> 11 0.15875395  1.39707761  2.2256232  1.03476676 -0.201646518 -0.7519621
#> 12 0.08878501  0.31292809  0.1722670 -0.44401335  0.095368307 -0.4055921
#> 13 0.10208681 -1.28993059 -1.5005928 -1.34238940 -2.032627280 -0.1743360
#> 14 0.17384976 -0.49542668 -1.3466174 -0.16337964 -1.775771585  0.9972979
#> 15 0.10038187 -0.58759913 -2.4010823 -0.24919870  0.066025885  0.5076123
#> 16 0.14694100  1.11492088  0.7935204  0.66247074 -1.224103992 -0.9695288
#> 17 0.06776487  0.58157303  0.4438913  0.64397076  1.578454567  0.2136013
#> 18 0.11094361  0.58270488  0.5038261 -0.85192796 -0.204568006 -0.6238114
#> 19 0.07510350  1.10402148  1.4280847 -0.72472537  0.413325429  0.3302807
#> 20 0.12887103 -1.27683963 -1.8320869 -0.13801556 -0.355544375 -1.3008866
#>             X5
#> 1   0.88819728
#> 2   0.29270972
#> 3   0.31683564
#> 4  -2.02425302
#> 5  -0.91530048
#> 6  -0.34304121
#> 7  -0.61830454
#> 8   1.96917331
#> 9   1.28234666
#> 10  1.21800036
#> 11 -1.27702516
#> 12  2.08310267
#> 13 -0.65815868
#> 14 -0.34382308
#> 15  0.74423183
#> 16 -1.32233177
#> 17  0.39138003
#> 18 -0.09488615
#> 19  1.13265525
#> 20  0.46624137
#> 
#> $testing
#>                yi          X1           X2          X3          X4           X5
#> 21   0.0697442490  1.34278280 -0.345707310  1.57818995 -0.44913981  0.705276551
#> 22   0.6610788203  2.43894434  0.407881830 -1.09289061  0.02348950 -1.346451232
#> 23   0.9563700453  0.67693611 -0.542383594 -0.76616169  0.32860881  1.606175428
#> 24  -0.4565151859 -1.96898063 -2.233980278 -2.44080992 -0.65851847  2.978035548
#> 25   0.2097207276  0.08038142  1.317620135 -0.66787498 -0.69390119  0.889280799
#> 26  -0.0699897413 -0.70476923  0.421883928 -0.87779243 -1.02011480 -0.364122280
#> 27   0.1125065157  0.59725232 -0.742518989 -0.24948742 -1.10058841  0.054619107
#> 28   0.5799963557  0.79577963  0.246548388 -0.91454381 -1.61812166 -0.589375171
#> 29  -0.4113890204 -1.03083607 -0.534765887  0.08087580  2.14679976  0.050225736
#> 30  -0.1466466750 -0.41952683 -1.375543934 -0.08288448 -0.71783589  2.617582843
#> 31   0.2641604408  0.16009113 -0.410783842 -0.40642879  0.89826920  0.627148220
#> 32   0.5488677329 -0.56448033  1.072109345  0.69900714 -1.15007197 -0.827227458
#> 33  -0.1410646978  0.22750654  0.944193458  0.47244670 -1.04069937  0.504060258
#> 34  -0.1047712893  0.25707888 -0.660594907  0.98195504 -0.06291613 -0.394589512
#> 35   0.5656267024 -0.33770080  0.463225218 -1.44548947  1.37773115  0.357938059
#> 36   0.3871240265  0.30457246 -0.833497207  0.01650441  0.62319204 -0.115376387
#> 37   0.2289248513  0.72443709 -1.656108832 -0.19116183 -0.69531851  0.680534148
#> 38  -0.7671912986 -0.68517330 -0.242947018  0.60615056  0.34736006  0.377851898
#> 39   0.8280179901  0.66148590 -0.734829314  1.11059186 -1.66093486  0.386261629
#> 40   1.7946267727  1.72541962  0.288050068 -0.02910979  1.22541007  0.549553058
#> 41   0.1113967154  0.32134570 -2.519865202 -0.29233821  1.04911272  0.613320135
#> 42   0.0488309692  0.57631589  0.559240717  1.47869193  0.07042518 -0.795713800
#> 43  -0.6429384837 -1.40999218 -0.370775118  0.73176907  0.34117199 -1.490813982
#> 44  -0.0108968411 -0.99550207 -0.246350631 -1.19898977 -0.45694682 -0.769902613
#> 45   1.1389625045  1.56029895 -1.068533578  1.51577158  0.36241300  1.625447491
#> 46   0.0464288770  0.20359400  0.188859634 -0.36821179  0.43088979  0.903666849
#> 47  -0.7271016178 -0.38763480 -0.700101046 -0.61153291 -3.28193174 -0.938239707
#> 48   0.3385902120  0.91961483 -0.054871878 -0.99407239  0.07959148 -0.863328748
#> 49  -0.3364394483 -0.37973893  0.004724072  0.22384503  0.28338913 -0.012054345
#> 50   0.0721290798  0.74424525  0.513744294  1.24460620 -1.13800059 -1.018069491
#> 51  -0.5792457661 -1.18318210 -0.232082803 -2.14666505  0.55833481 -1.304871448
#> 52   0.5368899917  0.27641906 -0.503803381  0.52658047  1.45478371 -0.907842475
#> 53   0.0869024855 -0.35621772  0.931147030 -0.13259284  0.91997026  0.045246555
#> 54   0.0793080670  0.98772386  0.866682884 -0.36330720 -2.45861485  1.591761639
#> 55  -0.4977438187 -0.26723365 -1.615076668 -0.89040754  1.35749161  0.146493228
#> 56   0.4946680032  0.48002729 -0.414854751 -0.54416473 -0.73312796 -0.463292606
#> 57   0.8300930074  0.76742274  0.295879429 -0.46053733  0.38481593  0.236661956
#> 58   0.4046279101  0.93944209 -0.501413917 -0.19810448  0.92773032  0.664210399
#> 59  -0.9582677316 -1.05321259  0.168396365 -0.05398731 -1.23938949  0.629995102
#> 60   1.0929122623  1.01361777 -1.484505096  0.06713632  1.73655423 -0.219841525
#> 61  -1.2446328798 -1.25417324 -0.935164736  1.37062115  0.46932808  0.001456405
#> 62  -0.0447009949 -0.38058363 -1.318323265 -1.71261554  0.27094446 -0.450508307
#> 63  -0.9829585596  0.20908883 -0.843522645 -1.54077184 -0.66946378 -0.418097081
#> 64  -0.2109305739 -0.12475618 -0.180237064  1.42855685  0.54643929  0.338293573
#> 65   1.2770131383  2.18637793 -1.473517194 -1.19629850  0.29537750 -0.393182816
#> 66  -0.6904278987  0.08202324  0.296855110  0.88030339 -1.13881229 -0.354461946
#> 67   0.9332104802  2.11210205  0.483606325 -1.68208244  1.29022620 -1.206672296
#> 68   0.4295536525  1.03434270  0.068466459  1.69888450 -2.22984375 -0.412220453
#> 69  -0.5541784759 -0.19817321  0.288832146 -0.15496161  1.28430248  0.386628349
#> 70   0.1773691167 -1.03922958  1.314781376 -1.27400097 -1.41318801 -0.619818844
#> 71  -1.1119527377 -0.13366410 -0.295572687 -0.58194548 -0.69842091  1.081208993
#> 72  -0.2327487049 -0.58203619 -0.064578436 -0.43066068  0.82325010 -1.678908961
#> 73  -0.6881029992 -0.90301123  0.776282190  0.30444699 -1.14748923 -1.440690533
#> 74   0.2872110208 -0.80183175 -1.079610620  0.33526170  0.02986996 -1.422982215
#> 75   0.9580626631  1.32082067  0.592149208 -2.28425822 -0.05187127 -1.138380472
#> 76   0.6505781727  1.03917965  0.326762664 -0.87895358 -0.29070076 -1.560017465
#> 77   0.6396433924  0.55811104 -2.295856107  0.98105921 -0.06218890 -0.468259305
#> 78  -0.4669543062 -1.32868715 -0.402928719  0.74271560 -1.07172843  0.467356785
#> 79  -0.9769101988 -1.92455679  1.125903449  0.10056759 -1.16839102 -0.146917636
#> 80  -0.2932424292  0.02269541  1.063092737  0.16902021 -0.19654398  1.624582143
#> 81  -0.1995739488 -0.58148841 -1.156393348  0.34330655 -1.23256601  0.424045409
#> 82   0.2074836427 -0.22415163 -0.954671006  1.03191632  1.67582582 -0.560888865
#> 83   1.0590227386  1.19843419 -0.642356883  1.61580763  0.14981857 -0.229831775
#> 84  -0.9464700091 -1.35857871 -0.129691509 -2.05943539  1.10504698  0.994997471
#> 85   0.0501360937 -0.02007139  0.295829171  0.71146123 -0.16625956 -0.669661078
#> 86   0.7211893129  0.89013344  0.824899518 -0.19750984 -1.62326723  0.071204845
#> 87  -0.0192254232 -0.02785890 -1.148831250 -1.55998272  0.54408680 -1.183813504
#> 88  -0.2100014832 -0.87933866  1.585573941  0.39203385  0.43202330 -0.976633307
#> 89   0.5415433122  0.76532204 -0.132846093 -0.10443202 -1.73795791  1.869923666
#> 90  -0.3031373341 -0.97758855 -0.118899731 -0.30398595  1.32981739 -0.575898320
#> 91  -0.2433747657  0.53030495  0.119426695 -0.37146423 -0.82576253 -1.019094922
#> 92   0.9812211327  0.93490598  0.193494092  1.28880895 -0.74782165 -0.649659900
#> 93   0.0312254970  0.34618828  1.469472441  0.16832416 -2.13353795  1.533933071
#> 94  -0.4437473468 -0.73358085 -2.160397828  0.79351401  0.36263912 -0.107787116
#> 95  -0.1699726514  0.71044321  2.309691146 -1.43665381 -0.23749230  0.169535331
#> 96  -0.6784711467 -0.32270804  0.984586572 -2.80920276 -0.91259245  1.008258732
#> 97   0.0008929241 -0.36063854  1.510773654  0.24555120 -0.54637269  1.177163008
#> 98   0.3171494928  0.15515330 -0.044507754 -0.42755197  0.17847832  0.837676659
#> 99  -0.3849614859 -1.39090615 -1.153481015  0.32787243 -0.99193808  0.669284255
#> 100  0.7591054389  1.37319401  2.294143138  0.24435018 -0.86142982 -0.243659774
#> 101 -0.5768676823 -0.86514969  0.538671399  0.94024364  0.45566891  1.129335915
#> 102 -1.1473919063 -1.30250885 -0.146357462 -0.13692522 -2.05915568 -0.041590377
#> 103  0.7351544763  0.89342076 -0.979218618 -1.85424344  0.16398290  0.914060323
#> 104 -0.8653556107 -0.88037666 -1.831172832  1.64373845  0.78839628  0.432991085
#> 105  0.0245160987 -0.41661945  1.870035998 -0.14302351 -1.09377744 -0.936613809
#> 106  0.3512162331 -0.04062916 -1.503020392 -0.52419166 -0.53807090 -0.582746486
#> 107  0.1455497552  0.14358965  2.318318542  0.78931815 -0.22432943 -0.090653685
#> 108  0.0719350527  0.09751138 -1.256282212  0.96144097  1.46733421  1.957436095
#> 109  0.2745557083  0.16642969 -0.938503513  1.29350891 -1.60605679  0.843387407
#> 110  1.0883455067  1.47631110 -0.526780039 -1.35604594 -0.54841970  0.115736923
#> 111 -1.5142330943 -1.54600953 -1.733278053 -0.85199073 -1.12518922  0.051878985
#> 112  0.5818380085  1.37092704 -1.078728380 -1.10291173  0.37742996 -0.559855595
#> 113  0.3096846021 -0.30687696 -0.369739572  0.84291478 -0.35847353  0.039211626
#> 114 -0.3923435819 -0.17814964  1.418624142 -0.40487444  0.02549246  0.573795451
#> 115  0.7116822116  0.84086555 -0.960515383  0.34463034 -0.83657908 -1.722671808
#> 116 -0.2505867019 -0.70385466  0.444572597  0.11589273  0.34432991  1.525124902
#> 117 -0.7169171557 -0.38034853  0.920231427  0.02267681  1.26276866 -0.035198961
#> 118 -0.0128238583 -0.61284745  0.248415976  1.81038765  0.32824879 -0.187316677
#> 119  0.7318241641 -0.84761010 -0.258117777  0.18494050 -0.03846550  0.602229762
#> 120  1.0879095578  1.45125747  2.300613151 -0.42790075  0.55285433  0.401261034
#> 
#> $housekeeping
#>      n        mu_i      theta_i
#> 1   38 -0.57220472 -0.705987796
#> 2   52 -0.86076766 -0.698131590
#> 3   34 -0.18484276  0.040520862
#> 4   32  0.91103776  0.737997061
#> 5   50  0.23879490  0.339999953
#> 6   38  0.07027426  0.095919189
#> 7   38 -0.86301223 -0.878455945
#> 8   26  0.13826583  0.473640449
#> 9    8 -0.68137984 -0.498834172
#> 10  32  0.41771190  0.574197305
#> 11  30  1.11281162  1.334479699
#> 12  44  0.08613348  0.187929740
#> 13  46 -0.75029639 -0.764245280
#> 14  22 -0.67330868 -0.720849180
#> 15  40 -1.20054114 -0.965045888
#> 16  30  0.39676020  0.489142940
#> 17  60  0.22194567  0.447451857
#> 18  36  0.25191305  0.072457827
#> 19  60  0.71404233  0.894284264
#> 20  36 -0.91604347 -1.271038423
#> 21  58  0.67139140  0.335185599
#> 22  40  1.21947217  0.989581609
#> 23  34  0.33846806  0.403643679
#> 24  40 -0.98449031 -0.564007419
#> 25  64  0.04019071  0.170906391
#> 26  26 -0.35238462 -0.077853808
#> 27  26  0.29862616  0.117139104
#> 28  66  0.39788982  0.752628158
#> 29  48 -0.51541804 -0.610055705
#> 30  14 -0.20976341 -0.655667187
#> 31  60  0.08004557  0.183319624
#> 32  52 -0.28224017 -0.214589007
#> 33  20  0.11375327 -0.229213055
#> 34  30  0.12853944  0.019967531
#> 35  56 -0.16885040 -0.060407138
#> 36  46  0.15228623  0.177478933
#> 37  52  0.36221854  0.294360825
#> 38  30 -0.34258665 -0.255392535
#> 39  40  0.33074295  0.446835494
#> 40  46  0.86270981  1.136663478
#> 41  44  0.16067285  0.281965264
#> 42  32  0.28815795  0.421205467
#> 43  44 -0.70499609 -0.520115340
#> 44  36 -0.49775103 -0.413206121
#> 45  48  0.78014947  0.729160272
#> 46  14  0.10179700  0.141820091
#> 47  32 -0.19381740 -0.832247539
#> 48  44  0.45980742  0.602377723
#> 49  44 -0.18986946 -0.463477153
#> 50  32  0.37212263  0.238516369
#> 51  54 -0.59159105 -0.651683154
#> 52  36  0.13820953  0.236078495
#> 53  48 -0.17810886 -0.303963048
#> 54  38  0.49386193  0.091643728
#> 55  52 -0.13361682 -0.319818014
#> 56  48  0.24001364  0.545196640
#> 57  30  0.38371137  0.265529533
#> 58  32  0.46972104  0.274561431
#> 59  20 -0.52660630 -0.234668518
#> 60  50  0.50680889  0.596736262
#> 61  48 -0.62708662 -0.687148534
#> 62  42 -0.19029182 -0.001593116
#> 63  16  0.10454441 -0.033059907
#> 64  26 -0.06237809 -0.001719045
#> 65  36  1.09318897  1.388980572
#> 66  26  0.04101162 -0.312696335
#> 67  34  1.05605102  0.759007683
#> 68  62  0.51717135  0.575608950
#> 69  46 -0.09908660 -0.027193541
#> 70  18 -0.51961479 -0.693083484
#> 71  20 -0.06683205 -0.329647608
#> 72  54 -0.29101810 -0.368656232
#> 73  50 -0.45150561 -0.354471888
#> 74  34 -0.40091587 -0.057682519
#> 75  42  0.66041034  0.977170894
#> 76  48  0.51958982  0.658157047
#> 77   8  0.27905552  0.265934113
#> 78  48 -0.66434357 -0.351926634
#> 79  72 -0.96227839 -0.938916485
#> 80  32  0.01134770 -0.051035547
#> 81  44 -0.29074421 -0.697014238
#> 82  30 -0.11207581 -0.029428910
#> 83  26  0.59921709  0.676334065
#> 84  68 -0.67928936 -0.787838095
#> 85  18 -0.01003569 -0.224804131
#> 86  56  0.44506672  0.608669640
#> 87  38 -0.01392945 -0.154583120
#> 88  28 -0.43966933 -0.262234146
#> 89  48  0.38266102  0.219259279
#> 90   8 -0.48879427 -0.612113070
#> 91  50  0.26515247  0.173957761
#> 92  60  0.46745299  0.660231719
#> 93  34  0.17309414  0.544501930
#> 94  32 -0.36679042 -0.179546808
#> 95  22  0.35522160  0.490301625
#> 96  50 -0.16135402 -0.179158919
#> 97  44 -0.18031927 -0.198168992
#> 98  40  0.07757665 -0.104464305
#> 99  32 -0.69545307 -0.536135214
#> 100 40  0.68659701  0.997765972
#> 101 44 -0.43257484 -0.469403356
#> 102 14 -0.65125442 -1.002375278
#> 103 18  0.44671038  0.558136376
#> 104 16 -0.44018833 -0.552172900
#> 105 40 -0.20830972 -0.036721502
#> 106 34 -0.02031458  0.003837812
#> 107 48  0.07179483  0.125910961
#> 108 36  0.04875569  0.074342221
#> 109 42  0.08321484  0.125550152
#> 110 48  0.73815555  0.573441346
#> 111 38 -0.77300477 -0.945305162
#> 112 28  0.68546352  0.998741107
#> 113 48 -0.15343848 -0.152354218
#> 114 26 -0.08907482 -0.524721658
#> 115 60  0.42043278  0.865017910
#> 116 58 -0.35192733 -0.467546114
#> 117 44 -0.19017427 -0.417262393
#> 118 60 -0.30642373 -0.517382143
#> 119 24 -0.42380505 -0.059420545
#> 120 36  0.72562874  1.012973300
#> 
#> $tau2_est
#> [1] 0.5012652
#> 
simulate_smd(k_train = 50, distribution = "bernoulli")
#> $training
#>            vi          yi X1 X2 X3 X4 X5
#> 1  0.08942930  0.39321957  1  0  1  0  0
#> 2  0.12811877 -0.33721651  0  0  0  0  1
#> 3  0.10706848  0.24604020  1  0  1  0  0
#> 4  0.09230692  0.22982552  0  1  0  0  1
#> 5  0.38332496  0.28991385  1  0  0  0  0
#> 6  0.08071917  0.09584201  0  0  1  0  1
#> 7  0.07765022 -0.11982391  1  1  1  0  0
#> 8  0.08410053  0.09583085  1  1  0  1  1
#> 9  0.07567228  0.33061352  1  1  1  1  1
#> 10 0.05974381 -0.27076113  0  1  0  0  1
#> 11 0.08200838  0.67094921  1  1  1  1  0
#> 12 0.09189174 -0.13395876  1  1  1  1  0
#> 13 0.09168652 -0.02657789  0  1  0  1  0
#> 14 0.10949411  0.48495426  1  1  1  0  1
#> 15 0.17029310  0.84633347  1  0  1  1  0
#> 16 0.12764148  0.29168029  0  0  1  0  0
#> 17 0.09285864  0.31490347  1  1  0  0  0
#> 18 0.22939280  0.43531063  0  1  1  0  0
#> 19 0.06495430 -0.03096112  0  0  1  1  1
#> 20 0.10637747  1.28298894  1  1  0  0  1
#> 21 0.09028827 -0.47980299  0  0  1  1  0
#> 22 0.10448141 -0.82050940  0  0  1  0  0
#> 23 0.20296312  0.22458034  1  0  1  1  1
#> 24 0.11217933  0.04102836  1  1  0  0  0
#> 25 0.07033191  0.31444003  1  1  0  0  0
#> 26 0.11898230 -0.11464852  0  0  0  1  1
#> 27 0.09034614  1.40981795  1  1  0  0  0
#> 28 0.07466851 -0.07008951  1  1  0  0  1
#> 29 0.08476435  0.85192169  1  1  1  1  0
#> 30 0.06957263  0.11761361  0  0  1  0  0
#> 31 0.09200744  0.16632550  1  1  1  0  0
#> 32 0.23375408  1.07652726  1  1  0  1  0
#> 33 0.08920365  0.36710309  1  1  1  0  1
#> 34 0.20875650  0.50891856  1  1  0  0  1
#> 35 0.09845814  0.43746378  1  0  1  1  0
#> 36 0.08012978 -0.51216548  0  1  1  0  0
#> 37 0.10101764 -0.09738429  0  1  1  0  0
#> 38 0.10631629  0.07986114  0  0  0  1  1
#> 39 0.11530796  0.46306563  0  0  0  1  0
#> 40 0.06733517  0.53540920  1  1  1  0  0
#> 41 0.12459935  0.91991545  1  0  1  0  1
#> 42 0.04837183  0.28764929  0  1  1  0  0
#> 43 0.06760571  0.23677321  1  1  1  1  1
#> 44 0.10118482 -0.14896282  0  1  0  0  0
#> 45 0.07235750  0.57073451  1  0  1  0  1
#> 46 0.12754742 -0.28184082  0  0  0  1  0
#> 47 0.09899778 -0.48429881  0  1  1  1  0
#> 48 0.10535158  0.58211960  0  1  1  0  1
#> 49 0.16895308  0.17318762  1  0  1  1  0
#> 50 0.09225451 -0.22004001  0  0  0  0  1
#> 
#> $testing
#>                yi X1 X2 X3 X4 X5
#> 51   1.3610589057  1  0  1  0  1
#> 52   0.9905762093  1  1  1  1  1
#> 53  -0.5663433441  0  1  0  0  0
#> 54   0.0325784399  0  1  0  1  0
#> 55  -0.3987294694  0  0  0  0  0
#> 56   1.4394713431  1  1  0  1  0
#> 57   0.8641291202  1  1  0  0  0
#> 58  -0.4664070750  0  1  1  0  0
#> 59  -0.2271211308  0  1  0  0  1
#> 60   0.4873625931  0  1  1  0  0
#> 61   1.0251315589  1  1  1  1  1
#> 62   0.2576578399  1  1  0  1  1
#> 63  -0.1346760556  1  1  1  1  1
#> 64   0.2827026925  0  1  0  0  0
#> 65   0.1992093839  1  0  0  0  0
#> 66   1.4388694026  1  0  1  0  0
#> 67   1.0564717221  0  1  1  0  0
#> 68  -0.0698590974  0  1  1  1  1
#> 69  -0.4445950100  0  0  1  1  0
#> 70   0.7217065925  1  1  0  0  1
#> 71   0.3877110174  1  1  1  1  1
#> 72   0.7805664984  1  1  1  0  1
#> 73  -0.0028772005  1  0  0  1  1
#> 74   1.1211745574  1  0  1  1  1
#> 75   0.3766041939  1  0  0  0  0
#> 76   0.1909042313  0  0  1  1  0
#> 77   0.4634482049  1  1  1  1  0
#> 78   0.1673482322  1  0  0  1  1
#> 79   0.5069101185  0  0  0  1  0
#> 80   0.5934150967  1  1  1  0  0
#> 81   0.2657470211  0  0  1  0  1
#> 82  -0.8205912639  0  1  0  1  1
#> 83   0.2563534563  0  0  0  1  1
#> 84  -0.3914667582  0  1  1  0  1
#> 85   0.7507259369  1  0  1  0  0
#> 86   0.6421525361  0  0  0  1  0
#> 87   0.0385397449  0  0  0  0  1
#> 88   0.4260140167  1  0  1  1  0
#> 89   0.5677753989  1  1  1  1  0
#> 90   0.3754579113  0  0  1  0  1
#> 91   0.0480205794  0  0  1  1  0
#> 92   0.3682180208  0  0  0  0  1
#> 93   0.5023048015  0  0  0  1  1
#> 94   0.2122716736  1  0  0  0  1
#> 95   1.1781509262  1  0  0  0  0
#> 96   0.1483738906  0  1  1  1  0
#> 97  -0.4509965470  0  1  0  0  0
#> 98   0.7176483438  1  0  0  1  0
#> 99  -0.1933798945  0  0  1  0  1
#> 100  0.6545642916  1  0  1  0  0
#> 101  0.7374296942  1  0  1  1  0
#> 102  1.0594813192  1  1  0  1  1
#> 103  0.0912794627  0  0  0  0  1
#> 104 -0.4199702552  0  0  1  0  0
#> 105  0.2211928770  1  1  0  0  1
#> 106  0.3246312380  1  1  1  1  1
#> 107 -0.0611561721  1  0  0  0  1
#> 108  0.3621610330  0  1  1  0  1
#> 109  0.2245841914  1  1  1  1  0
#> 110 -0.3058386101  0  1  0  1  0
#> 111  0.4660112449  1  1  0  1  0
#> 112  0.3991601309  1  1  0  0  1
#> 113 -0.1605873821  0  1  1  1  1
#> 114 -0.5967452625  1  1  0  1  1
#> 115  0.7097746996  1  0  0  1  0
#> 116 -0.2909741799  0  0  0  1  0
#> 117  0.0046824741  0  1  0  0  0
#> 118  0.1028707296  0  0  1  0  1
#> 119  0.1224422551  1  0  1  1  1
#> 120  0.3166730050  1  1  0  0  1
#> 121  0.1847810047  1  1  0  0  0
#> 122  0.4427034907  1  0  0  1  1
#> 123  0.1658383133  0  0  0  1  1
#> 124  0.2188132119  0  1  1  1  0
#> 125  1.0097088477  1  0  0  0  0
#> 126  1.3221468005  1  0  1  0  0
#> 127  0.1205266678  1  1  0  1  0
#> 128 -0.1723679990  0  0  1  1  1
#> 129  0.0823549821  0  0  1  1  0
#> 130  0.0805914564  1  0  1  0  1
#> 131 -0.1978631622  0  1  0  0  0
#> 132 -0.0005349054  1  0  1  0  0
#> 133  0.8448169996  0  0  1  0  0
#> 134 -0.1343452325  0  0  0  1  1
#> 135  0.4488476618  0  1  1  1  1
#> 136  0.2748160495  0  1  0  1  1
#> 137  0.2079566028  1  1  1  0  1
#> 138 -0.1336638343  1  0  1  0  0
#> 139  0.2469264903  0  1  1  0  0
#> 140  0.3855105100  0  1  1  1  0
#> 141  0.2140559227  0  0  1  1  1
#> 142  0.0700871731  0  1  0  0  0
#> 143  0.8108545496  1  0  0  0  0
#> 144  0.2166929222  1  0  0  0  0
#> 145  1.3390181875  1  0  0  1  0
#> 146  0.5456515402  1  1  0  0  0
#> 147 -0.3318034211  1  1  1  1  0
#> 148  0.8911191771  1  0  1  0  0
#> 149  0.1317889141  0  0  0  0  0
#> 150 -0.0743895794  0  0  0  0  0
#> 
#> $housekeeping
#>      n mu_i      theta_i
#> 1   44  0.5  0.751593116
#> 2   30  0.0 -0.333319987
#> 3   36  0.5  0.259946504
#> 4   42  0.0  0.203900854
#> 5    8  0.5  0.333272677
#> 6   48  0.0 -0.101590063
#> 7   50  0.5  0.500086117
#> 8   46  0.5  0.575034492
#> 9   52  0.5  0.523972886
#> 10  66  0.0 -0.245329443
#> 11  50  0.5  0.192303599
#> 12  42  0.5  0.305490443
#> 13  42  0.0 -0.024421633
#> 14  36  0.5  0.549976149
#> 15  24  0.5  0.431615110
#> 16  30  0.0 -0.252439422
#> 17  42  0.5  0.479428248
#> 18  16  0.0  0.002462566
#> 19  60  0.0 -0.115571313
#> 20  44  0.5  0.916370461
#> 21  44  0.0  0.076819223
#> 22  40  0.0  0.031935406
#> 23  18  0.5  0.855925180
#> 24  34  0.5  0.544843473
#> 25  56  0.5  0.339226445
#> 26  32  0.0 -0.022609364
#> 27  54  0.5  0.940078186
#> 28  52  0.5  0.766181107
#> 29  50  0.5  0.331731433
#> 30  56  0.0 -0.116785319
#> 31  42  0.5  0.164752731
#> 32  18  0.5  0.632419021
#> 33  44  0.5  0.358384228
#> 34  18  0.5  0.394927198
#> 35  40  0.5  0.322318975
#> 36  50  0.0 -0.116699700
#> 37  38  0.0  0.042058371
#> 38  36  0.0 -0.414291477
#> 39  34  0.0 -0.134362368
#> 40  60  0.5  0.648517760
#> 41  34  0.5  0.616871721
#> 42  82  0.0  0.022864382
#> 43  58  0.5  0.263974696
#> 44  38  0.0  0.002218353
#> 45  56  0.5  0.508134057
#> 46  30  0.0 -0.339267568
#> 47  40  0.0 -0.437684389
#> 48  38  0.0  0.365781498
#> 49  22  0.5  0.851941905
#> 50  42  0.0 -0.165840739
#> 51  18  0.5  0.444477451
#> 52  32  0.5  0.529667395
#> 53  38  0.0  0.034483966
#> 54  40  0.0 -0.157414388
#> 55  54  0.0 -0.364823301
#> 56  46  0.5  0.680246853
#> 57  34  0.5  0.676100483
#> 58  28  0.0 -0.244393314
#> 59  44  0.0  0.328934539
#> 60  54  0.0  0.311210623
#> 61  56  0.5  0.455421861
#> 62  50  0.5  0.424529812
#> 63  10  0.5  0.575313592
#> 64  30  0.0  0.248007282
#> 65  28  0.5  0.621103649
#> 66  38  0.5  0.674340196
#> 67  46  0.0  0.497120688
#> 68  58  0.0 -0.261939925
#> 69  40  0.0 -0.339623134
#> 70  42  0.5  0.581938491
#> 71  28  0.5  0.454697744
#> 72  56  0.5  0.430230952
#> 73  34  0.5  0.601482092
#> 74  54  0.5  1.016411035
#> 75  62  0.5  0.455983640
#> 76  30  0.0  0.323725024
#> 77  78  0.5  0.550542960
#> 78  42  0.5  0.253060913
#> 79  50  0.0  0.176795679
#> 80  26  0.5  0.771009613
#> 81  54  0.0  0.129566696
#> 82  46  0.0 -0.116406274
#> 83  34  0.0  0.069236541
#> 84  36  0.0 -0.194299499
#> 85  32  0.5  0.781030782
#> 86  62  0.0  0.343158794
#> 87  42  0.0  0.166258046
#> 88  50  0.5  0.702321785
#> 89  34  0.5  0.464791569
#> 90  42  0.0  0.210350910
#> 91  42  0.0  0.003151477
#> 92  46  0.0  0.008161278
#> 93  30  0.0  0.074808844
#> 94  32  0.5  0.536789276
#> 95  14  0.5  0.777536531
#> 96  28  0.0  0.382863686
#> 97  46  0.0 -0.111754255
#> 98  38  0.5  0.694209077
#> 99  40  0.0 -0.165236592
#> 100 42  0.5  0.721944321
#> 101 36  0.5  0.504473660
#> 102 32  0.5  0.733613486
#> 103 46  0.0 -0.094132651
#> 104 24  0.0 -0.018162156
#> 105 50  0.5  0.370018449
#> 106 54  0.5  0.451048736
#> 107 34  0.5  0.367677401
#> 108 56  0.0  0.024588526
#> 109 48  0.5  0.315783208
#> 110 42  0.0 -0.153688502
#> 111 22  0.5  0.751588557
#> 112 28  0.5  0.440816462
#> 113 46  0.0 -0.241672109
#> 114 50  0.5  0.528996773
#> 115 48  0.5  0.565896920
#> 116 28  0.0 -0.242492584
#> 117 34  0.0 -0.025367043
#> 118 38  0.0  0.122714748
#> 119 56  0.5  0.123237904
#> 120 56  0.5  0.555290144
#> 121 20  0.5  0.708371544
#> 122 42  0.5  0.371526301
#> 123 56  0.0  0.082036300
#> 124 28  0.0  0.103376035
#> 125 30  0.5  0.517528926
#> 126 18  0.5  0.624071906
#> 127 26  0.5  0.708166163
#> 128 26  0.0  0.045687466
#> 129 60  0.0  0.128322816
#> 130 30  0.5  0.456718548
#> 131 48  0.0  0.064661647
#> 132 20  0.5  0.360405969
#> 133 40  0.0  0.117729175
#> 134 66  0.0 -0.050175225
#> 135 44  0.0 -0.036823966
#> 136 28  0.0 -0.017780269
#> 137 70  0.5  0.179446748
#> 138 42  0.5  0.413166195
#> 139 56  0.0  0.262883275
#> 140 44  0.0  0.451997423
#> 141 22  0.0  0.362111531
#> 142 44  0.0 -0.154110854
#> 143 66  0.5  0.371361599
#> 144 28  0.5  0.315437282
#> 145 22  0.5  0.900416075
#> 146 36  0.5  0.542047973
#> 147 46  0.5  0.240674876
#> 148 48  0.5  0.384783500
#> 149 14  0.0 -0.073030411
#> 150 40  0.0  0.029996208
#> 
#> $tau2_est
#> [1] 0.09684336
#> 
simulate_smd(distribution = "bernoulli", model = "es * x[ ,1] * x[ ,2]")
#> $training
#>            vi           yi X1 X2 X3 X4 X5
#> 1  0.06299004  0.101690648  0  0  1  0  1
#> 2  0.07851046 -0.316829310  0  1  1  0  0
#> 3  0.06494661  0.006000258  1  1  0  0  1
#> 4  0.06248350  0.437081405  1  1  1  1  1
#> 5  0.08151884  0.633419001  1  1  0  0  0
#> 6  0.08845043 -0.261689473  1  0  1  1  1
#> 7  0.11223374  0.073369528  1  1  0  1  0
#> 8  0.07377923  0.445377026  1  0  0  0  1
#> 9  0.13569134 -0.240723218  1  0  1  0  0
#> 10 0.09745917 -0.333850759  1  0  1  0  1
#> 11 0.10503473  0.561055136  1  1  0  1  0
#> 12 0.08011055 -0.510284534  0  0  1  1  0
#> 13 0.08773877 -0.076520868  0  1  1  0  0
#> 14 0.11216053  0.020116090  1  0  0  1  0
#> 15 0.09195915  0.153647028  1  0  0  0  0
#> 16 0.09752529  0.700830454  0  1  0  1  0
#> 17 0.20205706  0.133484765  0  0  1  0  0
#> 18 0.08863228 -0.290661784  0  1  1  1  1
#> 19 0.07446868  0.749793883  1  1  0  1  0
#> 20 0.07985105  0.737493474  1  1  1  0  0
#> 
#> $testing
#>               yi X1 X2 X3 X4 X5
#> 21   0.043815464  0  0  1  1  0
#> 22  -0.048966725  0  1  0  0  1
#> 23  -0.392490028  0  0  1  1  1
#> 24   0.433750412  0  0  1  1  1
#> 25  -0.140216911  1  0  0  1  1
#> 26   0.297429275  1  1  1  0  0
#> 27   0.376034576  1  1  1  0  1
#> 28   0.582961055  1  0  0  1  0
#> 29   0.609602364  0  0  1  1  1
#> 30   0.061378434  0  0  0  0  1
#> 31   0.490004390  1  1  1  1  0
#> 32   0.102490938  1  1  0  1  1
#> 33   0.277943674  1  1  0  1  1
#> 34   0.750090467  1  1  0  1  1
#> 35  -0.126124106  0  0  0  1  0
#> 36  -0.134621588  1  1  0  1  1
#> 37   0.281455564  0  0  1  1  1
#> 38   0.024912072  0  0  0  1  0
#> 39  -0.246580973  1  0  1  1  0
#> 40  -0.210515066  0  1  1  1  1
#> 41   0.329798576  0  0  1  1  0
#> 42   0.129320549  0  1  1  1  1
#> 43  -0.318387047  0  1  1  0  1
#> 44   0.321880461  0  1  1  0  0
#> 45  -0.014817962  1  0  0  1  0
#> 46  -0.013445415  0  0  1  1  0
#> 47  -0.383711975  1  0  1  0  0
#> 48   0.017690162  1  0  0  0  1
#> 49   0.064626566  1  1  0  0  0
#> 50   0.136806194  1  1  0  0  1
#> 51   0.233782428  0  1  0  1  0
#> 52   0.429324364  0  1  0  0  1
#> 53   0.546178309  1  1  0  0  0
#> 54  -1.046527040  1  0  0  0  1
#> 55   0.130567846  0  1  0  1  0
#> 56   0.568800820  1  1  1  1  0
#> 57   0.131183163  0  0  1  1  1
#> 58  -0.274906568  0  0  0  1  0
#> 59  -0.242326268  0  0  0  0  0
#> 60   0.282678008  0  1  1  0  1
#> 61   0.156371610  0  1  1  1  0
#> 62   0.566442533  1  0  0  0  1
#> 63   0.735351939  1  1  1  1  1
#> 64  -0.290157779  0  1  0  1  1
#> 65   0.358903351  0  0  1  0  1
#> 66  -0.517552114  1  0  0  0  0
#> 67  -0.214688133  0  1  1  1  0
#> 68   0.350995191  0  1  0  1  1
#> 69  -0.008986599  1  1  1  0  1
#> 70   0.175530772  0  1  0  0  0
#> 71  -0.111710942  1  0  0  1  1
#> 72   0.069247766  0  1  0  0  0
#> 73   0.040908692  0  0  0  1  0
#> 74  -0.654383762  0  1  0  0  1
#> 75   0.239617380  1  0  1  1  1
#> 76   0.328919754  0  1  0  0  0
#> 77   0.393856139  0  1  1  1  1
#> 78   0.843287275  1  1  0  1  1
#> 79  -0.443871361  0  0  0  1  0
#> 80  -0.096871180  0  1  0  0  1
#> 81  -0.406524790  0  1  1  1  1
#> 82   0.428544929  1  0  0  0  0
#> 83  -0.045226124  0  0  0  1  1
#> 84  -0.312313647  1  0  0  0  0
#> 85  -0.528063152  1  1  1  1  0
#> 86   0.677445564  1  1  1  1  0
#> 87  -0.109778764  1  0  1  0  0
#> 88   0.397106369  1  1  0  1  0
#> 89   0.041568034  1  0  0  1  1
#> 90  -0.102783661  0  1  0  1  1
#> 91   0.215353291  0  0  1  1  0
#> 92  -0.139109751  0  0  0  1  0
#> 93   0.075468378  1  0  1  1  0
#> 94   0.749387268  1  1  0  1  0
#> 95  -0.263918561  0  0  1  0  1
#> 96   0.304536926  1  0  0  1  0
#> 97   0.524325007  1  1  0  1  0
#> 98   0.294376356  1  1  0  1  0
#> 99  -0.625542875  0  0  1  0  0
#> 100  0.154216232  0  0  1  0  1
#> 101 -0.459311288  0  1  0  1  1
#> 102 -0.707305530  1  1  1  0  0
#> 103  0.605729758  0  0  1  0  1
#> 104  0.403280400  0  1  0  0  0
#> 105 -0.174587977  0  1  1  1  0
#> 106 -0.791154047  0  1  1  0  0
#> 107  0.055850735  0  1  1  1  1
#> 108  0.457637433  0  1  1  0  1
#> 109 -0.583514471  1  0  0  1  0
#> 110 -0.206441167  0  0  0  1  0
#> 111  1.139266569  1  1  0  0  1
#> 112  1.244348667  1  1  0  0  0
#> 113 -0.090969869  0  1  1  1  0
#> 114 -0.227222012  1  0  0  1  0
#> 115 -0.381972955  1  0  0  1  1
#> 116  0.412649206  1  0  0  0  1
#> 117  0.172336439  1  0  1  0  0
#> 118  0.643561153  0  0  1  1  1
#> 119  0.407833256  0  0  0  0  0
#> 120 -0.189808725  0  1  1  1  1
#> 
#> $housekeeping
#>      n mu_i      theta_i
#> 1   62  0.0 -0.195914572
#> 2   50  0.0  0.117754379
#> 3   60  0.5  0.504442832
#> 4   64  0.5  0.334986895
#> 5   50  0.5  0.635909615
#> 6   44  0.0 -0.166799419
#> 7   34  0.5  0.348473153
#> 8   54  0.0  0.263732698
#> 9   28  0.0 -0.015865433
#> 10  40  0.0 -0.145624750
#> 11  38  0.5  0.653275533
#> 12  50  0.0 -0.065551359
#> 13  44  0.0 -0.101508381
#> 14  34  0.0  0.178484836
#> 15  42  0.0  0.016898242
#> 16  42  0.0 -0.037448007
#> 17  18  0.0  0.063490797
#> 18  44  0.0  0.028640294
#> 19  56  0.5  0.583168654
#> 20  52  0.5  0.708355141
#> 21  14  0.0  0.112886227
#> 22  28  0.0 -0.052430244
#> 23  50  0.0 -0.177821497
#> 24  40  0.0  0.301221132
#> 25  16  0.0 -0.031030426
#> 26  22  0.5  0.374363232
#> 27  44  0.5  0.592962634
#> 28  46  0.0  0.235904218
#> 29  26  0.0  0.119646973
#> 30  44  0.0  0.132285001
#> 31  52  0.5  0.592947727
#> 32  48  0.5  0.639643034
#> 33  30  0.5  0.213354069
#> 34  40  0.5  0.766491423
#> 35  44  0.0 -0.118927588
#> 36  22  0.5  0.505247036
#> 37  60  0.0  0.107720332
#> 38  42  0.0 -0.264762986
#> 39  28  0.0  0.090561793
#> 40  46  0.0  0.129762741
#> 41  30  0.0 -0.058243852
#> 42  48  0.0  0.050742996
#> 43  60  0.0 -0.002325187
#> 44  40  0.0  0.027255662
#> 45  34  0.0 -0.090533400
#> 46  74  0.0  0.139379741
#> 47  46  0.0 -0.084093802
#> 48  44  0.0 -0.098884221
#> 49  54  0.5  0.485284650
#> 50  24  0.5  0.288016313
#> 51  52  0.0  0.061619277
#> 52  24  0.0 -0.086395939
#> 53  48  0.5  0.537067726
#> 54  26  0.0 -0.369489297
#> 55  62  0.0 -0.025679440
#> 56  62  0.5  0.517027953
#> 57  28  0.0 -0.128003046
#> 58  52  0.0  0.165316992
#> 59  44  0.0  0.088843384
#> 60  50  0.0 -0.081190727
#> 61  38  0.0  0.030984774
#> 62  66  0.0  0.172610146
#> 63  30  0.5  0.374923318
#> 64  34  0.0  0.023183774
#> 65  28  0.0 -0.095491210
#> 66  36  0.0 -0.047627377
#> 67  42  0.0 -0.070378435
#> 68  34  0.0  0.199668073
#> 69  22  0.5  0.310584248
#> 70  14  0.0 -0.179261501
#> 71  50  0.0 -0.200384649
#> 72  80  0.0 -0.130594376
#> 73  56  0.0  0.018470968
#> 74  46  0.0 -0.008432395
#> 75  36  0.0  0.263752308
#> 76  44  0.0  0.203247060
#> 77  50  0.0  0.128966290
#> 78  52  0.5  0.566950146
#> 79  20  0.0 -0.041844479
#> 80  44  0.0  0.157175036
#> 81  32  0.0  0.088085262
#> 82  28  0.0 -0.187514419
#> 83  28  0.0 -0.044539113
#> 84  14  0.0 -0.170822472
#> 85  26  0.5  0.125015758
#> 86  26  0.5  0.658994613
#> 87  24  0.0 -0.274062994
#> 88  32  0.5  0.849156412
#> 89  32  0.0 -0.124885419
#> 90  60  0.0 -0.122154816
#> 91  56  0.0  0.449999010
#> 92  50  0.0  0.227325783
#> 93  60  0.0 -0.062310670
#> 94  64  0.5  0.566832273
#> 95  34  0.0 -0.047588972
#> 96  48  0.0 -0.307326853
#> 97  42  0.5  0.524976277
#> 98  36  0.5  0.514501304
#> 99  28  0.0 -0.089717080
#> 100 34  0.0 -0.022378912
#> 101 36  0.0 -0.284214283
#> 102 30  0.5  0.093212443
#> 103 26  0.0  0.299978974
#> 104 38  0.0  0.255503634
#> 105 20  0.0 -0.348699761
#> 106 36  0.0 -0.114085754
#> 107 34  0.0  0.015713373
#> 108 54  0.0  0.213715345
#> 109 38  0.0 -0.131536879
#> 110 54  0.0 -0.045867605
#> 111 46  0.5  0.903520519
#> 112 40  0.5  0.781926271
#> 113 36  0.0 -0.401014680
#> 114 36  0.0  0.133779366
#> 115 64  0.0 -0.275685450
#> 116 50  0.0  0.311662217
#> 117 34  0.0  0.227026447
#> 118 52  0.0  0.126597864
#> 119 34  0.0  0.280484974
#> 120 30  0.0 -0.170053996
#> 
#> $tau2_est
#> [1] 0.07936629
#>