I'm trying to migrate a tobit model from Stata to R.
The Stata commands for robust would be to just add ,vce(robust) to the model. And for clustering it would be ,vce(cluster idvar).
Reproducible Stata example:
use http://www.ats.ucla.edu/stat/stata/dae/tobit, clear
tobit apt read math i.prog, ul(800)
tobit apt read math i.prog, ul(800) vce(cluster prog)
Reproducible R example:
library("VGAM")
dat <- read.csv("http://www.ats.ucla.edu/stat/data/tobit.csv")
summary(m <- vglm(apt ~ read + math + prog, tobit(Upper = 800), data = dat))
My understanding is that coeftest(m, vcov = sandwich) should give me robust se.
But I get the following: Error: $ operator not defined for this S4 class.
Could someone suggest an approach for estimating the robust se from the vglm model and also clustered se with vglm?
After spending a whole day looking into this question myself, I think I finally found an appropriate package:
Zelig.http://docs.zeligproject.org/en/latest/zelig-tobit.html
Compare without clustering to clustering:
WITHOUT
WITH