This function computes the set up to run the TSIR model, i.e. reconstructs susecptibles and estimates beta and alpha. This can be plugged into simulatetsir.
estpars( data, xreg ="cumcases", IP =2, seasonality ="standard", regtype ="gaussian", sigmamax =3, family ="gaussian", link ="identity", userYhat = numeric(), alpha =NULL, sbar =NULL, printon = F
)
Arguments
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. This should be the same as your timestep. Defaults to 2 weeks.
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.
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.
family: The family in the GLM regression. One can use any of the GLM ones, but the options are essentially 'poisson' (with link='log'), 'gaussian' (with link='log' or 'identity'), or 'quasipoisson' (with link='log'). Default is 'gaussian'.
link: The link function used with the glm family. Options are link='log' or 'identity'. Default is 'identity'. to include some bayesian approaches. For 'bayesglm' we use a gaussian prior with mean 1e-4.
userYhat: The inputed regression vector if regtype='user'. Defaults to NULL.
alpha: The mixing parameter. Defaults to NULL, i.e. the function estimates alpha.
sbar: The mean number of susceptibles. Defaults to NULL, i.e. the function estimates sbar.
printon: Whether to show diagnostic prints or not, defaults to FALSE.