Tobit type II in brms?

Hello. Is it possible to do tobit type II in brms?

I can do tobit type I with the following R codes using and brms.

library(dplyr)
library(brms)
library(cmdstanr)

# simulate the initial data
n <- 4000

set.seed(100)
x=rnorm(n, mean=1,sd=2)
sim_d <- tibble(y = rnorm(n, mean = .5+.5*x, sd = 1))

# create the censoring
sim_d <-  sim_d %>% 
  mutate(y1  = if_else(y < 0, 0, y),
         cen = if_else(y < 0, "left", "none"))
sim_d$x<-x

fit <-
  brm(
    y1 | cens(cen) ~ x,
    prior = c(prior(normal(1, 3), class = "b"),
              prior(normal(0, 3), class = sigma)),
    data = sim_d,
    family = gaussian,
    seed = 101,
    chains=4, cores=4, backend="cmdstanr")

summary(fit)

Appreciate any suggestions.

1 Like