gt.object class {globaltest} | R Documentation

## Class "gt.object" for storing the result of the function gt

### Description

The class gt.object is the output of a call to `gt`. It stores the information needed for various diagnostic plots.

### Slots

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

`result`:

  Object of class "matrix". The number of rows of this matrix is the number of tests performed. The matrix has at least the columns "p-value", "Statistic" "Expected", "Std.dev", and "#Cov".

`extra`:

  Object of class "data.frame". Holds additional information that may be added later about the tests performed, such as multiplicity-adjusted p-values (see `p.adjust`), alias names for tests and comparative proportions (see `comparative`).

`call`:

  The matched call to `gt`.

`functions`:

  A "list" of various functions used by the `covariates` and `subjects` functions and the various methods.

`subsets`:

  A "list" or "NULL". Stores the subsets tested, if more than one.

`structure`:

  A "list" or "NULL". Stores subset and superset relationships between the sets in the "subsets" slot.

`weights`:

  A "list" or "NULL". Stores the weight vectors used for testing, if more than one.

`alternative`:

  If `gt` was called with `x = TRUE`, stores the design matrix of the alternative hypothesis; "NULL" otherwise.

`null`:

  If `gt` was called with `x = TRUE`, stores the design matrix of the null hypothesis; "NULL" otherwise.

`directional`

  Stores the `directional` argument of the call to `gt`.

`legend`

  Object of class "list". Stores appropriate legends for the `covariates` and `subjects` plots.

`model`

  Object of class "character". Stores the model.

### Methods

show

  (gt.object): Prints the test results: p-value, test statistic, expected value of the test statistic under the null hypothesis, standard deviation of the test statistic under the null hypothesis, and number of covariates tested.

summary

  (gt.object): Prints the test results (as `show`) plus additional information on the model and the test.

p.value

  (gt.object): Extracts the p-values.

z.score

  (gt.object): Extracts z-score: (Test statistic - Expected value) / Standard deviation.

result

  (gt.object): Extracts the results matrix together with the additional (e.g. multiple testing) information in the `extra` slot.

extract

  (gt.object): Extracts the results matrix for the leaf nodes after a call to `link{covariates}`, with information on direction of association.

sort

  (gt.object): Sorts the pathways to increasing p-values. Equal p-values are sorted on decreasing z-scores.

"["

  (gt.object): Extracts results of one or more test results if multiple tests were performed. Identical to "[[".

"[["

  (gt.object): Extracts results of one or more test results if multiple tests were performed. Identical to "[".

length

  (gt.object): The number of tests performed.

size

  (gt.object): Extracts a vector with the number of alternative covariates tested for each test.

names

  (gt.object): Extracts the row names of the results matrix.

names<-

  (gt.object): Changes the row names of the results matrix. Duplicate names are not allowed, but see `alias`.

alias

  (gt.object): Extracts the "alias" column of the results matrix that can be used to add additional information on each test perfomed.

alias<-

  (gt.object): Changes the "alias" column of the results matrix. Note that unlike for names, duplicate aliases are allowed.

weights

  (gt.object): extracts the effective weights of the covariates as they are used internally by the test.

subsets

  (gt.object): extracts the "subsets" slot.

hist

  (gt.object): Produces a histogram to visualize the permutation test statistics. Only relevant after permutation testing.

covariates

  (gt.object): Produces a plot to show the influence of individual covariates on the test result. See `covariates` for details.

subjects

  (gt.object): Produces a plot to show the influence of individual subjects on the test result. See `subjects` for details.

p.adjust

  (gt.object): Performs multiple testing correction and produces multiplicity-corrected p-values. See `p.adjust` for details.

comparative

  (gt.object): Compares the p-values of tests performed on a subsets or weights with p-values of random subsets of covariates of same size or randomly distributed weights. See `comparative` for details.

sterms

  (gt.object): Prints the smooth terms specified by `gtPS`, `gtKS` or `gtLI`.

### Author(s)

Jelle Goeman: j.j.goeman@lumc.nl; Jan Oosting

### See Also

`gt`, `covariates`, `subjects`.

### Examples

        # Simple examples with random data here
        # Real data examples in the Vignette

        # Random data: covariates A,B,C are correlated with Y
        Y <- rnorm(20)
        X <- matrix(rnorm(200), 20, 10)
        X[,1:3] <- X[,1:3] + 0.5*Y
        colnames(X) <- LETTERS[1:10]

        # Make a gt.object
        sets <- list(odd = c(1,3,5,7,9), even = c(2,4,6,8,10))
        res <- gt(Y, X, subsets=sets)

        # Show the results
        res
        summary(res)
        sort(res)
        p.value(res)
        subsets(res)

        # Names
        names(res)
        names(res) <- c("ODD", "EVEN")
        alias(res) <- c("odd covariates", "even covariates")

        # Multiple testing
        p.adjust(res, method = "holm")
        p.adjust(res, method = "BH")

        # Diagnostics
        weights(res)
        covariates(res[1])
        extract(covariates(res[1]))
        subjects(res[1])

        # Permutation testing
        res <- gt(Y, X, perm = 1e4)
        hist(res)

[Package globaltest version 5.46.0 Index]