olink_one_non_parametric_posthoc {OlinkAnalyze} | R Documentation |
Function which performs posthoc test per protein for the results from Friedman or Kruskal-Wallis Test.
Description
Performs a posthoc test using rstatix::wilcox_test or FSA::dunnTest with Benjamini-Hochberg p-value adjustment per assay (by OlinkID) for each panel at confidence level 0.95.
See olink_one_non_parametric
for details of input notation.
The function handles both factor and numerical variables.
Usage
olink_one_non_parametric_posthoc(
df,
olinkid_list = NULL,
variable,
test = "kruskal",
verbose = TRUE
)
Arguments
df |
NPX data frame in long format with at least protein name (Assay), OlinkID, UniProt, Panel and a factor with at least 3 levels. |
olinkid_list |
Character vector of OlinkID's on which to perform post hoc analysis. If not specified, all assays in df are used. |
variable |
Single character value or character array. |
test |
Single character value indicates running the post hoc test for friedman or kruskal. |
verbose |
Boolean. Default: True. If information about removed samples, factor conversion and final model formula is to be printed to the console. |
Value
Tibble of posthoc tests for specified effect, arranged by ascending adjusted p-values.
Columns include:
Assay: "character" Protein symbol
OlinkID: "character" Olink specific ID
UniProt: "character" UniProt ID
Panel: "character" Name of Olink Panel
term: "character" term in model
contrast: "character" the groups that were compared
estimate: "numeric" the value of the test statistic with a name describing it
Adjusted_pval: "numeric" adjusted p-value for the test
Threshold: "character" if adjusted p-value is significant or not (< 0.05)
Examples
library(dplyr)
try({ # May fail if dependencies are not installed
# One-way Kruskal-Wallis Test
kruskal_results <- olink_one_non_parametric(df = npx_data1,
variable = "Site")
})
#Friedman Test
friedman_results <- olink_one_non_parametric(df = npx_data1,
variable = "Time",
subject = "Subject",
dependence = TRUE)
#Posthoc test for the results from Friedman Test
friedman_posthoc_results <- olink_one_non_parametric_posthoc(npx_data1,
variable = "Time",
test = "friedman",
olinkid_list = {friedman_results %>%
filter(Threshold == 'Significant') %>%
dplyr::select(OlinkID) %>%
distinct() %>%
pull()})