create_ind_data: Generation of individual level data

View source: R/mr_summarise.R

create_ind_dataR Documentation

Generation of individual level data

Description

generates individual level data with a single genetic variant

Usage

create_ind_data(
  N,
  gpar = 0.3,
  par1 = 1,
  par2 = 0,
  beta0 = 0,
  beta1 = 3,
  beta2 = 7,
  confound = 0.8
)

Arguments

N

number of individuals to create

gpar

genetic parameter; used to create g: single genetic snp, from a binomial distribution with n=2 and p = gpar.

par1

power parameter for fractional poly generation. See details

par2

power parameter for fractional poly generation. . See details.

beta0

covariate parameter. See details

beta1

covariate parameter. See details

beta2

covariate parameter. See details

confound

confounding parameter,c. See details.

Value

data A data-frame containing the values of g, the genetic variate; X, the exposure; and a variety of Y, the outcome values. All outcomes are continuous not binary.

Note

This function generates a database with genetic relationships suitable for evaluating non-linear MR relationships. A unknown covariate,u, is generated as a N(0,1) variable. Error terms are generated: Ex ~exp(1) and for Ey ~ N(0,1) X= 2+ 0.25*g +u + E_x Outcomes are as follows

  • Linear: Y=b_0+ b_1 X + cU +E_y

  • Quadratic Y = b_0 + b_1 X + b_2 X^2 + cU +E_y

  • Squareroot Y = b_0 + b_1 \sqrt{X} + cU +E_y

  • Log Y = b_0 + b_1 \log(X) + cU +E_y

  • Threshold Y = b_0+ b_1 X + cU +E_y ifX>b_2 and Y = b_0 + cU +E_y otherwise

  • fracpoly Y = b_0 + b_1 X^{p_1} + b_2 X^{p_2} + cU + E_y with the usual adaptions for p=0 or p_1=p_2

Author(s)

Amy Mason


amymariemason/SUMnlmr documentation built on July 22, 2024, 10:03 a.m.