# Obtains clusters with the maximum log-likelihood ratio for each center and...

### Description

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

### 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), or "zeroinfl" for zero-inflated models (zeroinfl pscl). |

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

### Details

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

### Value

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

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.