On Thu, 10 Mar 2011, Jen wrote:
Hi,
I'm trying to fit a tobit regression model to some data. When fitting the
exact same data in Stata, I have no problems at all, however R won't
converge. Its not a maxiters thing, since I've tried increasing this
already. I need to be able to fit the model in R since there are users of
the code that don't have a Stata license.
The code is:
require(AER)
left = 3.218476
x = c(0,6,12,18)
y = c(10.065819,7.803843,5.164786,3.218476)
mod<-tobit(y~x, left = left, right = Inf)
This gives back the following warning:
Warning in survreg.fit(X, Y, weights, offset, init = init, controlvals =
control, :
Ran out of iterations and did not converge
Has anyone come across this problem before or know a way to fix the
problem?
For such a dataset, it's unlikely that the optimization may not be
straightforward. I'm not sure what exactly Stata does and what survreg()
does for choosing starting values and for declaring convergence. But in
case of survreg() you can check the docs/code, and I would expect that
also Stata documents this sufficiently well. This may well be the source
of the differences in this small example.
What I did was simply providing my own starting values. In this case, the
OLS regression coefficients should be rather close to the tobit result.
Thus I did
m1 <- lm(y ~ x)
m2 <- tobit(y ~ x, left = 3.218476, init = coef(m1))
for which convergence is declared.
If anyone wants to use survreg() directly instead of the tobit()
interface:
y2 <- Surv(y, y > 3.218476, type = "left")
m3 <- survreg(y2 ~ x, dist = "gaussian", init = coef(m1))
which is exactly what tobit() does internally...
hth,
Z
Thanks in advance,
Jennifer
--
View this message in context:
http://r.789695.n4.nabble.com/tobit-regression-model-tp3345789p3345789.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.
______________________________________________
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.