## monthly counts of menigococcal infections in France
data(meningo.age)
# specify model for algo.hhh.grid
model1 <- list(lambda=TRUE)
# create grid of inital values
grid1 <- create.grid(meningo.age, model1,
params = list(epidemic=c(0.1,0.9,5)))
# try multiple starting values, print progress information
algo.hhh.grid(meningo.age, control=model1, thetastartMatrix=grid1,
verbose=TRUE)
# specify model
model2 <- list(lambda=TRUE, neighbours=TRUE, negbin="single",
nseason=1)
grid2 <- create.grid(meningo.age, model2,
params = list(epidemic=c(0.1,0.9,3),
endemic=c(-0.5,0.5,3),
negbin = c(0.3, 12, 10)))
# run algo.hhh.grid, search time is limited to 30 sec
algo.hhh.grid(meningo.age, control=model2, thetastartMatrix=grid2,
maxTime=30)
## weekly counts of influenza and meningococcal infections in Germany, 2001-2006
data(influMen)
# specify model with two autoregressive parameters lambda_i, overdispersion
# parameters psi_i, an autoregressive parameter phi for meningococcal infections
# (i.e. nu_flu,t = lambda_flu * y_flu,t-1
# and nu_men,t = lambda_men * y_men,t-1 + phi_men*y_flu,t-1 )
# and S=(3,1) Fourier frequencies
model <- list(lambda=c(TRUE,TRUE), neighbours=c(FALSE,TRUE),
linear=FALSE, nseason=c(3,1),negbin="multiple")
# create grid of initial values
grid <- create.grid(influMen,model, list(epidemic=c(.1,.9,3),
endemic=c(-.5,.5,3), negbin=c(.3,15,10)))
# run algo.hhh.grid, search time is limited to 30 sec
algo.hhh.grid(influMen, control=model, thetastartMatrix=grid, maxTime=30)
# now meningococcal infections in the same week should enter as covariates
# (i.e. nu_flu,t = lambda_flu * y_flu,t-1
# and nu_men,t = lambda_men * y_men,t-1 + phi_men*y_flu,t )
model2 <- list(lambda=c(1,1), neighbours=c(NA,0),
linear=FALSE,nseason=c(3,1),negbin="multiple")
algo.hhh.grid(influMen, control=model2, thetastartMatrix=grid, maxTime=30)
Run the code above in your browser using DataLab