predict.fgamma: Predictions and Residuals for fgamma Objects

Description Usage Arguments Details See Also Examples

Description

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

Usage

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

Arguments

object

an object of class "fgamma".

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 response ("response" or equivalently "mu") or ("sigma"), 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 "fgamma" objects is available, see fgamma for an overview.

See Also

fgamma

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## full gamma regression model for averge hourly earnings
data("Wages", package = "fgamma")
f1 <- fgamma(wage ~ educ + exper + tenure  + sex + marriage  |
               tenure, data = Wages)

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

## new data with fixed education, experience, tenure, sex, marriage (all at median) and varying tenure (over observed range)
nd <- data.frame(educ = 12, exper = 13.5,sex = "Male", marriage = "Married", tenure = 0:44)

## prediction for mu and sigma (or both)
predict(f1, newdata = nd, type = "mu")
predict(f1, newdata = nd, type = "sigma")
predict(f1, newdata = nd, type = "parameter")

## median
predict(f1, newdata = nd, type = "quantile", at = 0.5)

fgamma documentation built on May 2, 2019, 6:13 p.m.