Check that spicy() is calibrated on your data by shuffling the condition
Source:R/calibrationCheck.R
calibrationCheck.RdShuffles the condition across patients (or across images, without subject), which removes any real difference
between the groups while keeping everything else about the study, and runs spicy() on each shuffle. If the test
is calibrated, about 5% of pairs have p < 0.05 and about 1% p < 0.01 in each shuffle. Pairs share cells, so the
percentage moves by a few points from one shuffle to the next; look at the average over shuffles.
Arguments
- cells
The cells, as for
spicy(): aSpatialExperiment,SingleCellExperimentordata.frame(not a store).- condition
The column of the condition to shuffle (a factor, character, number or
Survcolumn).- subject
The column of the patient. Each patient keeps one condition, moved as a whole; without it, the condition is shuffled across images.
- nShuffles
The number of shuffles.
- thresholds
The p-value thresholds to report.
- ...
Other arguments of
spicy(), such asr,imageID,cellTypeorcovariates.- object, x
The result of
calibrationCheck().
Value
A data.frame with one row per shuffle and threshold: shuffle, threshold and percent, the
percentage of pairs whose p-value is below the threshold. summary() gives the average percentage over the
shuffles at each threshold, with the expected one, and plot() shows each shuffle against the expected
percentage.
