"twinSIR"
Objectsprint
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).## 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"), ...)
"twinSIR"
.
For the print
method of the summary
method, an object of
class "summary.twinSIR"
.signif()
. Minimum number of
significant digits to be printed in values.TRUE
, the correlation matrix of the estimated parameters
is returned and printed.TRUE
, print the correlations in a symbolic form (see
symnum
) rather than as numbers.summary
method: arguments passed to
extractAIC.twinSIR
.
For the AIC
method, optionally more fitted model objects.
For the print
, extractAI
k = 2
is the classical AIC.NULL
(the default). Determines if the one-sided AIC
should be calculated instead of using the classical penalty k*edf
.
The default value NULL
chooses classical AIC in the case of an
unconstraTRUE
, 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.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 The estimated coefficients may be extracted by using the default
coef
-method from package 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
data("foofit")
foofit
coef(foofit)
vcov(foofit)
logLik(foofit)
summary(foofit, correlation = TRUE, symbolic.cor = TRUE)
# AIC or OSAIC
AIC(foofit)
AIC(foofit, one.sided = FALSE)
extractAIC(foofit)
extractAIC(foofit, one.sided = FALSE)
# with BIC-like penalty weight
AIC(foofit, k = log(nlevels(foofit$model$survs$id)))
# just as a stupid example for the use of AIC with multiple fits
foofit2 <- foofit
AIC(foofit, foofit2) # 2nd column should actually be named "OSAIC" here
Run the code above in your browser using DataLab