Description Usage Arguments Value References Examples

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).

1 2 3 4 |

`stfdf` |
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. |

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

`radius` |
maximum radius of the clusters. |

`step` |
step of the thegrid built. |

`fractpop` |
maximum fraction of the total population inside the cluster. |

`alpha` |
significance level used to determine the existence of clusters. |

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

`minDateUser` |
start date of the clusters. |

`maxDateUser` |
end date of the clusters. |

`R` |
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. |

`model0` |
Initial model (including covariates). |

`ClusterSizeContribution` |
Indicates the variable to be used as the population at risk in the cluster. This is the variable name to be used by 'fractpop' when checking the fraction of the population inside the cluster. The default column name is 'Population'. 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).

Bilancia M, Demarinis G (2014) Bayesian scanning of spatial disease rates with the Integrated Nested Laplace Approximation (INLA). Statistical Methods & Applications 23(1): 71 - 94. http://dx.doi.org/10.1007/s10260-013-0241-8

Jung I (2009) A generalized linear models approach to spatial scan statistics for covariate adjustment. Statistics in Medicine 28(7): 1131 - 1143.

Fast Bayesian classification for disease mapping and the detection of disease clusters (2017) Gomez-Rubio V, Molitor J, Moraga P. Submitted.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ```
library("DClusterm")
library("xts")
data("NY8")
NY8$Observed <- round(NY8$Cases)
NY8$Expected <- NY8$POP8 * sum(NY8$Observed) / sum(NY8$POP8)
NY8$x <- coordinates(NY8)[, 1]
NY8$y <- coordinates(NY8)[, 2]
NY8st <- STFDF(as(NY8, "SpatialPolygons"), xts(1, as.Date("1972-01-01")),
NY8@data, endTime = as.POSIXct(strptime(c("1972-01-01"), "%Y-%m-%d"),
tz = "GMT"))
#Model to account for covariates
ny.m1 <- glm(Observed ~ offset(log(Expected)) + PCTOWNHOME + PCTAGE65P +
PEXPOSURE, family = "poisson", data = NY8)
#Indices of areas that are possible cluster centres
idxcl <- c(120, 12, 89, 139, 146)
#Cluster detection adjusting for covariates
ny.cl1 <- DetectClustersModel(NY8st,
thegrid = as.data.frame(NY8)[idxcl, c("x", "y")],
fractpop = 0.15, alpha = 0.05,
typeCluster = "S", R = NULL, model0 = ny.m1,
ClusterSizeContribution = "POP8")
#Display results
ny.cl1
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.