Calculate (signed) Kolgomorov-Smirnov enrichment p-value in dataframe
Source:R/stats.R
get_kspval.Rd
If no group of interest specified, pulls first condition against others.
Usage
get_kspval(
df,
value,
group,
goi = NULL,
rep0 = .Machine$double.xmin,
signed = FALSE,
viz = FALSE
)
Arguments
- df
df; has columns
value
andgroup
,NA
values are filtered out- value
string; colname of values to rank by
- group
string; colname of categorizations
- goi
group of interest value within
df[,group]
- rep0
numeric; value to replace
0
results with- signed
logical;
TRUE
to return GSEA-style enrichment score as second element of list:ks_pval[1] = pval
,ks_pval[1] = ES
- viz
logical;
TRUE
to output density plot of values
Details
Signed ES score adapted from franapoli/signed-ks-test which is based on GSEA enrichment score calculation.
Positive ES
indicates that by rank, the goi
are "left" of / smaller than the rest of the values, while negative ES
indicates the goi
is "right" of / greater than the rest of values. Use viz = TRUE
to visualize the values and resulting KS p-value.