fast.sim: Perform 'fast.test' on simulated data

Description Usage Arguments Value Examples

View source: R/fast.sim.R

Description

fast.sim efficiently performs fast.test on a simulated data set. The function is meant to be used internally by the fast.test function, but is informative for better understanding the implementation of the test.

Usage

1
fast.sim(nsim = 1, ty, ex, pop, ubpop, type = "poisson", cl = NULL)

Arguments

nsim

A positive integer indicating the number of simulations to perform.

ty

The total number of cases in the study area.

ex

The expected number of cases for each region. The default is calculated under the constant risk hypothesis.

pop

The population size associated with each region.

ubpop

The upperbound of the proportion of the total population to consider for a cluster.

type

The type of scan statistic to compute. The default is "poisson". The other choice is "binomial".

cl

A cluster object created by makeCluster, or an integer to indicate number of child-processes (integer values are ignored on Windows) for parallel evaluations (see Details on performance).

Value

A vector with the maximum test statistic for each simulated data set.

Examples

1
2
3
4
5
6
7
data(nydf)
coords = with(nydf, cbind(longitude, latitude))
cases = floor(nydf$cases)
pop = nydf$pop
ty = sum(cases)
ex = ty/sum(pop) * pop
tsim = fast.sim(1, ty, ex, pop = pop, ubpop = 0.5)

smerc documentation built on Oct. 1, 2021, 5:07 p.m.