ihwResult-class {IHW} | R Documentation

## An S4 class to represent the ihw output.

### Description

An S4 class to represent the ihw output.

### Usage

    adj_pvalues(object)

    ## S4 method for signature 'ihwResult'
    adj_pvalues(object)

    ## S4 method for signature 'ihwResult'
    weights(object, levels_only = FALSE)

    thresholds(object, ...)

    ## S4 method for signature 'ihwResult'
    thresholds(object, levels_only = FALSE)

    pvalues(object)

    ## S4 method for signature 'ihwResult'
    pvalues(object)

    weighted_pvalues(object)

    ## S4 method for signature 'ihwResult'
    weighted_pvalues(object)

    covariates(object)

    ## S4 method for signature 'ihwResult'
    covariates(object)

    covariate_type(object)

    ## S4 method for signature 'ihwResult'
    covariate_type(object)

    groups_factor(object)

    ## S4 method for signature 'ihwResult'
    groups_factor(object)

    nfolds(object)

    ## S4 method for signature 'ihwResult'
    nfolds(object)

    nbins(object)

    ## S4 method for signature 'ihwResult'
    nbins(object)

    alpha(object)

    ## S4 method for signature 'ihwResult'
    alpha(object)

    rejections(object, ...)

    ## S4 method for signature 'ihwResult'
    rejections(object)

    rejected_hypotheses(object, ...)

    ## S4 method for signature 'ihwResult'
    rejected_hypotheses(object)

    regularization_term(object)

    ## S4 method for signature 'ihwResult'
    regularization_term(object)

    m_groups(object)

    ## S4 method for signature 'ihwResult'
    m_groups(object)

    as.data.frame_ihwResult(x, row.names = NULL, optional = FALSE, ...)

    ## S4 method for signature 'ihwResult'
    as.data.frame(x, row.names = NULL, optional = FALSE,
      ...)

    ## S4 method for signature 'ihwResult'
    nrow(x)

    ## S4 method for signature 'ihwResult'
    show(object)

### Arguments

`object, x` | A ihwResult object as returned by a call to ihw(...)
`levels_only` | Logical, if FALSE, return a vector of weights (thresholds) with one weight (threshold) for each hypothesis, otherwise return a nfolds x nbins matrix of weights (thresholds)
`...` | Parameters passed in to individual methods
`row.names, optional` | See ?base::as.data.frame for a description of these arguments.

### Value

The different methods applied to an ihwResult object can return the following:

1) A vector of length equal to the number of hypotheses tested (e.g. the adjusted p-value or the weight of each hypothesis).

2) A matrix of dimension equal to nfolds x nbins (e.g. the weight of each stratum, fold combination, set by specifying levels_only=TRUE).

3) A vector of length 1 (usually a parameter of the ihwResult object such as nfolds or the total number of rejections).

4) A data.frame (as.data.frame) or just console output (show) for the extended Base generics.

See section below for the individual methods.

### Methods (by generic)

- `adj_pvalues`: Extract adjusted pvalues

- `weights`: Extract weights

- `thresholds`: Calculate ihw thresholds

- `pvalues`: Extract pvalues

- `weighted_pvalues`: Extract weighted pvalues

- `covariates`: Extract covariates

- `covariate_type`: Extract type of covariate ("ordinal" or "nominal")

- `groups_factor`: Extract factor of stratification (grouping) variable

- `nfolds`: Extract number of folds

- `nbins`: Extract number of bins

- `alpha`: Extract nominal significance (alpha) level

- `rejections`: Total number of rejected hypotheses by ihw procedure

- `rejected_hypotheses`: Get a boolean vector of the rejected hypotheses

- `regularization_term`: Extract vector of regularization parameters used for each stratum

- `m_groups`: Extract total number of hypotheses within each stratum

- `as.data.frame`: Coerce ihwResult to data frame

- `nrow`: Return number of p-values

- `show`: Convenience method to show ihwResult object

### Slots

`df`

  A data.frame that collects the input data, including the vector of p values and the covariate, the group assignment, as well as outputs (weighted p-values, adjusted p-values)

`weights`

  A (nbins X nfolds) matrix of the weight assigned to each stratum

`alpha`

  Numeric, the nominal significance level at which the FDR is to be controlled

`nbins`

  Integer, number of distinct levels into which the hypotheses were stratified

`nfolds`

  Integer, number of folds for pre-validation procedure

`regularization_term`

  Numeric vector, the final value of the regularization parameter within each fold

`m_groups`

  Integer vector, number of hypotheses tested in each stratum

`penalty`

  Character, "uniform deviation" or "total variation"

`covariate_type`

  Character, "ordinal" or "nominal"

`adjustment_type`

  Character, "BH" or "bonferroni"

`reg_path_information`

  A data.frame, information about the whole regularization path. (Currently not used, thus empty)

`solver_information`

  A list, solver specific output, e.g. were all subproblems solved to optimality? (Currently empty list)

### See Also

ihw, plot,ihwResult-method

### Examples

    save.seed <- .Random.seed; set.seed(1)
    X   <- runif(n = 20000, min = 0.5, max = 4.5)       # Covariate
    H   <- rbinom(n = length(X), size = 1, prob = 0.1)  # Is the null hypothesis (mean=0) true or false ?
    Z   <- rnorm(n = length(X), mean = H * X)           # Z-score
    .Random.seed <- save.seed

    pvalue <- 1 - pnorm(Z)                              # pvalue
    ihw_res <- ihw(pvalue, covariates = X, alpha = 0.1)
    rejections(ihw_res)
    colnames(as.data.frame(ihw_res))

[Package IHW version 1.18.0 Index]