Description Usage Arguments Note See Also Examples
The special functions fe and ri are used to specify 
(unit-specific) effects of covariates and a random intercept term, 
respectively, in formulae used in the function hhh4.
1 2 3 4  | 
x | 
 an expression like   | 
unitSpecific | 
 logical indicating if the effect of   | 
which | 
 vector of logicals indicating which unit(s)
should get an unit-specific parameter.
For units with a   | 
initial | 
 initial values (on internal scale!) 
for the fixed effects used for optimization. The default
(  | 
type | 
 random intercepts either follow an IID or a CAR model.  | 
corr | 
 whether random effects
in different components (such as   | 
initial.fe | 
 initial value for the random intercept mean.  | 
initial.var | 
 initial values (on internal scale!) for the variance components used for optimization.  | 
initial.re | 
 initial values (on internal scale!) for the random effects 
used for optimization. The default   | 
This function should only be used in formula objects for hhh4, 
and is not intended for direct calling.
If unit-specific or random intercepts are specified, an overall
intercept must be excluded (by -1) in the component formula.
addSeason2formula, 
usage of formulae in the vignette and in examples of hhh4.
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 56 57 58  | # some calls of the fitting function 'hhh4': 
# see vignette("hhh4") for further details
data("influMen")
fluMen <- disProg2sts(influMen)
meningo <- fluMen[, "meningococcus"]
## Ex: univariate time series of meningococcal infections in Germany
# Negative binomial model with
# endemic component: Intercept + S = 1 sine/cosine pair
# autoregressive component: Intercept
f.S1 <- addSeason2formula(f = ~ 1, S = 1, period = 52)
hhh4(meningo, list(
    ar = list(f = ~ 1),
    end = list(f = f.S1), 
    family = "NegBin1"
))
## Ex: disease-specific intercept in influenza/meningococcal time series
# Negative binomial model with
# autoregressive component: disease-specific intercepts
# neighbour-driven component: only transmission from flu to men
# endemic component: S=3 and S=1 sine/cosine pairs for flu and men, respectively
Wflumen <- neighbourhood(fluMen)
Wflumen["meningococcus","influenza"] <- 0
Wflumen
f.end <- addSeason2formula(f = ~ -1 + fe(1, which = c(TRUE,TRUE)), 
                           S = c(3, 1), period = 52)
f.end
m <- list(ar = list(f = ~ -1 + fe(1, unitSpecific = TRUE)),
          ne = list(f = ~ 1, weights = Wflumen),
          end = list(f = f.end),
          family = "NegBinM")
hhh4(fluMen, control = m)
## Not run: 
## Ex: (correlated) random intercepts for influenza in Southern Germany
# Negative binomial model with
# autoregressive component: Intercept
# neighbour-driven component: random intercepts
# endemic component: random intercepts + trend + S = 3 sine/cosine pairs
data("fluBYBW")
f.end <- addSeason2formula(f = ~ -1 + ri(type = "iid", corr="all") +
                                 I((t-208)/100), S = 3, period = 52)
wji <- neighbourhood(fluBYBW)/rowSums(neighbourhood(fluBYBW))
model.B2 <- list(ar = list(f = ~ 1),
                 ne = list(f = ~ -1 + ri(type = "iid", corr="all"), 
                           weights = wji),
                 end = list(f = f.end, offset = population(fluBYBW)),
                 family = "NegBin1", verbose = TRUE)
hhh4(fluBYBW, model.B2)
## End(Not run)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.