predict.htobit.Rd
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"), …)
object | an object of class |
---|---|
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 ( |
na.action | function determining what should be done with missing values
in |
at | numeric vector indicating the level(s) at which quantiles or probabilities
should be predicted (only if |
… | currently not used. |
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.
## 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#> 1 2 3 4 #> 0.03870455 0.02931314 0.02220049 0.01681368#> location scale #> 1 0.004396325 0.03870455 #> 2 0.010639838 0.02931314 #> 3 0.016883350 0.02220049 #> 4 0.023126863 0.01681368#> [1] 0.004396325 0.010639838 0.016883350 0.023126863#> 1 2 3 4 #> 0.45478269 0.35831303 0.22347954 0.08449154