[R] Fitting Random effect tobit model

Abdus Sattar upsattar at yahoo.com
Thu May 10 16:46:17 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 outcome variable) 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:
 
 
library(splines)
library(survival)
setwd('C:/data')   
data=read.table('C:/data/Ruser4897.csv', sep=",")           
names(data)=c("sub", "x", "y", "w") 
data[1:100,]  
x=data[,2]
y=data[,3]
w=data[,4]
 
survreg(Surv(y, y>=0, type='left')~x, dist='gaussian', weight=w)
 
The output is as follows:
 
Call:
survreg(formula = Surv(y, y >= 0, type = "left") ~ x, weights = w, 
    dist = "gaussian")
 
Coefficients:
(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 in survreg function so that I can get the estimated 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 my coding. 
 
Sincerely, 
 
Sattar

_________________________________________
protection around 
http://mail.yahoo.com 


More information about the R-help mailing list