Learn R Programming

emax.glm (version 0.1.2)

predict.em.glm: Predict values from an 'em.glm' model.

Description

Predict values from an 'em.glm' model.

Usage

# S3 method for em.glm
predict(object, x, y, weight, type = "count", ...)

Arguments

object

An em.glm fit object.

x

An n-by-p design matrix.

y

A vector of observation of length n.

weight

A n length vector of observation weight terms. This is currently designed to be either the exposure for a Poisson model or the number of trials for a Logistic model.

type

Prediction type. Currently can be 'count' for the weighted prediction, 'rate' for the expected rate or 'rho' for the linear predictor.

...

optionally more fitted model objects.

Value

N-length vector of predicted terms.

Examples

Run this code
# NOT RUN {
x <- model.matrix(~ factor(wool) + factor(tension), warpbreaks)
y <- warpbreaks$breaks

m <- em.glm(x = x, y = y, K = 2, b.init = "random")

predict(m, x = x, y = y, weight = c(1))

# }

Run the code above in your browser using DataLab