predict.enbin: Predictions and Residuals for enbin Objects

Description Usage Arguments Details See Also Examples

Description

Methods for computing predictions, fitted values, and residuals from fitted enbin objects.

Usage

1
2
3
4
5
6
7
8
## S3 method for class 'enbin'
predict(object, newdata = NULL,
  type = c("response", "location", "scale", "parameter", "probability", "quantile"),
  na.action = na.pass, at = 0.5, ...)
## S3 method for class 'enbin'
fitted(object, type = c("location", "scale"), ...)
## S3 method for class 'enbin'
residuals(object, type = c("standardized", "pearson", "response"), ...)

Arguments

object

an object of class "enbin".

newdata

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

type

character indicating type of predictions/residuals: fitted means of latent response ("response" or equivalently "location"), latent standard deviation ("scale"), or both ("parameter"). The cumulative distribution function or quantile function of the corresponding fitted parametric distributions can be evaluated with "probability" or "quantile", respectively.

na.action

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

at

numeric vector indicating the level(s) at which quantiles or probabilities should be predicted (only if type = "quantile" or "probability").

...

currently not used.

Details

In addition to the methods above, a set of standard extractor functions for "enbin" objects is available, see enbin for an overview.

See Also

enbin

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## extended negative binomial model for number of trips
data("RecreationDemand", package = "AER")
m <- enbin(trips ~ . - income | . - income, data = RecreationDemand)

## by default predict() and fitted() return the fitted latent means on the observed sample
head(fitted(m))
head(predict(m))

## new data 
nd <- data.frame(quality = 2, ski = "yes", userfee = "yes", costC = 60, costS = 70, costH = 80)

## predictions
predict(m, newdata = nd, type = "location")
predict(m, newdata = nd, type = "scale")
predict(m, newdata = nd, type = "quantile")

enbin documentation built on May 2, 2019, 5:57 p.m.