env_interaction.calc {gnonadd}R Documentation

Variant-Environmental interaction effects

Description

This function estimates the interaction effect of a genetic variant with an environmental factor on a quantitatvie trait We apply a simple linear regression model to estimate interaction effects. We include a linear term for the variant and environmental variable seperately. The variant is coded as 0,1 and 2 for non-carriers, heterozygotes and homozygous carriers of the effect allele. The environmental variable is rank-normalized automatically as part of the function. The interaction term is defined as the product of the genetic and the (normalized) environmental variables. Effect size and significance is based on the interaction term.

Usage

env_interaction.calc(
  qt,
  g,
  env,
  round_imputed = FALSE,
  dominance_term = FALSE,
  square_env = FALSE,
  covariates = as.data.frame(matrix(0, nrow = 0, ncol = 0))
)

Arguments

qt

A numeric vector

g

A vector with (possibly imputed) genotype values. All entries should be larger than 0 and smaller than 2.

env

A numeric vector with an environmental variable

round_imputed

A boolian variable determining whether imputed genotype values should be rounded to the nearest integer in the analysis.

dominance_term

A boolian variable determining whether a dominance term for the variant should be included as a covariates in the analysis

square_env

A boolian variable determining whether the square of the environmental trait should be included as a covariate in the analysis

covariates

A dataframe containing any other covariates that should be used; one column per covariate

Value

A list with the environmental interaction effect and corresponding standard error, t statistic and p-value

Examples

g_vec <- rbinom(100000, 2, 0.1)
env_vec <- round(runif(100000,min=0,max=6))
qt_vec <- rnorm(100000) + 0.1 * g_vec + 0.05 * env_vec + 0.05 * g_vec * env_vec
res <- env_interaction.calc(qt_vec, g_vec, env_vec)

[Package gnonadd version 1.0.2 Index]