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

# S3 method for htobit
predict(object, newdata = NULL,
  type = c("response", "location", "scale", "parameter", "probability", "quantile"),
  na.action = na.pass, at = 0.5, …)
# S3 method for htobit
fitted(object, type = c("location", "scale"), …)
# S3 method for htobit
residuals(object, type = c("standardized", "pearson", "response"), …)

Arguments

object

an object of class "htobit".

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

Currently, "location" and "scale" only provide the parameters of the latent Gaussian variable in the censored regression. Additionally, the mean and standard deviation of the manifest observed response variable would be of interest. However, this is currently not implemented yet.

Therefore, the standardized/Pearson residuals are not entirely correct. These would really need to be defined in terms of the manifest rather than the latent parameters.

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

See also

Examples

## heteroscedastic tobit model for budget share of alcohol data("AlcoholTobacco", package = "htobit") AlcoholTobacco$persons <- with(AlcoholTobacco, adults + oldkids + youngkids) ma <- htobit(alcohol ~ age + log(expenditure) + persons | age + log(expenditure) + persons, data = AlcoholTobacco) ## by default predict() and fitted() return the fitted latent means on the observed sample head(fitted(ma))
#> 1 2 3 4 5 6 #> 0.01630968 0.01693063 0.01848813 0.01363918 0.01392130 0.01161305
#> 1 2 3 4 5 6 #> 0.01630968 0.01693063 0.01848813 0.01363918 0.01392130 0.01161305
## new data with fixed age and persons (at median) and varying expenditure (over observed range) nd <- data.frame(age = 2, persons = 2, expenditure = exp(12:15)) ## latent Gaussian location and scale (or both) predict(ma, newdata = nd, type = "location")
#> 1 2 3 4 #> 0.004396325 0.010639838 0.016883350 0.023126863
predict(ma, newdata = nd, type = "scale")
#> 1 2 3 4 #> 0.03870455 0.02931314 0.02220049 0.01681368
predict(ma, newdata = nd, type = "parameter")
#> location scale #> 1 0.004396325 0.03870455 #> 2 0.010639838 0.02931314 #> 3 0.016883350 0.02220049 #> 4 0.023126863 0.01681368
## median predict(ma, newdata = nd, type = "quantile", at = 0.5)
#> [1] 0.004396325 0.010639838 0.016883350 0.023126863
## probability of zero boundary predict(ma, newdata = nd, type = "probability", at = 0)
#> 1 2 3 4 #> 0.45478269 0.35831303 0.22347954 0.08449154