Learn R Programming

vcdExtra (version 0.8.7)

modFit: Brief Summary of Model Fit for a glm or loglm Object

Description

Formats a brief summary of model fit for a glm or loglm object, showing the likelihood ratio Chisq (df) value and or AIC. Useful for inclusion in a plot title or annotation.

Usage

modFit(x, ...)

# S3 method for glm modFit(x, stats = "chisq", digits = 2, ...)

# S3 method for loglm modFit(x, stats = "chisq", digits = 2, ...)

Value

A character string containing the formatted values of the chosen statistics.

Arguments

x

A glm or loglm object

...

Arguments passed down

stats

statistics to print: one or more of "chisq", "aic"

digits

number to digits to use in the print method

Author

Michael Friendly

See Also

LRstats

Examples

Run this code

data(Mental)
require(MASS)
(Mental.tab <- xtabs(Freq ~ ses + mental, data=Mental))
(Mental.mod <- loglm(~ses + mental, Mental.tab))
Mental.mod
modFit(Mental.mod)

# use to label mosaic()
mosaic(Mental.mod, main=paste("Independence model,", modFit(Mental.mod)))

Run the code above in your browser using DataLab