GE_translate_inputs_old: GE_translate_inputs_old.R

View source: R/GE_translate_inputs_old.R

GE_translate_inputs_oldR Documentation

GE_translate_inputs_old.R

Description

Mostly for internal use, function called by GE_bias_normal_old() and GE_scoreeq_sim_old() to translate the rho_list inputs and return a total covariance matrix for simulation/ checking validity of covariance structure. If invalid covariance structure, will stop and return an error message.

Usage

GE_translate_inputs_old(beta_list, rho_list, prob_G, cov_Z = NULL,
  cov_W = NULL)

Arguments

rho_list

A list of the 6 pairwise covariances between the covariates. These should be in the order (1) cov_GE (2) cov_GZ (3) cov_EZ (4) cov_GW (5) cov_EW (6) cov_ZW. If Z or M are vectors then terms like cov_GZ should be vectors (in the appropriate order). If Z or M are vectors, then cov_ZW should be a vector in the order (cov(Z_1,W_1),...,cov(Z_1,W_q), cov(Z_2,W_1),........,cov(Z_p,W_q) where Z is a vector of length p and W is a vector of length q.

prob_G

Probability that each allele is equal to 1. Since each SNP has two alleles, the expectation of G is 2*prob_G.

cov_Z

Only used if Z is a vector, gives the covariance matrix of Z (remember by assumption Z has mean 0 and variance 1). The (i,j) element of the matrix should be the (i-1)(i-2)/2+j element of the vector.

cov_W

Only used if W is a vector, gives the covariance matrix of W (remember by assumption W has mean 0 and variance 1). The (i,j) element of the matrix should be the (i-1)(i-2)/2+j element of the vector.

Value

A list with the elements:

sig_mat_total

The sigma parameter for rmvnorm call to generate our data.

sig_mat_ZZ

The covariance matrix of Z, i.e. E[ZZ^T]

sig_mat_WW

The covariance matrix of W, i.e. E[WW^T]

Examples

GE_translate_inputs_old( beta_list=as.list(runif(n=6, min=0, max=1)), 
						rho_list=as.list(rep(0.3,6)), prob_G=0.3)

GEint documentation built on May 18, 2022, 9:05 a.m.