Learn R Programming

umx (version 4.9.0)

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

umx_make_TwinData

Other Data Functions: umxFactor(), umxHetCor(), umx_as_numeric(), umx_cont_2_quantiles(), umx_lower2full(), umx_make_TwinData(), umx_make_fake_data(), umx_make_raw_from_cov(), umx_polychoric(), umx_polypairwise(), umx_polytriowise(), umx_read_lower(), umx_read_prolific_demog(), umx_rename(), umx_reorder(), umx_score_scale(), umx_select_valid(), umx_stack(), 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