single.marker.test: Single SNP test

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/wga_permReg.R

Description

Perform an association test for 1 SNP

Usage

1
2
single.marker.test(y, covariates, weights, offset, control, snpcol,
                   min.count=5, y.continuous=FALSE)

Arguments

y

The response vector

covariates

A design matrix where the SNP is the last column. The SNP must be coded as 0-1-2.

weights

Vector of weights.

offset

Vector for the offset.

control

List for glm.control

snpcol

Number of columns of the design matrix covariates

min.count

The minimum number of subjects to have in at least 2 of the genotype categories (0-1-2), if y is continuous. If y is binary, then the minimum expected frequency count for cases or controls to use logistic regression; otherwise, Fisher's exact test will be used. The default is 5

y.continuous

TRUE or FALSE for whether or not y is continuous. If FALSE, then y must be coded as 0-1. The default is FALSE.

Details

The input vectors and matrices must not contain missing values. To compute the p-value, either glm.fit, fisher.test or lm is called. The p-value flag is a value for how the p-value was computed:

Value Genetic Model Test
0 trend Wald test from logistic/linear regression
-1 dominant Fisher's exact test
-2 recessive Fisher's exact test
1 dominant Wald test from logistic regression
2 recessive Wald test from logistic regression

Value

The returned object is a vector of length 4 containing the p-value, p-value flag (see details), SNP main effect estimate, and standard error of the SNP main effect estimate. If Fisher's exact test was used, then the main effect and standard error will be set to NA.

Author(s)

Kai Yu and Qizhai Li

See Also

runPermutations

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
  # Generate data
  set.seed(123)
  n <- 1000
  y <- rbinom(n, 1, 0.5)
  snp <- rbinom(n, 2, 0.4)
  weights <- rep.int(1, times=n)
  offset  <- rep.int(0, times=n)
  control  <- glm.control()
 
  # Create a design matrix
  x <- matrix(data=NA, nrow=n, ncol=3)
  x[, 1] <- 1  # Intercept column
  x[, 2] <- runif(n) # Continuous covariate
  x[, 3] <- snp

  single.marker.test(y, x, weights, offset, control, 3)

ARTP documentation built on May 2, 2019, 6:51 a.m.