mc_pvalue {scanstatistics}R Documentation

Calculate the Monte Carlo pp-value for a scan statistic.

Description

Given an observed scan statistic λ\lambda^* and a vector of replicate scan statistics λi\lambda_i, i=1,,Ri=1,\ldots,R, calculate the Monte Carlo pp-value as

1+i=1RI(λi>λ)1+R \frac{1 + \sum_{i=1}^R \mathrm{I}(\lambda_i > \lambda^*)}{1 + R}

The function is vectorized, so multiple pp-values can be calculated if several scan statistics (e.g. statistics from secondary clusters) are supplied.

Usage

mc_pvalue(observed, replicates)

Arguments

observed

A scalar containing the observed value of the scan statistic, or a vector of observed values from secondary clusters.

replicates

A vector of Monte Carlo replicates of the scan statistic.

Value

The pp-value or pp-values corresponding to the observed scan statistic(s).


[Package scanstatistics version 1.1.1 Index]