single.marker.test {ARTP} | R Documentation |
Perform an association test for 1 SNP
single.marker.test(y, covariates, weights, offset, control, snpcol, min.count=5, y.continuous=FALSE)
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 |
snpcol |
Number of columns of the design matrix |
min.count |
The minimum number of subjects to have in at least 2 of the genotype categories (0-1-2),
if |
y.continuous |
TRUE or FALSE for whether or not |
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 |
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.
Kai Yu and Qizhai Li
# 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)