Tobit — R cross-check (AER::tobit, survival::survreg)¶
Companion to tobit_python.ipynb / tobit_pymc.ipynb. The Tobit is a censored-Gaussian regression: AER::tobit is the standard interface; it is a wrapper around survival::survreg with a Gaussian distribution and left-censoring.
In [1]:
ok <- suppressWarnings(suppressMessages(require(AER)))
if (!ok) { install.packages('AER', repos='https://cloud.r-project.org'); library(AER) }
d <- read.csv('mroz_hours.csv')
fit <- tobit(hours ~ nwifeinc + educ + exper + expersq + age + kidslt6 + kidsge6, left=0, data=d)
print(summary(fit))
cat(sprintf('\nscale (sigma) = %.1f\n', fit$scale))
# OLS for contrast (biased)
cat('\nnaive OLS (biased toward 0):\n'); print(round(coef(lm(hours ~ nwifeinc+educ+exper+expersq+age+kidslt6+kidsge6, data=d)),2))
Call:
tobit(formula = hours ~ nwifeinc + educ + exper + expersq + age +
kidslt6 + kidsge6, left = 0, data = d)
Observations:
Total Left-censored Uncensored Right-censored
753 325 428 0
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 965.30528 446.43614 2.162 0.030599 *
nwifeinc -8.81424 4.45910 -1.977 0.048077 *
educ 80.64561 21.58324 3.736 0.000187 ***
exper 131.56430 17.27939 7.614 2.66e-14 ***
expersq -1.86416 0.53766 -3.467 0.000526 ***
age -54.40501 7.41850 -7.334 2.24e-13 ***
kidslt6 -894.02174 111.87804 -7.991 1.34e-15 ***
kidsge6 -16.21800 38.64139 -0.420 0.674701
Log(scale) 7.02289 0.03706 189.514 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Scale: 1122
Gaussian distribution
Number of Newton-Raphson Iterations: 4
Log-likelihood: -3819 on 9 Df
Wald-statistic: 253.9 on 7 Df, p-value: < 2.22e-16
scale (sigma) = 1122.0
naive OLS (biased toward 0):
(Intercept) nwifeinc educ exper expersq age
1330.48 -3.45 28.76 65.67 -0.70 -30.51
kidslt6 kidsge6
-442.09 -32.78
Results¶
AER::tobitgives the canonical Mroz estimates — educ ≈ +80.6, exper ≈ +131.6 (concave), age ≈ −54.4, kidslt6 ≈ −894, σ ≈ 1122 — matching the from-scratch Gibbs and PyMCpm.Censoredexactly.- The naive OLS coefficients are visibly smaller in magnitude for every significant effect — the attenuation from ignoring the 43% of women at the zero boundary. (Only
kidsge6, weak and insignificant in both fits, bucks the pattern.) - Three engines agree (from-scratch augmentation Gibbs ≈ PyMC ≈
AER::tobit);survreg(dist="gaussian", left-censored)is the same fit under the hood, and the samesurvregmachinery extends to interval censoring (Surv(lo, hi, type="interval2")).