Obtains the clusters with the maximum log-likelihood ratio or minimum DIC for each center and start and end dates.

Share:

Description

This function explores all possible clusters changing their center and start and end dates. For each center and time periods, it obtains the cluster with the maximum log-likelihood ratio or minimum DIC so that the maximum fraction of the total population inside the cluster is less than fractpop, and the maximum distance to the center is less than radius.

Usage

1
2
3
CalcStatsAllClusters(thegrid, CalcStatClusterGivenCenter, stfdf, rr,
  typeCluster, sortDates, idMinDateCluster, idMaxDateCluster, fractpop, model0,
  numCPUS)

Arguments

thegrid

grid with the coordinates of the centers of the clusters explored.

CalcStatClusterGivenCenter

function to obtain the cluster with the maximum log-likelihood ratio of all the clusters with the same center and start and end dates

stfdf

spatio-temporal class object containing the data.

rr

square of the maximum radius of the cluster.

typeCluster

type of clusters to be detected. "ST" for spatio-temporal clusters or "S" spatial clusters.

sortDates

sorted vector of the times where disease cases occurred.

idMinDateCluster

index of the closest date to the start date of the cluster in the vector sortDates

idMaxDateCluster

index of the closest date to the end date of the cluster in the vector sortDates

fractpop

maximum fraction of the total population inside the cluster.

model0

Initial model (including covariates). This can be "glm" for generalized linear models (glm stats), "glmer" for generalized linear mixed model (glmer lme4), "zeroinfl" for zero-inflated models (zeroinfl pscl), or "inla" for generalized linear, generalized linear mixed or zero-inflated models.

numCPUS

Number of cpus used when using parallel to run the method. If parallel is not used numCPUS is NULL.

Value

data frame with information of the clusters with the maximum log-likelihood ratio or minimum DIC for each center and start and end dates. It contains the coordinates of the center, the size, the start and end dates, the log-likelihood ratio or DIC, the p-value and the risk of each of the clusters.