predict.gnm: Predict Method for Generalized Nonlinear Models

predict.gnmR Documentation

Predict Method for Generalized Nonlinear Models


Obtains predictions and optionally estimates standard errors of those predictions from a fitted generalized nonlinear model object.


## S3 method for class 'gnm'
predict(object, newdata = NULL,
type = c("link", "response", "terms"), = FALSE, dispersion =
NULL, terms = NULL, na.action = na.exclude, ...)



a fitted object of class inheriting from "gnm".


optionally, a data frame in which to look for variables with which to predict. If omitted, the fitted predictors are used.


the type of prediction required. The default is on the scale of the predictors; the alternative "response" is on the scale of the response variable. Thus for a default binomial model the default predictions are of log-odds (probabilities on logit scale) and type = "response" gives the predicted probabilities. The "terms" option returns a matrix giving the fitted values of each term in the model formula on the predictor scale.

The value of this argument can be abbreviated.

logical switch indicating if standard errors are required.


the dispersion of the fit to be assumed in computing the standard errors. If omitted, that returned by summary applied to the object is used.


with type="terms" by default all terms are returned. A character vector specifies which terms are to be returned


function determining what should be done with missing values in newdata. The default is to predict NA.


further arguments passed to or from other methods.


If newdata is omitted the predictions are based on the data used for the fit. In that case how cases with missing values in the original fit is determined by the na.action argument of that fit. If na.action = na.omit omitted cases will not appear in the residuals, whereas if na.action = na.exclude they will appear (in predictions and standard errors), with residual value NA. See also napredict.


If se = FALSE, a vector or matrix of predictions. If se = TRUE, a list with components



estimated standard errors.


a scalar giving the square root of the dispersion used in computing the standard errors.


Variables are first looked for in 'newdata' and then searched for in the usual way (which will include the environment of the formula used in the fit). A warning will be given if the variables found are not of the same length as those in 'newdata' if it was supplied.


Heather Turner


Chambers, J. M. and Hastie, T. J. (1992) Statistical Models in S

See Also




##  Fit an association model with homogeneous row-column effects
RChomog <- gnm(Freq ~ origin + destination + Diag(origin, destination) +
               MultHomog(origin, destination), family = poisson,
               data = occupationalStatus)

## Fitted values (expected counts)
predict(RChomog, type = "response", = TRUE)

## Fitted values on log scale
predict(RChomog, type = "link", = TRUE)

gnm documentation built on April 29, 2022, 5:06 p.m.