Skip to contents

Sample QTL effects under a specified architecture.

Usage

sim_beta(G, ncausal, ntrait = 1, is_h2g_total = TRUE, shared_pattern = "all")

Arguments

G

Genotype matrix

ncausal

Output from function parse_num_causal_snps, how many variants have non-negative effects (being causal)

ntrait

Number of simulated phenotypes (traits)

is_h2g_total

Logical indicating if h2g is total (TRUE) or per-SNP (FALSE).

shared_pattern

if is "all", all traits will have the same causal variant(s) with non-zero effect. if is "random", all traits will have independent (random) causal variant(s)

Value

Matrix of causal effect sizes (variants × traits).

Examples

# Create a genotype matrix
G = matrix(rbinom(1000, 2, 0.5), nrow = 1000, ncol = 50) 
B = sim_beta(G, ncausal = 5, ntrait = 3, is_h2g_total = T, shared_pattern = "all")
B = sim_beta(G, ncausal = 1, ntrait = 5, is_h2g_total = F, shared_pattern = "random")