P_correlation: Testing P-value distribution

View source: R/script_v12-3_package.R

P_correlationR Documentation

Testing P-value distribution

Description

A sub-function of EWAS_QC that tests if the reported p-values match the p-value that can be derived from the effect-size and standard error values. Aberrations between these indicate that the p-values have been adjusted, or that there is some other problem with the data. It also creates a plot of reported vs. expected p-values that shows the correlation.

Usage

  P_correlation(dataset,
                plot_correlation = TRUE,
                plot_if_threshold = FALSE,
                threshold_r = 0.99,
                high_quality_plots = FALSE,
                save_name = "dataset",
                header_translations, ...)

Arguments

dataset

a data frame with the columns BETA (effect size), SE (standard error), and P_VAL (p value). If the column names differ from the above, the argument header_translations can be used to translate them.

plot_correlation

logical, determines whether a graph is made of reported vs. expected p values.

plot_if_threshold

logical. If TRUE, the plot is only generated if the p-value correlation is below the specified threshold.

threshold_r

numeric. If the p-value correlation is below this, a warning is generated.

high_quality_plots

logical. Setting this to TRUE will save the graph as a high-resolution tiff image.

save_name

character string used for the output file. Do not add an extension; P_correlation will do so automatically.

header_translations

a translation table for the header of dataset. See translate_header for details.

...

arguments passed to the generic plot function.

Details

P_correlation is primarly a subfunction of EWAS_QC, but it can be used separately.

Value

P_correlation returns a single numeric value, representing the correlation between reported and expected p-values.


QCEWAS documentation built on Feb. 16, 2023, 10:30 p.m.