Skip to contents

Generates paired univariate data for kinship pairs with specified genetic relatedness, following the classical ACE model (Additive genetic, Common environment, unique Environment).

Usage

kinsim_internal(
  r = c(1, 0.5),
  c_rel = 1,
  npg = 100,
  npergroup = rep(npg, length(r)),
  mu = 0,
  ace = c(1, 1, 1),
  r_vector = NULL,
  c_vector = NULL,
  ...
)

Arguments

r

Numeric vector. Levels of genetic relatedness for each group; default is c(1, 0.5) representing MZ and DZ twins respectively.

npg

Integer. Default sample size per group; default is 100.

npergroup

Numeric vector. List of sample sizes by group; default repeats npg for all groups in r.

mu

Numeric. Mean value for the generated variable; default is 0.

ace

Numeric vector. Variance components in order c(a, c, e) where a = additive genetic, c = shared environment, e = non-shared environment; default is c(1, 1, 1).

r_vector

Numeric vector. Alternative specification method providing relatedness coefficients for the entire sample; default is NULL.

...

Additional arguments passed to other methods.

Value

A data frame with the following columns:

id

Unique identifier for each kinship pair

A1

Genetic component for first member of pair

A2

Genetic component for second member of pair

C1

Shared-environmental component for first member of pair

C2

Shared-environmental component for second member of pair

E1

Non-shared-environmental component for first member of pair

E2

Non-shared-environmental component for second member of pair

y1

Generated phenotype for first member of pair with mean mu

y2

Generated phenotype for second member of pair with mean mu

r

Level of genetic relatedness for the kinship pair

Details

This function simulates data according to the ACE model, where phenotypic variance is decomposed into additive genetic (A), shared environmental (C), and non-shared environmental (E) components. It can generate data for multiple kinship groups with different levels of genetic relatedness (e.g., MZ twins, DZ twins, siblings).