Learn R Programming

surveillance (version 1.5-4)

twinstim_methods: Print, Summary and Extraction Methods for "twinstim" Objects

Description

Besides print and summary methods there are also some standard extraction methods defined for objects of class "twinstim": vcov, logLik, and nobs. This also enables the use of, e.g., confint and AIC. The model summary can be exported to LaTeX by the corresponding toLatex method.

Usage

## S3 method for class 'twinstim':
print(x, digits = max(3, getOption("digits") - 3), ...)
## S3 method for class 'twinstim':
summary(object, test.iaf = FALSE,
        correlation = FALSE, symbolic.cor = FALSE, ...)

## S3 method for class 'twinstim': vcov(object, ...) ## S3 method for class 'twinstim': logLik(object, ...) ## S3 method for class 'twinstim': nobs(object, ...)

## S3 method for class 'summary.twinstim': print(x, digits = max(3, getOption("digits") - 3), symbolic.cor = x$symbolic.cor, signif.stars = getOption("show.signif.stars"), ...)

## S3 method for class 'summary.twinstim': toLatex(object, digits = max(3, getOption("digits") - 3), eps.Pvalue = 1e-4, align = "lrrrr", withAIC = FALSE, ...) ## S3 method for class 'summary.twinstim': xtable(x, caption = NULL, label = NULL, align = c("l", "r", "r", "r"), digits = 3, display = c("s", "f", "s", "s"), ci.level = 0.95, ci.fmt = "%4.2f", ci.to = "--", eps.pvalue = 1e-4, ...)

Arguments

x, object
an object of class "twinstim" or "summary.twinstim", respectively.
digits
integer, used for number formatting with signif(). Minimum number of significant digits to be printed in values.
test.iaf
logical indicating if the simple Wald z- and p-values should be calculated for parameters of the interaction functions siaf and tiaf. Because it is often invalid or meaningless to do so, the default is FALSE
correlation
logical. If TRUE, the correlation matrix of the estimated parameters is returned and printed.
symbolic.cor
logical. If TRUE, print the correlations in a symbolic form (see symnum) rather than as numbers.
signif.stars
logical. If TRUE, significance stars are printed for each coefficient.
eps.Pvalue
withAIC
logical indicating if the AIC and the log-likelihood of the model should be included below the table of coefficients in the LaTeX tabular.
caption,label,align,display
see xtable.
ci.level,ci.fmt,ci.to
the confidence intervals are calculated at level ci.level and printed using sprintf with format ci.fmt and seperator ci.to.
eps.pvalue
argument passed to formatPval.
...
For print.summary.twinstim, arguments passed to printCoefmat. For all other methods: unused (argument of the generic).

Value

  • The print methods return their first argument, invisibly, as they always should. The vcov, logLik, and nobs methods return the estimated variance-covariance matrix of the parameters (here, the inverse of the estimate of the expected Fisher information matrix), the maximum log-likelihood value of the model, and the number of events (excluding events of the pre-history), respectively. The summary method returns a list containing some summary statistics of the model, which is nicely printed by the corresponding print method. The toLatex method returns a character vector of class "Latex", each element containing one line of LaTeX code (see print.Latex).

encoding

latin1

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) -- separately for the endemic and the epidemic component -- and additionally the AIC, the number of log-likelihood and score evaluations, and the runtime. 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.

Examples

Run this code
# load a fit of the 'imdepi' data, see the example in ?twinstim
data(imdepifit)

# print method
imdepifit

# extract point estimates
coef(imdepifit)

# variance-covariance matrix of endemic parameters
# (inverse of expected Fisher information)
unname(vcov(imdepifit)[1:4,1:4])

# the default confint() method may be used for Wald CI's
confint(imdepifit, parm="e.typeC", level=0.95)

# log-likelihood and AIC of the fitted model
logLik(imdepifit)
AIC(imdepifit)
nobs(imdepifit)

# summary method
summary(imdepifit, test.iaf=FALSE, correlation=TRUE, symbolic.cor=TRUE)

# create LaTeX code of coefficient table
toLatex(summary(imdepifit), withAIC=FALSE)

Run the code above in your browser using DataLab