Fit a Classical HHH Model (DEPRECATED) with Varying Start Values

Share:

Description

algo.hhh.grid tries multiple starting values in algo.hhh. Starting values are provided in a matrix with gridSize rows (usually created by create.grid). The grid search is conducted until either all starting values are used or a time limit maxTime is exceeded. The result with the highest likelihood is returned.

Note that the algo.hhh implementation of HHH models is deprecated and superseded by the function hhh4.

Usage

1
2
3
4
5
algo.hhh.grid(disProgObj, control=list(lambda=TRUE, neighbours=FALSE, 
   linear=FALSE, nseason=0,
   negbin=c("none", "single", "multiple"), 
   proportion=c("none", "single", "multiple"),lag.range=NULL), 
   thetastartMatrix, maxTime=1800, verbose=FALSE)

Arguments

disProgObj

object of class disProg

control

control object:

lambda

If TRUE an autoregressive parameter λ is included, if lambda is a vector of logicals, unit-specific parameters λ_i are included. By default, observations y_t-lag at the previous time points, i.e. lag=1, are used for the autoregression. Other lags can be used by specifying lambda as a vector of integers, see Examples and algo.hhh for details.

neighbours

If TRUE an autoregressive parameter for adjacent units φ is included, if neighbours is a vector of logicals, unit-specific parameters φ_i are included. By default, observations y_t-lag at the previous time points, i.e. lag=1, are used for the autoregression. Other lags can be used by specifying neighbours as a vector of integers.

linear

a logical (or a vector of logicals) indicating wether a linear trend β (or a linear trend β_i for each unit) is included

nseason

integer number of Fourier frequencies; if nseason is a vector of integers, each unit i gets its own seasonal parameters

negbin

if "single" negative binomial rather than poisson is used, if "multiple" unit-specific overdispersion parameters are used.

proportion

see details in algo.hhh

lag.range

determines which observations are used to fit the model

thetastartMatrix

matrix with initial values for all parameters specified in the control object as rows.

verbose

if true progress information is printed

maxTime

maximum of time (in seconds) to elapse until algorithm stopps.

Value

Returns an object of class ahg with elements

best

result of a call to algo.hhh with highest likelihood

allLoglik

values of loglikelihood for all starting values used

gridSize

number of different starting values in thetastartMatrix

gridUsed

number of used starting values

time

elapsed time

convergence

if false algo.hhh did not converge for all (used) starting values

Author(s)

M. Paul, L. Held

References

Held, L., Höhle, M., Hofmann, M. (2005) A statistical framework for the analysis of multivariate infectious disease surveillance counts, Statistical Modelling, 5, 187–199.

Paul, M., Held, L. and Toschke, A. M. (2008) Multivariate modelling of infectious disease surveillance data, Statistics in Medicine, 27, 6250–6267.

See Also

algo.hhh, create.grid

Examples

 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
## 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)


## more sophisticated models with a much longer runtime follow
## Not run: 
# 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)

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.