Bayesian sparse Tobit regression for censored response via Gibbs sampler. This is based on the paper:
"High-dimensional Bayesian Tobit regression for censored response with Horseshoe prior."
Install the package using:
devtools::install_github('tienmt/tobitbayes')
or install with vignettes "tutorial"
devtools::install_github(
"tienmt/tobitbayes",
build_vignettes = TRUE,
build_opts = c("--no-resave-data", "--no-manual")
)
library(tobitbayes)
# simulate data
set.seed(1)
n = 100
p = 5
X <- matrix(rnorm(n * p), n, p)
beta0 <- c(2, -1, rep(0,p-2) )
y <- X %*% beta0 + rnorm(n)
# censor the response to value c = 0
y[y < 0] <- 0
# fit the Gibbs sampler
res <- tobit_bayes(y, X)(posterior_means <- colMeans(res$beta_samples))
# plot output
plot(posterior_means, type = 'h',
main = "Posterior Means of Beta",
ylab = "Mean")res$selected