Description Usage Arguments Details See Also Examples

Methods for computing predictions, fitted values, and residuals
from fitted `htobit`

objects.

1 2 3 4 5 6 7 8 | ```
## S3 method for class 'htobit'
predict(object, newdata = NULL,
type = c("response", "location", "scale", "parameter", "probability", "quantile"),
na.action = na.pass, at = 0.5, ...)
## S3 method for class 'htobit'
fitted(object, type = c("location", "scale"), ...)
## S3 method for class '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.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ```
## heteroscedastic tobit model for budget share of alcohol
data("AlcoholTobacco", package = "htobit2018")
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))
head(predict(ma))
## 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")
predict(ma, newdata = nd, type = "scale")
predict(ma, newdata = nd, type = "parameter")
## median
predict(ma, newdata = nd, type = "quantile", at = 0.5)
## probability of zero boundary
predict(ma, newdata = nd, type = "probability", at = 0)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.