[R] Fitting Random effect tobit model

From: Abdus Sattar <upsattar_at_yahoo.com>
Date: Thu, 10 May 2007 07:46:17 -0700 (PDT)

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



R-help_at_stat.math.ethz.ch 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. Received on Thu 10 May 2007 - 14:55:55 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 10 May 2007 - 16:31:50 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.