Learn R Programming

cherry (version 0.6-14)

Region class: Class "region" for storing the result of the region procedure

Description

The class region is the output of a call to regionmethod. It stores which region hypotheses have been rejected and can be used to calculate confidence sets for the number of true and/or false hypotheses among a selected region.

Arguments

Slots

These slots are not meant to be directly accessed by the user.

weights:

Object of class "numeric". Stores the weights of elementary hypotheses.

isadjusted:

Object of class "logical". Stores whether adjusted p-values are calculated.

allpvalues:

Object of class "matrix". Stores (adjusted) p-values for all possible region hypotheses. Has value NA if adjusted p-value is larger than alpha. Corresponds to a 0x0 matrix if all_pvalues is set to FALSE (by default).

implications:

Object of class "matrix". Stores implications includinge (adjusted) p-values at chosen alpha-level

alpha:

Object of class "numeric". The type I error level chosen.

totalrejected:

Object of class "numeric". Stores the total number of rejected region hypotheses.

Methods

show

(region): Prints how many region hypotheses were tested and how many of them were rejected.

summary

(region): Prints the test results (as show).

alpha

(region): Retrieves the maximal alpha_value from the region object.

implications

(region,alpha): Retrieves the implications from a given region object. By default, the alpha-level is set to alpha_max, but the alpha level can be varied, if the supporting information is present in the region object.

pvalue

(region,left,right): Retrieves pvalues for all possible region hypotheses (indicated with left and right bound) from the region object. Only able to return the value if the allpvalues matrix is stored in the region object.

See Also

regionmethod, regionpick.

Examples

Run this code
# NOT RUN {
#generate data, where the response Y is associated with certain groups of covariates
#namely cov 3-6, 9-12, 15-18
set.seed(1)
n=100
p=20
X <- matrix(rnorm(n*p),n,p)
beta <- c(rep(0,2),rep(1,4),rep(0,2),rep(1,4),rep(0,2),rep(1,4),rep(0,2))
Y <- X %*% beta + rnorm(n)

# Define the local test to be used in the closed testing procedure
mytest <- function(left,right)
{
  X <- X[,(left:right),drop=FALSE]
  lm.out <- lm(Y ~ X)
  x <- summary(lm.out)
  return(pf(x$fstatistic[1],x$fstatistic[2],x$fstatistic[3],lower.tail=FALSE))  
}

# perform the region procedure
reg <- regionmethod(rep(1,p), mytest, isadjusted=TRUE, all_pvalues=TRUE)
summary(reg)

#what are the smallest regions that are found to be significant? 
implications(reg)

#what are the smallest regions that are found to be significant at an alpha-level of 0.03? 
implications(reg, alpha=0.03)

#what is the adjusted p-value of the overall null-hypothesis 
#(corresponding to the region ranging from 1 to 20)?
pvalue(reg,1,20)

#how many covariates within the full region of length 20 are at least associated with the response?
regionpick(reg, list(c(1,p)), alpha=0.05)

#visualize the results by either plotting a polygon corresponding to the underlying graph
regionplot(reg)

#or by plotting the graph itself
regionplot2(reg)
# }

Run the code above in your browser using DataLab