View source: R/mcmctsir_function.R

This function runs the TSIR model using a MCMC estimation. The susceptibles are still reconstructed in the same way as the regular tsir model, however beta, alpha, and sbar (or whatever combination you enter) are estimated using rjargs.

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 | ```
mcmctsir(
data,
xreg = "cumcases",
IP = 2,
nsim = 100,
regtype = "gaussian",
sigmamax = 3,
userYhat = numeric(),
update.iter = 10000,
n.iter = 30000,
n.chains = 3,
n.adapt = 1000,
burn.in = 100,
method = "deterministic",
epidemics = "cont",
pred = "forward",
seasonality = "standard",
inits.fit = FALSE,
threshold = 1,
sbar = NULL,
alpha = NULL,
add.noise.sd = 0,
mul.noise.sd = 0,
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. |

`nsim` |
The number of simulations to do. Defaults to 100. |

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

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

`method` |
The type of next step prediction used. Options are 'negbin' for negative binomial, 'pois' for poisson distribution, and 'deterministic'. Defaults to 'deterministic'. |

`epidemics` |
The type of data splitting. Options are 'cont' which doesn't split the data up at all, and 'break' which breaks the epidemics up if there are a lot of zeros. Defaults to 'cont'. |

`pred` |
The type of prediction used. Options are 'forward' and 'step-ahead'. Defaults to 'forward'. |

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

`inits.fit` |
Whether or not to fit initial conditions using simple least squares as well. Defaults to FALSE. This parameter is more necessary in more chaotic locations. |

`threshold` |
The cut off for a new epidemic if epidemics = 'break'. Defaults to 1. |

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

`add.noise.sd` |
The sd for additive noise, defaults to zero. |

`mul.noise.sd` |
The sd for multiplicative noise, defaults to zero. |

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