simulatetwin {BayesTwin} | R Documentation |

## Simulate item-level twin data

### Description

Simulation of item-level twin data under the AE, ACE or ADE model with or without genotype by environment interaction (GxE).

### Usage

```
simulatetwin(n_mz = 140, n_dz = 360, var_a = 0.5, var_c = 0.3,
var_e = 0.2, var_d = 0, model = "ACE", n_items = 20, n_cat = 0,
ge = FALSE, ge_beta0 = 0, ge_beta1 = 0, irt_model = "1PL")
```

### Arguments

`n_mz` |
Number of monozygotic (MZ) twin pairs. Default value is 140. |

`n_dz` |
Number of dizygotic (DZ) twin pairs. Default value is 360. |

`var_a` |
Variance explained by additive genetic influences. Default value is 0.5. |

`var_c` |
Variance explained by shared environmental influences. Default value is 0.3. |

`var_e` |
Variance explained by unique environmental influences. Default value is 0.2. |

`var_d` |
Variance explained by dominance genetic influences. As the default model is an "ACE" model, the default value is set to 0. |

`model` |
Biometric model used for the simulation, either "ACE", "ADE" or "AE". Default model is "ACE" model. |

`n_items` |
Number of test items. Default value is 20. |

`n_cat` |
Number of categories for the simulation of polytomous item data. As the default IRT model is a 1PL, the default is set 0. |

`ge` |
Indication whether data is simulated with (ge = TRUE) or without (ge = FALSE) GxE. Default value is FALSE |

`ge_beta0` |
When data is simulated with ge = TRUE, average environmental variance (when A = 0) has to be defined. Default value is 0. |

`ge_beta1` |
When data is simulated with ge = TRUE, the GxE interaction parameter has to be defined. Default value is 0. |

`irt_model` |
Choice of the measurement (IRT) model under which the item data is simulated. "1PL" = 1 PL model, "2PL" = 2PL model, "PCM" = Partial credit model, "GPCM" = Generalized partial credit model. |

### Details

Item twin data is simulated under all common biometric models (i.e., A(C)E, ADE) with or without genotype by environment interaction (GxE). Data is simulated with an average phenotypic value of 0. For the simulation of dichotomous item data, the 1 PL or 2 PL can be used. For polytomous item data with three or more categories, the partial credit model (PCM) or the generalized partial credit model (GPCM) can be used.

Genotype by environment interaction is defined modelled as heterogeneous unique-environmental variance and is defined as `\sigma^2Eij = exp (\beta0 + \beta1 Aij)`

under the ACE model and as `\sigma^2Eij = exp (\beta0 + \beta1 Gij)`

under the ADE model where `\beta0`

refers to an intercept (unique-environmental variance when `Aij`

or respectively `Gij = 0`

) and `\beta1`

represents the GxE interaction effect. `Aij`

represents the genotypic value for twin `j`

from family `i`

, likewise `G`

represents the total genotypic value (both additive and non-additive genetic effects) for twin `j`

from family `i`

. For more detail see Schwabe & van den Berg (2014, 2016) or Schwabe, Boomsma & van den Berg (2017).

### Value

Two matrices are returned, `y_mz`

for MZ twin pairs and `y_dz`

for DZ twin pairs.
For a total of `n_items`

, the result is a matrix of `n_mz`

rows for the i-th MZ family and 2*`n_items`

columns with the item answers of the first (columns 1:`n_items`

) and second twin (columns `n_items`

+ 1:2*`n_items`

) of a family. For example, `y_mz[1,22]`

is the response of the first twin from family 1 to item 22 and `y_mz[1,23]`

is the response of the seocnd twin2 from family 1 to item 1 if `n_items`

= 22. The same logic applies to the data of DZ families.

### Author(s)

Inga Schwabe

### References

Schwabe, I. & van den Berg, S.M. (2014). Assessing Genotype by Environment Interaction in Case of Heterogeneous Measurement Error, Behavior Genetics, 44 (4), 394-406.

Schwabe, I., Jonker, W. & van den Berg, S.M. (2016). Genes, Culture and Conservatism - A Psychometric-Genetic Approach, Behavior Genetics, 46 (4), 516-52.

Schwabe, I., Boomsma, D.I. & van den Berg, S.M. (2017). Increased Environmental Sensitivity in High Mathematics Performance. Learning and Individual Differences, 54, 196-201.

### Examples

```
#100 MZ twins, 200 DZ twins, ACE model, no GxE, 1 PL:
simulatetwin(n_mz = 100, n_dz = 200)
## Not run:
#500 MZ twins, 800 DZ twins, ACE model, no GxE, 1 PL:
simulatetwin(n_mz = 500, n_dz = 800)
#140 MZ twins, 360 DZ twins, ADE model, GPCM:
simulatetwin(var_a = 0.4, var_d = 0.2, var_e = 0.4,
model = "ADE", irt_model = "GPCM")
## End(Not run)
```

*BayesTwin*version 1.0 Index]