runtsir: runtsir

Description Usage Arguments Examples

View source: R/runtsir_function.R

Description

This function runs the TSIR model.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
runtsir(
  data,
  xreg = "cumcases",
  IP = 2,
  nsim = 10,
  regtype = "gaussian",
  sigmamax = 3,
  userYhat = numeric(),
  alpha = NULL,
  sbar = NULL,
  family = "gaussian",
  link = "identity",
  method = "deterministic",
  inits.fit = FALSE,
  epidemics = "cont",
  pred = "forward",
  threshold = 1,
  seasonality = "standard",
  add.noise.sd = 0,
  mul.noise.sd = 0,
  printon = F,
  fit = NULL,
  fittype = NULL
)

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

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.

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

method

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

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.

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

threshold

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

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.

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.

fit

Now removed but gives a warning.

fittype

Now removed but gives a warning.

Examples

1
2
3
4
5
6
7
8
require(kernlab)
London <- twentymeas[["London"]]
## Not run: 
plotdata(London)
res <- runtsir(data=London,method='pois',nsim=10, IP=2,inits.fit=FALSE)
plotres(res)

## End(Not run)

Example output

Loading required package: kernlab
           alpha        mean beta         mean rho         mean sus 
        9.70e-01         1.08e-05         4.57e-01         1.14e+05 
prop. init. sus. prop. init. inf. 
        3.01e-02         6.12e-05 
Warning: Ignoring unknown aesthetics: fill

tsiR documentation built on Jan. 21, 2021, 1:06 a.m.