Learn R Programming

cherry (version 0.6-15)

Adjusted: Adjusted p-values for the number of true hypotheses.

Description

Calculates adjusted p-values for the number of true hypotheses on the basis of the closed testing procedure.

Usage

adjusted (closure, reject, n=0)

Value

The function returns a p-value (numeric).

Arguments

closure

An object of class closure, typically created through a call to closed .

reject

A character vector identifying the hypotheses to be rejected. Must be a subvector of hypotheses(closure).

n

The maximum number of false null hypotheses allowed.

Author

Jelle Goeman: j.j.goeman@lumc.nl

Details

The function pick calculates adjusted p-values for intersection hypotheses of interest.

Examples

Run this code
  # Example: the birthwt data set from the MASS library
  # We want to find variables associated with low birth weight
  if (require(MASS)) {
    fullfit <- glm(low~age+lwt+race+smoke+ptl+ht+ui+ftv, family=binomial, data=birthwt)
    hypotheses <- c("age", "lwt", "race", "smoke", "ptl", "ht", "ui", "ftv")
  
    # Define the local test to be used in the closed testing procedure
    mytest <- function(hyps) {
      others <- setdiff(hypotheses, hyps)
      form <- formula(paste(c("low~",  paste(c("1", others), collapse="+"))))
      anov <- anova(glm(form, data=birthwt, family=binomial), fullfit, test="Chisq")
      res <- anov$"Pr("[2]                    # for R >= 2.14.0
      if (is.null(res)) res <- anov$"P("[2]   # earlier versions
      res
    }
  
    # Perform the closed testing with ajdusted p-values
    cl <- closed(mytest, hypotheses, alpha=NA)
  
    # What is the adjusted p-value of the intersection of the following hypotheses?
    adjusted(cl, c("ht", "lwt", "smoke", "ui"))
  
    # From what confidence level would we conclude 
    # that more than 2 of the following hypotheses would be false?
    adjusted(cl, c("ht", "lwt", "smoke", "ui"), n=2)
  }

Run the code above in your browser using DataLab