View source: R/elliptic.sim.adj.R
| elliptic.sim.adj | R Documentation | 
elliptic.test on simulated dataelliptic.sim efficiently performs
elliptic.test on a simulated data set.  The
function is meant to be used internally by the
elliptic.test function, but is informative
for better understanding the implementation of the test.
elliptic.sim.adj(
  nsim = 1,
  ex,
  nn,
  ty,
  logein,
  logeout,
  a,
  pen,
  min.cases = 2,
  cl = NULL
)
nsim | 
 A positive integer indicating the number of simulations to perform.  | 
ex | 
 The expected number of cases for each region. The default is calculated under the constant risk hypothesis.  | 
nn | 
 A list of nearest neighbors produced by
  | 
ty | 
 The total number of cases in the study area.  | 
logein | 
 The   | 
logeout | 
 The   | 
a | 
 The penalty for the spatial scan statistic. The default is 0.5.  | 
pen | 
 The eccentricity penalty for each candidate zone.  | 
min.cases | 
 The minimum number of cases required for a cluster. The default is 2.  | 
cl | 
 A cluster object created by   | 
A vector with the maximum test statistic for each simulated data set.
data(nydf)
data(nyw)
coords <- with(nydf, cbind(longitude, latitude))
pop <- nydf$pop
enn <- elliptic.nn(coords, pop, ubpop = 0.5)
cases <- floor(nydf$cases)
ty <- sum(cases)
ex <- ty / sum(pop) * pop
yin <- nn.cumsum(enn$nn, cases)
ein <- nn.cumsum(enn$nn, ex)
logein <- log(ein)
logeout <- log(ty - ein)
pen <- elliptic.penalty(0.5, enn$shape_all)
tsim <- elliptic.sim.adj(
  nsim = 3, ex = ex,
  nn = enn$nn, ty = ty,
  logein = logein, logeout = logeout,
  a = 0.5, pen = pen
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.