Pick {cherry}R Documentation

Confidence limits for the number of true hypotheses.

Description

Calculates confidence limits for the number of true hypotheses on the basis of the closed testing procedure.

Usage

 pick (closure, reject, alpha, silent=FALSE, plot=FALSE) 

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

alpha

For closure objects with adjusted p-values, specifies the value of alpha for which confidence limits are to be calculated (optional).

silent

If FALSE, prints the result to the screen.

plot

Whether a a confidence distribution should be plotted. Only available for closure objects with adjusted p-values.

Details

The function pick calculates a confidence interval for the number of true hypotheses among a selected set of hypotheses.

Value

The function returns the upper confidence limit for the number of true hypotheses among the set reject. The lower confidence limit is always equal to 0. If closed was called with alpha=NA, a confidence distribution is plotted and returned.

Author(s)

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

Examples

  # Example: the birthwt data set from the MASS library
  # We want to find variables associated with low birth weight
  library(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
  cl <- closed(mytest, hypotheses)
  summary(cl)

  # how many variables among a chosen set are associated with the response?
  pick(cl, c("ht", "lwt", "smoke", "ui"))

[Package cherry version 0.6-14 Index]