A cleaner and slightly more tested version is at http://davidhughjones.blogspot.com/2011/07/honore-style-fixed-effects-estimators.html
David Hugh-Jones Research Associate CAGE, Department of Economics University of Warwick http://davidhughjones.googlepages.com On 13 July 2011 15:33, David Hugh-Jones <davidhughjo...@gmail.com> wrote: > True! Here's my attempt -- use at your own risk. > > honore <- function (b, dataset, x1, x2) { > dxb <- (x2 - x1) %*% b > y1 <- # insert your y variable here > y2 <- # insert your y variable here > sum( > (pmax(y1, dxb) - pmax(y2, dxb) - dxb)^2 + > 2*(y1 < dxb)*(dxb-y1)*y2 + > 2*(y2 < -dxb)* (-dxb-y2)*y1 > ) > } > > fetobit <- function (dataset, form) { > x2 <- model.matrix(form, dataset[,T=2]) > x1 <- model.matrix(form, dataset[,T=1]) > # could maybe set initial values to something different > res <- optim(rep(0, ncol(x1)), fn=honore, x1=x1, x2=x2, > dataset=dataset, method="BFGS", control=list(maxit=1000)) > if (res$convergence != 0) warning("Didn't converge") > res$par > } > > For standard errors, bootstrap. > > > David Hugh-Jones > Research Associate > CAGE, Department of Economics > University of Warwick > http://davidhughjones.googlepages.com > > > > On 12 July 2011 21:38, Daniel Malter <dan...@umd.edu> wrote: > >> Not that I know of, but the paper says that they are easy to compute. If >> you >> did, you could contribute the code. >> >> Best, >> Daniel >> >> >> David Hugh-Jones-3 wrote: >> > >> > Hi all, >> > >> > Is there any code to run fixed effects Tobit models in the style of >> Honore >> > (1992) in R? >> > (The original Honore article is here: >> > >> http://www.jstor.org/sici?sici=0012-9682%28199205%2960%3A3%3C533%3ATLALSE%3E2.0.CO%3B2-2 >> ) >> > >> > Cheers >> > David >> > >> > [[alternative HTML version deleted]] >> > >> > ______________________________________________ >> > R-help@r-project.org mailing list >> > https://stat.ethz.ch/mailman/listinfo/r-help >> > PLEASE do read the posting guide >> > http://www.R-project.org/posting-guide.html >> > and provide commented, minimal, self-contained, reproducible code. >> > >> >> -- >> View this message in context: >> http://r.789695.n4.nabble.com/fixed-effects-Tobit-Honore-style-tp3662246p3663464.html >> Sent from the R help mailing list archive at Nabble.com. >> >> ______________________________________________ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.