[R] Fitting Random effect tobit model

Abdus Sattar upsattar at yahoo.com
Wed May 9 01:41:55 CEST 2007

Dear R-user:
I have a left censored longitudinally measured data set with 4 variables such as sub (which is id), x (only covariate), y (repeatedly measured response) and w (weights) (note, “-5” indicates the left censored value in the attached data set). I am using following R codes (“survival” library and “survreg” package) for fitting a random effect tobit model for the left censored longitudinal data:
data=read.table('C:/data/Ruser4897.csv', sep=",")           
names(data)=c("sub", "x", "y", "w") 
survreg(Surv(y, y>=0, type='left')~x, dist='gaussian', weight=w)
The output is as follows:
survreg(formula = Surv(y, y >= 0, type = "left") ~ x, weights = w, 
    dist = "gaussian")
(Intercept)           x 
-18.1990038   0.1749655 
Scale= 9.831055 
Loglik(model)= -23508.9   Loglik(intercept only)= -23947.1
        Chisq= 876.48 on 1 degrees of freedom, p= 0 
n=4840 (57 observations deleted due to missingness)
I am not seeing any estimated variance component in the output. Could you please help me in finding the appropriate argument so that I can get the estimated robust variance component in the output please? FYI, if I put “sub” using “cluster(sub)” in the model to get the variance component estimation, then following error message is giving:
> survreg(Surv(y, y>=0, type='left')~x+cluster(sub), dist='gaussian', weight=w)
Error in model.frame(formula, rownames, variables, varnames, extras, extranames,  : 
        invalid type (closure) for variable 'cluster(sub)'
I have another related question please. If it is possible, how may I fit the marginal (or population average) model for this data either by modifying following function or any other function?
survreg(Surv(y, y>=0, type='left')~x, dist='gaussian', weight=w)
Your suggestion or help could save me from breaking up this endeavor. I would really appreciate you if you could help me in figuring out the error in the approach. 

Do You 


More information about the R-help mailing list