htobit {ppml} | R Documentation |
Fitting tobit regression models with conditional heteroscedasticity.
htobit(formula, data, subset, na.action, model = TRUE, y = TRUE, x = FALSE, control = htobit_control(...), ...) htobit_fit(x, y, z = NULL, control) htobit_control(maxit = 5000, start = NULL, ...)
formula |
a formula expression of the form |
data |
an optional data frame containing the variables occurring in the formulas. |
subset |
an optional vector specifying a subset of observations to be used for fitting. |
na.action |
a function which indicates what should happen when the data
contain |
model |
logical. If |
x, y |
for |
z |
a design matrix with regressors for the scale. |
... |
arguments to be used to form the default |
control, maxit, start |
a list of control parameters passed to |
htobit
fits tobit regression models with conditional
heteroscedasticity with maximum likelihood estimation.
htobit_fit
is the lower level function where the actual
fitting takes place.
An object of class "htobit"
.
Messner JW, Mayr GJ, Zeileis A (2016). Heteroscedastic Censored and Truncated Regression with crch. The R Journal, 3(1), 173–181. https://journal.R-project.org/archive/2016-1/messner-mayr-zeileis.pdf.
## artificial data-generating process dgp <- function(n, coef = c(1, 1, -1, 0, 1, 0)) { d <- data.frame( x1 = runif(100, -1, 1), x2 = runif(100, -1, 1) ) d$ystar <- rnorm(100, mean = coef[1] + coef[2] * d$x1 + coef[3] * d$x2, sd = exp(coef[4] + coef[5] * d$x1 + coef[6] * d$x2) ) d$y <- pmax(0, d$ystar) return(d) } ## data set.seed(2017-05-15) d <- dgp() ## homoscedastic vs. heteroscedastic tobit model m0 <- htobit(y ~ x1 + x2, data = d) m1 <- htobit(y ~ x1 + x2 | x1 + x2, data = d) ## comparison of the two models AIC(m0, m1) BIC(m0, m1) if(require("lmtest")) { lrtest(m0, m1) } ## comparison with crch if(require("crch")) { c1 <- crch(y ~ x1 + x2 | x1 + x2, data = d, left = 0) cbind(coef(m1), coef(c1)) }