DetectClustersModel: Detects clusters and computes their significance.

Description Usage Arguments Value


Searches all possible clusters with start and end dates within minDateUser and maxDateUser, 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. The search can be done for spatial or spatio-temporal clusters. The significance of the clusters is obtained with a Monte Carlo procedure or based on the chi-square distribution (glm, glmer or zeroinfl models) or DIC (inla models).


DetectClustersModel(stfdf, thegrid = NULL, radius = Inf, step = NULL,
  fractpop, alpha, typeCluster, minDateUser = min(time(stfdf@time)),
  maxDateUser = max(time(stfdf@time)), R = NULL, model0)



spatio-temporal class object containing the data. See STFDF-class spacetime for details. It contains an object of class Spatial with the coordinates, a time object holding time information, an endTime vector of class POSIXct holding end points of time intervals, and a data.frame with vectors Observed, Expected and potential covariates in each location and time. Note that the function DetectClustersModel does not use the endTime vector. We can define endTime, for example, as the vector of class POSIXct which contains the same dates as the ones contained in the time object.


two-columns matrix containing the points of the grid to be used. If it is null, a rectangular grid is built.


maximum radius of the clusters.


step of the thegrid built.


maximum fraction of the total population inside the cluster.


significance level used to determine the existence of clusters.


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


start date of the clusters.


end date of the clusters.


If the cluster's significance is calculated based on the chi-square distribution or DIC, R is NULL. If the cluster's significance is calculated using a Monte Carlo procedure, R represents the number replicates under the null hypothesis.


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.


data frame with information of the detected clusters ordered by its log-likelihood ratio value or DIC. Each row represents the information of one of the clusters. It contains the coordinates of the center, the size, the start and end dates, the log-likelihood ratio or DIC, the p-value, the risk of the cluster, and a boolean indicating if it is a cluster (TRUE in all cases).

Search within the DClusterm package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.