GumbelMixpValues: Calculate the p-values from an optimal mixture of Weibull...

View source: R/superPC_optimWeibull_pValues.R

GumbelMixpValuesR Documentation

Calculate the p-values from an optimal mixture of Weibull Extreme Value distributions for supervised PCA

Description

Calculate the p-values of test statistics from a mixture of two Weibull Extreme Value distributions.

Usage

GumbelMixpValues(tScore_vec, pathwaySize_vec, optimParams_vec)

Arguments

tScore_vec

A vector of the maximum absolute t-scores for each pathway (returned by the pathway_tScores function) when under the alternative model.

pathwaySize_vec

A vector of the number of genes in each pathway.

optimParams_vec

The NAMED vector of optimal Weibull Extreme Value mixture distribution parameters returned by the OptimGumbelMixParams function.

Details

The likelihood function is equation (4) in Chen et al (2008): a mixture of two Gumbel Extreme Value probability density functions, with mixing proportion p. Within the code of this function, the values mu1, mu2 and s1, s2 are placeholders for the mean and precision, respectively.

See https://doi.org/10.1093/bioinformatics/btn458 for more information.

Value

A named vector of the estimated raw p-values for each gene pathway.

See Also

OptimGumbelMixParams; pathway_tScores; SuperPCA_pVals

Examples

  # DO NOT CALL THIS FUNCTION DIRECTLY.
  # Use SuperPCA_pVals() instead.

## Not run: 
  ###  Load the Example Data  ###
  data("colon_pathwayCollection")
  n_int <- lengths(colon_pathwayCollection$pathways)


  ###  Simulate Maximum Absolute Control t-Values  ###
  # The SuperPCA algorithm defaults to 20 threshold values; the example
  #   pathway collection has 15 pathways.
  t_mat <- matrix(rt(15 * 20, df = 5), nrow = 15)

  absMax <- function(vec){
    vec[which.max(abs(vec))]
  }
  tAbsMax_num <- apply(t_mat, 1, absMax)


  ###  Calculate Optimal Parameters for the Gumbel Distribution  ###
  optParams_num <- OptimGumbelMixParams(
    max_tControl_vec = tAbsMax_num,
    pathwaySize_vec = n_int
  )


  ###  Simulate Maximum Absolute t-Values  ###
  tObs_mat <- matrix(rt(15 * 20, df = 3), nrow = 15)
  tObsAbsMax_num <- apply(tObs_mat, 1, absMax)


  ###  Calculate Observed-t-score p-Values  ###
  GumbelMixpValues(
    tScore_vec = tObsAbsMax_num,
    pathwaySize_vec = n_int,
    optimParams_vec = optParams_num
  )

## End(Not run)


gabrielodom/pathwayPCA documentation built on July 10, 2023, 3:32 a.m.