# NOT RUN {
#truncated normal underlying data
y_star <- rtnorm(n = 1000, mu = 0.5, sd = 1, a = 0)
#apply censoring
y <- ifelse(y_star <= 0.25, 0.25, y_star)
#find MLE estimates
mod_result <- tcensReg(y ~ 1, v = 0.25, a = 0)
pseudo_r2(mod_result, type="m")
# }
Run the code above in your browser using DataLab