To analyse right-censored data, I'm using the tobit regression package called censReg in R. When assuming a fixed effect model, this works fine.
library(censReg)
library(tidyverse)
x=rep(c(0,2,4,6,8),20)
beta0=rep(rnorm(20,0,1),each=5)
ind=rep(1:20,each=5)
beta=2
y=x*beta + beta0 +rnorm(100,0,0.5)
data=data.frame(x=x,y=y,ind=ind) %>% mutate(y_cens=ifelse(y>12,12,y))
fit = censReg(y_cens ~ x,left=-Inf,right=12, data = data)
fit
Call: censReg(formula = y_cens ~ x, left = -Inf, right = 12, data = data)
Coefficients: (Intercept) x logSigma -0.35715
2.00235 0.01105
But when assuming a random intercept (as I would do in other R packages), the function does not seem to work anymore.
fit = censReg(y_cens ~ x + (1|ind),left=-Inf,right=12, data = data)
fit
Call: censReg(formula = y_cens ~ x + (1 | ind), left = -Inf, right = 12, data = data)
Coefficients: NULL
However,in the vignette (see here), the authors mention some methods to solve random-effect model, but they do not explain how to write it.