uls.test
on simulated datauls.sim
efficiently performs
uls.test
on a simulated data set. The
function is meant to be used internally by the
uls.test
function, but is informative for
better understanding the implementation of the test.
uls.sim(
nsim = 1,
ty,
ex,
w,
pop,
ubpop,
type = "poisson",
check.unique = FALSE,
cl = NULL
)
A vector with the maximum test statistic for each simulated data set.
A positive integer indicating the number of simulations to perform.
The total number of cases in the study area.
The expected number of cases for each region. The default is calculated under the constant risk hypothesis.
A binary spatial adjacency matrix for the regions.
The population size associated with each region.
The upperbound of the proportion of the total population to consider for a cluster.
The type of scan statistic to compute. The
default is "poisson"
. The other choice
is "binomial"
.
A logical value indicating whether a
check for unique values should be determined. The
default is FALSE
. This is unlikely to make a
practical different for most real data sets.
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).
It can also be "future"
to use a future backend (see Details),
NULL
(default) refers to sequential evaluation.
data(nydf)
data(nyw)
coords <- with(nydf, cbind(longitude, latitude))
cases <- floor(nydf$cases)
pop <- nydf$pop
ty <- sum(cases)
ex <- ty / sum(pop) * pop
tsim <- uls.sim(1, ty, ex, nyw, pop = pop, ubpop = 0.5)
Run the code above in your browser using DataLab