twinSIR_methods {surveillance} | R Documentation |
Print, Summary and Extraction Methods for "twinSIR"
Objects
Description
Besides print
and summary
methods there are also some standard
extraction methods defined for objects of class "twinSIR"
:
vcov
, logLik
and especially AIC
and
extractAIC
, which extract Akaike's Information Criterion. Note that
special care is needed, when fitting models with parameter constraints such as
the epidemic effects \alpha
in twinSIR
models. Parameter
constraints reduce the average increase in the maximized loglikelihood - thus
the penalty for constrained parameters should be smaller than the factor 2 used
in the ordinary definition of AIC. To this end, these two methods offer the
calculation of the so-called one-sided AIC (OSAIC).
Usage
## S3 method for class 'twinSIR'
print(x, digits = max(3, getOption("digits") - 3), ...)
## S3 method for class 'twinSIR'
summary(object,
correlation = FALSE, symbolic.cor = FALSE, ...)
## S3 method for class 'twinSIR'
AIC(object, ..., k = 2, one.sided = NULL, nsim = 1e3)
## S3 method for class 'twinSIR'
extractAIC(fit, scale = 0, k = 2, one.sided = NULL,
nsim = 1e3, ...)
## S3 method for class 'twinSIR'
vcov(object, ...)
## S3 method for class 'twinSIR'
logLik(object, ...)
## S3 method for class 'summary.twinSIR'
print(x,
digits = max(3, getOption("digits") - 3), symbolic.cor = x$symbolic.cor,
signif.stars = getOption("show.signif.stars"), ...)
Arguments
x , object , fit |
an object of class |
digits |
integer, used for number formatting with |
correlation |
logical. if |
symbolic.cor |
logical. If |
... |
For the |
k |
numeric specifying the "weight" of the penalty to be used;
in an unconstrained fit |
one.sided |
logical or |
nsim |
when there are more than two epidemic covariates in the fit, the weights in the OSAIC formula have to be determined by simulation. Default is to use 1000 samples. Note that package quadprog is additionally required in this case. |
scale |
unused (argument of the generic). |
signif.stars |
logical. If |
Details
The print
and summary
methods allow the compact or comprehensive
representation of the fitting results, respectively. The former only prints
the original function call, the estimated coefficients and the maximum
log-likelihood value. The latter prints the whole coefficient matrix with
standard errors, z- and p-values (see printCoefmat
), and
additionally the number of infections per log-baseline interval
,
the (one-sided) AIC and the number of log-likelihood evaluations. They both
append a big “WARNING”, if the optimization algorithm did not converge.
The estimated coefficients may be extracted by using the default
coef
-method from package stats.
The two AIC functions differ only in that AIC
can take more than one
fitted model object and that extractAIC
always returns the number of
parameters in the model (AIC
only does with more than one fitted model
object).
Concerning the choice of one-sided AIC: parameter constraints – such as the
non-negative constraints for the epidemic effects alpha in twinSIR
models – reduce the average increase in the maximized loglikelihood. Thus,
the penalty for constrained parameters should be smaller than the factor 2
used in the ordinary definition of AIC. One-sided AIC (OSAIC) suggested by
Hughes and King (2003) is such a proposal when p
out of k = p + q
parameters have non-negative constraints:
OSAIC = -2 l(\theta, \tau) + 2 \sum_{g=0}^p w(p,g) (k-p+g)
where w(p,g)
are p
-specific weights. For more details see
Section 5.2 in Höhle (2009).
Value
The print
methods return their first argument, invisibly, as
they always should. The vcov
and logLik
methods return the estimated variance-covariance
matrix of the parameters (here, the inverse of the estimate of the
expected Fisher information matrix), and the maximum log-likelihood
value of the model, respectively.
The summary
method returns a list containing some summary
statistics of the fitted model, which is nicely printed by the
corresponding print
method.
For the AIC
and extractAIC
methods, see
the documentation of the corresponding generic functions.
Author(s)
Michael Höhle and Sebastian Meyer
References
Hughes A, King M (2003) Model selection using AIC in the presence of one-sided information. Journal of Statistical Planning and Inference 115, pp. 397–411.
Höhle, M. (2009), Additive-Multiplicative Regression Models for Spatio-Temporal Epidemics, Biometrical Journal, 51(6):961-978.
Examples
data("hagelloch")
# a simplistic twinSIR model
fit <- twinSIR(~ household + cox(AGE), data = hagelloch)
coef(fit)
vcov(fit)
logLik(fit)
summary(fit, correlation = TRUE, symbolic.cor = TRUE)
# AIC or OSAIC
AIC(fit)
AIC(fit, one.sided = FALSE)
extractAIC(fit)
extractAIC(fit, one.sided = FALSE)
# comparing models via AIC
fit2 <- update(fit, nIntervals = 2)
AIC(fit, fit2) # the 2nd column should be named "OSAIC" here