sim_stats_mef: sim_power_indiv.R

Description Usage Arguments Value Examples

View source: R/sim_power_indiv.R

Description

Simulate power starting from individual-level data for multiple explanatory factor setting.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
sim_stats_mef(
  B,
  sigSq,
  xMat,
  gMat,
  alphaVec,
  betaVec,
  decompTrue = NULL,
  checkpoint = FALSE
)

Arguments

B

Number of simulations.

sigSq

Variance of outcome.

xMat

Design matrix of non-genetic covariates, n*p.

gMat

Matrix of genotypes, n*J.

alphaVec

p*1 vector of regression coefficients for xMat.

betaVec

J*1 vector of regression coefficients for gMat.

decompTrue

The return value of a call to eigen() on the true covariance matrix. Can be null, in which case estimated covariance will be used.

checkpoint

Boolean, if true then print message every 50 simulations.

Value

A list with the elements:

zMat

B*J matrix of test statistics Z.

zVecGBJ

Check on Z statistics, vector should match first row of zMat.

iMat

Innovated statistics matrix also of dimension B*J.

Examples

1
2
3
4
5
xMat <- cbind(1, rnorm(n = 1000), rbinom(n = 1000, size=1, prob=0.5))
gMat <- matrix(data = rbinom(n=10000, size=2, prob=0.3), nrow=1000)
alphaVec <- c(1, 1, 1)
betaVec <- rep(0, 10)
sim_stats_mef(B=10000, sigSq = 1, xMat = xMat, gMat = gMat, alphaVec = alphaVec, betaVec = betaVec)

DBpower documentation built on Feb. 11, 2022, 1:08 a.m.