ezglm: Selects a significant non-additive interaction between two...

Description Usage Arguments Details Value Author(s) Examples

View source: R/ezglm.R

Description

Selects a significant non-additive interaction between two variables using a fast GLM implementation.

Usage

1
ezglm(y, x1, x2, thr = 1, family=c("gaussian","binomial"))

Arguments

y

response variable, of length n. This argument should be quantitative for least squares, and a two-level factor for logistic regression.

x1

the first predictor, of length n.

x2

the second predictor, of length n.

thr

p-value tolerance. Truncate any p-value to 1 if it is larger than thr. Defaults value is 1.

family

a character string specifying the model to use, valid options are:

  • "gaussian" least squares regression (regression),

  • "binomial" logistic regression (classification).

Default is "gaussian".

Details

Motivated by pairwise gene interaction selection in genome-wide association study (GWAS), this package implements fast and simplified least squares, and logistic regression for efficiently selecting a significant non-additive interaction between two variables. Once user specifies the response variable y and predictors x1 and x2, then a least squares model ("gaussian") y ~ x1 + x2 + x1*x2 or a logistic regression ("binomial") logit ~ x1 + x2 + x1*x2 is fitted. Users can then select the significant x1*x2 term using returned Wald test p-value.

Value

A matrix of coefficients.

Author(s)

Yi Yang
Maintainer: Yi Yang <[email protected]>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
n = 10000
x1 = rnorm(n)
x2 = rnorm(n)
y1 = sample(c(0,1),n,rep=TRUE)
y2 = rnorm(n)

system.time(m1 <- ezglm(y1, x1, x2, 1, family = "binomial"))
m1

system.time(m2 <- glm(y1~x1+x2+x1*x2, family = binomial))
summary(m2)$coef

system.time(m3 <- ezglm(y2, x1, x2, 1, family = "gaussian"))
m3

system.time(m4 <- glm(y2~x1+x2+x1*x2, family = gaussian))
summary(m4)$coef

emeryyi/ezglm documentation built on May 13, 2017, 5:11 p.m.