kinsim: Simulate Biometrically informed Multivariate Data

Description Usage Arguments Value

View source: R/func_kinsim.R

Description

Generate paired multivariate data, given ACE parameters.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
kinsim(
  r_all = c(1, 0.5),
  npg_all = 500,
  npergroup_all = rep(npg_all, length(r_all)),
  mu_all = 0,
  variables = 2,
  mu_list = rep(mu_all, variables),
  reliability_list = NULL,
  r_vector = NULL,
  ace_all = c(1, 1, 1),
  ace_list = matrix(rep(ace_all, variables), byrow = TRUE, nrow = variables),
  cov_a = 0,
  cov_c = 0,
  cov_e = 0,
  ...
)

Arguments

r_all

Levels of relatedness; default is MZ and DZ twins c(1,.5).

npg_all

Sample size per group; default is 500.

npergroup_all

Vector of sample sizes by group; default repeats npg_all for all groups

mu_all

Mean for each generated variable; default is 0.

variables

Number of variables to generate; default is 2. Currently, limited to max of two variables.

mu_list

List of means by variable; default repeats mu_all for all variables

reliability_list

Vector of Reliabilities for each generated variable; default is to repeat reliability_all for each variable

r_vector

Alternative, give vector of r coefficients for entire sample.

ace_all

Vector of variance components for each generated variable; default is c(1,1,1).

ace_list

Matrix of ACE variance components by variable, where each row is its own variable; default is to repeat ace_all for each variable.

cov_a

Shared variance for additive genetics (a); default is 0.

cov_c

Shared variance for shared-environment (c); default is 0.

cov_e

shared variance for non-shared-environment (e); default is 0.

...

Optional pass on additional inputs.

Value

Returns data.frame with the following:

Ai_1

genetic component for variable i for kin1

Ai_2

genetic component for variable i for kin2

Ci_1

shared-environmental component for variable i for kin1

Ci_2

shared-environmental component for variable i for kin2

Ei_1

non-shared-environmental component for variable i for kin1

Ei_2

non-shared-environmental component for variable i for kin2

yi_1

generated variable i for kin1

yi_2

generated variable i for kin2

r

level of relatedness for the kin pair

id

id


discord documentation built on July 15, 2021, 9:06 a.m.