View source: R/mcmcestpars_function.R

This function computes the set up to run the TSIR model, i.e. reconstructes susecptibles and estimates beta and alpha using MCMC computations. Used the same way as estpars.

1 2 3 4 5 | ```
mcmcestpars(data, xreg = "cumcases", IP = 2, regtype = "gaussian",
sigmamax = 3, seasonality = "standard", userYhat = numeric(),
update.iter = 10000, n.iter = 30000, n.chains = 3,
n.adapt = 1000, burn.in = 100, sbar = NULL, alpha = NULL,
printon = F)
``` |

`data` |
The data frame containing cases and interpolated births and populations. |

`xreg` |
The x-axis for the regression. Options are 'cumcases' and 'cumbirths'. Defaults to 'cumcases'. |

`IP` |
The infectious period in weeks. Defaults to 2 weeks. |

`regtype` |
The type of regression used in susceptible reconstruction. Options are 'gaussian', 'lm' (linear model), 'spline' (smooth.spline with 2.5 degrees freedom), 'lowess' (with f = 2/3, iter = 1), 'loess' (degree 1), and 'user' which is just a user inputed vector. Defaults to 'gaussian' and if that fails then defaults to loess. |

`sigmamax` |
The inverse kernal width for the gaussian regression. Default is 3. Smaller, stochastic outbreaks tend to need a lower sigma. |

`seasonality` |
The type of contact to use. Options are standard for 52/IP point contact or schoolterm for just a two point on off contact or none for a single contact parameter. Defaults to standard. |

`userYhat` |
The inputed regression vector if regtype='user'. Defaults to NULL. |

`update.iter` |
Number of MCMC iterations to use in the update aspect. Default is 10000. |

`n.iter` |
Number of MCMC iterations to use. Default is 30000. |

`n.chains` |
Number of MCMC chains to use. Default is 3. |

`n.adapt` |
Adaptive number for MCMC. Default is 1000. |

`burn.in` |
Burn in number. Default is 100. |

`sbar` |
The mean number of susceptibles. Defaults to NULL, i.e. the function estimates sbar. |

`alpha` |
The mixing parameter. Defaults to NULL, i.e. the function estimates alpha. |

`printon` |
Whether to show diagnostic prints or not, defaults to FALSE. |

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.