Calculate the Monte Carlo \(p\)-value for a scan statistic.
Source:R/scanstatistics_general.R
mc_pvalue.Rd
Given an observed scan statistic \(\lambda^*\) and a vector of replicate scan statistics \(\lambda_i\), \(i=1,\ldots,R\), calculate the Monte Carlo \(p\)-value as $$ \frac{1 + \sum_{i=1}^R \mathrm{I}(\lambda_i > \lambda^*)}{1 + R} $$ The function is vectorized, so multiple \(p\)-values can be calculated if several scan statistics (e.g. statistics from secondary clusters) are supplied.