Simulate Multiple Traits from Genotype and Effect Sizes
Source:R/simulate_linreg.R
sim_multi_traits.RdThis function simulates multiple traits (phenotypes) based on genotype data, a matrix of effect sizes, and heritability. It allows specifying if the heritability is total or per-SNP, optionally scales the phenotypes, and can handle residual correlations. per eQTL heritability is 0.05 to 0.07 according to https://www.nature.com/articles/ng.3506
Usage
sim_multi_traits(
G,
B,
h2g,
is_h2g_total = TRUE,
max_h2g = 1,
residual_corr = NULL,
null_sigma = sqrt(0.1)
)Arguments
- G
Genotype matrix.
- B
Matrix of effect sizes for multiple traits.
- h2g
Heritability (proportion of variance explained by genetics).
- is_h2g_total
Logical indicating if h2g is total (TRUE) or per-SNP (FALSE).
- max_h2g
Maximum heritability allowed (default 1).
- residual_corr
Matrix of residual correlations (NULL for independent samples).
- null_sigma
Standard deviation for null traits (default sqrt(0.1)).