Learn R Programming

umx (version 1.9.1)

umx_make_MR_data: Simulate Mendelian Randomization data

Description

umx_make_MR_data returns a dataset containing 4 variables: A variable of interest (Y), a putative cause (X), a qtl (quantitative trait locus) influencing X, and a confounding variable (U) affecting both X and Y.

Usage

umx_make_MR_data(nSubjects = 1000, Vqtl = 0.02, bXY = 0.1, bUX = 0.5,
  bUY = 0.5, pQTL = 0.5, seed = 123)

Arguments

nSubjects

Number of subjects in sample

Vqtl

Variance of QTL affecting causal variable X (Default 0.02)

bXY

Causal effect of X on Y (Default 0.1)

bUX

Confounding effect of confounder 'U' on X (Default 0.5)

bUY

Confounding effect of confounder 'U' on Y (Default 0.5)

pQTL

Decreaser allele frequency (Default 0.5)

seed

value for the random number generator (Default 123)

Value

- data.frame

Details

The code to make these Data. Modified from Dave Evans 2016 Boulder workshop talk.

See Also

Other Data Functions: umxCovData, umxFactor, umxHetCor, umxPadAndPruneForDefVars, umx_as_numeric, umx_cont_2_quantiles, umx_cov2raw, umx_long2wide, umx_lower2full, umx_make_TwinData, umx_make_bin_cont_pair_data, umx_make_fake_data, umx_merge_CIs, umx_read_lower, umx_reorder, umx_residualize, umx_round, umx_scale_wide_twin_data, umx_scale, umx_swap_a_block, umx_wide2long, umx

Examples

Run this code
# NOT RUN {
df = umx_make_MR_data(10000)
str(df)
# }
# NOT RUN {
m1 = umxTwoStage(Y ~ X, ~qtl, data = df)
plot(m1)
# }

Run the code above in your browser using DataLab