extract_results: Extract the results from running the multiple imputations

View source: R/extract_results.R

extract_resultsR Documentation

Extract the results from running the multiple imputations

Description

Does p-value correction and then binomial testing on a given decision. Could be a hybrid decision on both p-value and LFC. Assumes that the decision for each imputation and feature can be considered a bernoulli trial. Therefore, the sum of decisions from all imputations has a binomial distribution. It therefore implements a right-tailed binomial testing with default null hypothesis p = 0.5. It uses the right tail because significant features are expected to have a larger p then the null hypothesis.

Usage

extract_results(
  results,
  data,
  alpha = 0.05,
  abs_lfc = 1,
  pcor = stats::p.adjust.methods,
  id_col = "id",
  null_hyp = 0.5
)

Arguments

results

The output from run_pipeline.

data

The data used to generate the results when calling run_pipeline.

alpha

The alpha value to decide when a feature is significant.

abs_lfc

If a LFC cut-off values should be used in addition to the alpha value.

pcor

A p-value correction method, has to be one from p.adjust.

id_col

a character for the name of the column containing the name of the features in data (e.g., peptides, proteins, etc.).

null_hyp

The value for the null hypothesis of the binomial-test. Needs to be between 0 and 1.

Value

A tibble with a summary of the results. From all imputations it calculates the binomial p-value, the median: LFC, p-value (from all testing), and the mean in each comparison. It also returns a character column, comparison, that indicates what comparison the results come from and a boolean column, imputed, indicating if there was any imputed value or not.

Examples

# Generate a design matrix for the data
design <- model.matrix(~ 0 + factor(rep(1:2, each = 3)))

# Set correct colnames, this is important for fit_gamma_*
colnames(design) <- paste0("ng", c(50, 100))

# Generate the contrast matrix
contrast <- limma::makeContrasts(
  contrasts = "ng100-ng50",
  levels = design
)

# Normalize and log-transform the data
yeast <- psrn(yeast, "identifier")
## Not run: 
results <- run_pipeline(yeast, design, contrast, 1000, 5, "identifier", TRUE)
extract_results(yeast, results, .05, 1, "fdr", "identifier")

## End(Not run)

PhilipBerg/PaiR documentation built on March 18, 2022, noon