View source: R/algo_farrington.R

algo.farrington.fitGLM | R Documentation |

The function fits a Poisson regression model (GLM) with mean predictor

`\log \mu_t = \alpha + \beta t`

as specified by the Farrington procedure. If requested, Anscombe residuals are computed based on an initial fit and a 2nd fit is made using weights, where base counts suspected to be caused by earlier outbreaks are downweighted.

```
algo.farrington.fitGLM(response, wtime, timeTrend = TRUE,
reweight = TRUE, ...)
algo.farrington.fitGLM.fast(response, wtime, timeTrend = TRUE,
reweight = TRUE, ...)
algo.farrington.fitGLM.populationOffset(response, wtime, population,
timeTrend=TRUE,reweight=TRUE, ...)
```

`response` |
The vector of observed base counts |

`wtime` |
Vector of week numbers corresponding to |

`timeTrend` |
Boolean whether to fit the |

`reweight` |
Fit twice – 2nd time with Anscombe residuals |

`population` |
Population size. Possibly used as offset, i.e. in
This provides a way to adjust the Farrington procedure to the case of greatly varying populations. Note: This is an experimental implementation with methodology not covered by the original paper. |

`...` |
Used to catch additional arguments, currently not used. |

Compute weights from an initial fit and rescale using
Anscombe based residuals as described in the
`anscombe.residuals`

function.

Note that `algo.farrington.fitGLM`

uses the `glm`

routine
for fitting. A faster alternative is provided by
`algo.farrington.fitGLM.fast`

which uses the `glm.fit`

function directly (thanks to Mikko Virtanen). This saves
computational overhead and increases speed for 500 monitored time
points by a factor of approximately two. However, some of the
routine `glm`

functions might not work on the output of this
function. Which function is used for `algo.farrington`

can be
controlled by the `control$fitFun`

argument.

an object of class GLM with additional fields `wtime`

,
`response`

and `phi`

. If the `glm`

returns without
convergence `NULL`

is returned.

`anscombe.residuals`

,`algo.farrington`

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.