[R] Tobit estimation?
Ajay Narottam Shah
ajayshah at mayin.org
Thu Jan 19 09:35:58 CET 2006
Folks,
Based on
http://www.biostat.wustl.edu/archives/html/s-news/1999-06/msg00125.html
I thought I should experiment with using survreg() to estimate tobit
models.
I start by simulating a data frame with 100 observations from a tobit model
> x1 <- runif(100)
> x2 <- runif(100)*3
> ystar <- 2 + 3*x1 - 4*x2 + rnorm(100)*2
> y <- ystar
> censored <- ystar <= 0
> y[censored] <- 0
> D <- data.frame(y, x1, x2)
> head(D)
y x1 x2
1 0.0000000 0.86848630 2.6275703
2 0.0000000 0.88675832 1.7199261
3 2.7559349 0.38341782 0.6247869
4 0.0000000 0.02679007 2.4617981
5 2.2634588 0.96974450 0.4345950
6 0.6563741 0.92623096 2.4983289
> # Estimate it
> library(survival)
> tfit <- survreg(Surv(y, y>0, type='left') ~ x1 + x2,
data=D, dist='gaussian', link='identity')
It says:
Error in survreg.control(...) : unused argument(s) (link ...)
Execution halted
My competence on library(survival) is zero. Is it still the case that
it's possible to be clever and estimate the tobit model using
library(survival)?
I also saw the two-equation setup in the micEcon library. I haven't
yet understood when I would use that and when I would use a straight
estimation of a censored regression by MLE. Can someone shed light on
that? My situation is: Foreign investment on the Indian stock
market. Lots of firms have zero foreign investment. But many do have
foreign investment. I thought this is a natural tobit situation.
--
Ajay Shah http://www.mayin.org/ajayshah
ajayshah at mayin.org http://ajayshahblog.blogspot.com
<*(:-? - wizard who doesn't know the answer.
More information about the R-help
mailing list