getWaldTest: Compute a Wald test

Description Usage Arguments Details Value Examples

View source: R/wga_stat.R

Description

Computes a univariate or multivariate Wald test

Usage

1
 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.

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.

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
  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)

CGEN documentation built on April 28, 2020, 8:08 p.m.