[R] Tobit estimation?

Ken Knoblauch knoblauch at lyon.inserm.fr
Thu Jan 19 11:57:14 CET 2006


If you look at ?survreg, you might notice that there is no link argument,
but that
reference is made to survreg.old that does contain a link argument.  Thus,

help(survreg,package=survival)
> 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.000000 0.8381902 2.3445745
2 2.834993 0.6603959 0.4572142
3 2.322114 0.6683632 0.2619112
4 0.000000 0.3762860 1.8897217
5 1.977283 0.9713827 0.8079159
6 0.536224 0.8266868 1.1839211
> library(survival)
Loading required package: splines
> tfit <- survreg(Surv(y, y>0, type='left') ~ x1 + x2,
+                   data=D, dist='gaussian', link='identity')
Error in survreg.control(...) : unused argument(s) (link ...)
+
> tfit <- survreg.old(Surv(y, y>0, type='left') ~ x1 + x2,
+                   data=D, dist='gaussian', link='identity')
> tfit
Call:
survreg(formula = formula, data = data, dist = dist, scale = scale)

Coefficients:
(Intercept)          x1          x2
   1.594501    2.825190   -2.985390

Scale= 1.493047

Loglik(model)= -66.1   Loglik(intercept only)= -109.7
	Chisq= 87.28 on 2 degrees of freedom, p= 0
n= 100
>
-- 
Ken Knoblauch
Inserm U371
Cerveau et Vision
Dept. of Cognitive Neuroscience
18 avenue du Doyen Lépine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: +33 (0)6 84 10 64 10
http://www.lyon.inserm.fr/371/




More information about the R-help mailing list