Learn R Programming

CGEN (version 3.8.0)

getWaldTest: Compute a Wald test

Description

Computes a univariate or multivariate Wald test

Usage

getWaldTest(fit, parmNames, method=NULL)

Arguments

fit
Return object from snp.logistic, snp.matched, glm() or a list with names "parms" and "cov" (see details). No default.
parmNames
Vector of parameters to test. This vector can be a character vector of parameter names or a numeric vector of positions. No default.
method
Vector of values from "UML", "CML", "EB" or "CCL", "HCL", "CLR". The default is NULL.

Value

List containing the value of the test statistic (test), degrees of freedom (df), and p-value (pvalue).

Details

If fit is a list, then "parms" should be the vector of coefficients, and "cov" should be the covariance matrix. If parmNames is a character vector, then "parms" should be a named vector and the names must match the rownames and colnames of "cov". A chi-squared test is computed.

Examples

Run this code
  set.seed(123)
  n <- 100
  y <- rbinom(n, 1, 0.5)
  x <- runif(n*5)
  dim(x) <- c(n, 5)
  x <- data.frame(x)
  colnames(x) <- c("x", "x2", "x3", "z", "z2")
  fit <- glm(y ~ ., data=x, family=binomial())

  # Chi-squared test 
  getWaldTest(fit, c("x", "z")) 

  beta <- c(-2.5, 2.5)
  cov  <- diag(1:2)
  getWaldTest(list(parms=beta, cov=cov), 1:2)

Run the code above in your browser using DataLab