sim_phenotype: Simulates a binary phenotype

Description Usage Arguments Value See Also Examples

View source: R/model.R

Description

The phenotypes are simulated according to a logistic regression model. Depending on the chosen configuration in sample_SNP, the model includes different effect types: synergistic effects with the target, marginal effects and additional epistatic effects. We offer the option to generate a balanced phenotype vector between cases and controls, through the intercept parameter.

Usage

1
sim_phenotype(X, causal, model, intercept = TRUE)

Arguments

X

genotype matrix

causal

causal SNPs.

model

disease model

intercept

binary flag. If intercept=TRUE, a non-null intercept is added so that the output is (approximately) balanced between cases and controls.

Value

A vector of simulated phenotypes which are encoded as a two-level factor (TRUE/FALSE).

See Also

sample_SNP and gen_model

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
nX <- 5
nY <- 3
nZ12 <- 2
clusters <- rep(seq_len(25), each = 3)
names(clusters) <- paste0("SNP_", seq_along(clusters))
MAF <- runif(length(clusters), min = 0.2, max = 0.5)

n_samples <- 3
X <- matrix((runif(n_samples * length(clusters)) < 0.4) +
            (runif(n_samples * length(clusters)) < 0.4),
            ncol = length(clusters), nrow = n_samples)

colnames(X) <- names(clusters)

causal <- sample_SNP(
 nX, nY, nZ12, clusters, MAF, thresh_MAF = 0.2, window_size = 2,
 overlap_inter = 0)
model <- gen_model(nX, nY, nZ12, mean = rnorm(4), sd = rep(1, 4))
Y <- sim_phenotype(X, causal, model, intercept = TRUE)

EpiSlim/epiGWAS documentation built on Nov. 19, 2019, 7:15 p.m.