predictCount: Predicted Counts for a Log-Link Generalised Linear Model

View source: R/predictCount.R

predictCountR Documentation

Predicted Counts for a Log-Link Generalised Linear Model

Description

Teaching helper for count predictions from a log-link generalised linear model. It wraps predict.glm, constructs confidence intervals on the link scale, exponentiates the fitted values and limits, rounds the result, and optionally prints the returned table.

Usage

predictCount(object, newdata, cilevel = 0.95, digit = 3, print.out = TRUE, ...)

Arguments

object

a glm object, i.e. the output from glm.

newdata

prediction data frame.

cilevel

confidence level for the intervals.

digit

number of decimal places to print.

print.out

if TRUE, print the prediction table.

...

optional arguments that are passed to predict.glm.

Details

This is not an S3 predict() method and is not intended to be a drop-in replacement for base R prediction methods. It is a specialised count-focused teaching wrapper. For a more general log-link or logit-link GLM helper, see predictGLM.

Note: newdata must be a data frame with the same column order and data types as those used in fitting the model. This stricter interface is kept for compatibility with the original teaching wrapper.

Value

Invisibly returns a data frame with three columns:

Predicted

the predicted count on the response scale.

Conf.lower

the lower confidence limit on the response scale.

Conf.upper

the upper confidence limit on the response scale.

See Also

predict, predict.glm, predictGLM, as.data.frame.


s20x documentation built on July 1, 2026, 9:06 a.m.