Comparing the result of a global test performed on a subset to the test results of random subsets of the same size.
Usage
comparative(object, N = 1e3, z.scores = TRUE, trace)
Arguments
object
A gt.object, usually one in which one or more subsets of a large number of covariates were tested.
N
The number of random subsets to generate.
z.scores
If set to TRUE, compares the subset to random subsets on the basis of the z-scores of the test. If FALSE, uses the p-values instead.
trace
If set to TRUE, reports progress information. The default is to set trace to TRUE if R is in interactive mode and more than one comparative proportion is to be calculated.
Details
In a situation when many covariates out of a large set are associated with the response, it is sometimes interesting to know p-value of the tested subset compares to random subsets of the same size. The comparative function calculates the proportion of random subsets of the covariates of the same size as the tested subset that have a better score than the tested subset. This proportion is a diagnostic tool to help interpret the test result; it should not be interpreted as a p-value.
Value
An object of class gt.object with an appropriate column added to the test results matrix.
The comparative proportion is an enrichment type analysis. For the pros and cons of such an analysis, see
Goeman and Buhlmann (2007) Analyzing gene expression data in terms of gene sets: methodological issues. Bioinformatics 23 (8) 980-987.
See Also
The gt function. The gt.object function and useful functions associated with that object.
Examples
# Simple examples with random data here
# Real data examples in the Vignette
# Random data: covariates A,B,C are correlated with Y
set.seed(1)
Y <- rnorm(20)
X <- matrix(rnorm(200), 20, 10)
X[,1:3] <- X[,1:3] + Y
colnames(X) <- LETTERS[1:10]
# Some subsets of interest
my.sets <- list(c("A", "B"), c("C","D"), c("D", "E"))
# Comparative proportions
res <- gt(Y, X, subsets = my.sets)
comparative(res)
comparative(res, z.scores=FALSE)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(globaltest)
Loading required package: survival
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/globaltest/comparative.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Comparative proportions
> ### Title: Comparative proportions for the Global Test
> ### Aliases: comparative
> ### Keywords: htest
>
> ### ** Examples
>
> # Simple examples with random data here
> # Real data examples in the Vignette
>
> # Random data: covariates A,B,C are correlated with Y
> set.seed(1)
> Y <- rnorm(20)
> X <- matrix(rnorm(200), 20, 10)
> X[,1:3] <- X[,1:3] + Y
> colnames(X) <- LETTERS[1:10]
>
> # Some subsets of interest
> my.sets <- list(c("A", "B"), c("C","D"), c("D", "E"))
>
> # Comparative proportions
> res <- gt(Y, X, subsets = my.sets)
> comparative(res)
comparative p-value Statistic Expected Std.dev #Cov
1 0.026 2.05e-07 58.42 5.26 5.58 2
2 0.365 7.07e-03 27.54 5.26 5.81 2
3 0.653 2.38e-01 7.76 5.26 5.02 2
> comparative(res, z.scores=FALSE)
comparative p-value Statistic Expected Std.dev #Cov
1 0.022 2.05e-07 58.42 5.26 5.58 2
2 0.363 7.07e-03 27.54 5.26 5.81 2
3 0.637 2.38e-01 7.76 5.26 5.02 2
>
>
>
>
>
> dev.off()
null device
1
>