Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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 class 'glm'
modFit(x, stats="chisq", digits=2, ...)
## S3 method for class 'loglm'
modFit(x, stats="chisq", digits=2, ...)

Arguments

x

A glm or loglm object

...

Arguments passed down

stats

One or more of chisq or aic, determining the statistics displayed.

digits

Number of digits after the decimal point in displayed statistics.

Value

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

Author(s)

Michael Friendly

See Also

Summarise (soon to be deprecated), LRstats

Examples

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)))

vcdExtra

'vcd' Extensions and Additions

v0.7-5
GPL (>= 2)
Authors
Michael Friendly [aut, cre], Heather Turner [ctb], Achim Zeileis [ctb], Duncan Murdoch [ctb], David Firth [ctb]
Initial release
2021-01-22

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.