example_3way: Simulated example of a 3 way interaction GxExz model

Description Usage Arguments Value Examples

View source: R/LEGIT.R

Description

Simulated example of a 3 way interaction GxExz model (where G and E are latent variables).

g_j \sim Binomial(n=1,p=.30)

j = 1, 2, 3, 4

e_l \sim Normal(μ=0,σ=1.5)

l = 1, 2, 3

z \sim Normal(μ=3,σ=1)

g = .2g_1 + .15g_2 - .3g_3 + .1g_4 + .05g_1g_3 + .2g_2g_3

e = -.45e_1 + .35e_2 + .2e_3

μ = -2 + 2g + 3e + z + 5ge - 1.5ez + 2gz + 2gez

y \sim Normal(μ=μ,σ=\code{sigma}) if logit=FALSE
y \sim Binomial(n=1,p=logit(μ)) if logit=TRUE

Usage

1
example_3way(N, sigma = 2.5, logit = FALSE, seed = NULL)

Arguments

N

Sample size.

sigma

Standard deviation of the gaussian noise (if logit=FALSE).

logit

If TRUE, the outcome is transformed to binary with a logit link.

seed

RNG seed.

Value

Returns a list containing, in the following order: data.frame with the observed outcome (with noise), the true outcome (without noise) and z, data.frame of the genetic variants (G), data.frame of the environments (E), vector of the true genetic coefficients, vector of the true environmental coefficients, vector of the true main model coefficients

Examples

1
2
example_3way(5,2.5,logit=FALSE)
example_3way(5,0,logit=TRUE)

LEGIT documentation built on June 24, 2018, 5:01 p.m.