## Not run:
# ## Examples below should take about 1-2 minutes.
#
# ## ------ (use simul_pois1) ------
# data(simul_pois1)
# y <- simul_pois1$y
# X <- as.matrix(simul_pois1[, -1])
#
# # Bayesian variable selection for simulated data set
# m1 <- negbinBvs(y = y, X = X)
#
# # print results (check acceptance rate for 'rho')
# print(m1)
#
# # re-run with adapted tuning parameter 'eps'
# m2 <- negbinBvs(y = y, X = X, prior = list(eps = 0.4))
#
# # print and summarize results
# print(m2)
# summary(m2)
#
# # alternatively, compare results to overdispersed Poisson model with
# # normal random intercept (subject to selection), provided in 'poissonBvs'
#
# # specify observation-specific random intercept
# cID <- seq_along(y)
# m3 <- poissonBvs(y = y, X = X, model = list(ri = TRUE, clusterID = cID))
#
# # print, summarize and plot results
# print(m3)
# summary(m3)
# # note that thetaB is not selected (!)
#
# plot(m3, burnin = FALSE, thin = FALSE)
#
#
# ## ------ (use data set "azdrg112" from package "COUNT") ------
#
# if (!requireNamespace("COUNT", quietly = TRUE)){
# stop("package 'COUNT' is needed for this example to work.
# Please install it.")
# }
#
# library(COUNT)
# # load data set 'azdrg112'
# # (Arizona Medicare data for DRG (Diagnostic Related Group) 112)
# data(azdrg112)
#
# y <- as.numeric(azdrg112$los) # hospital length of stay: 1-53 days
# X <- as.matrix(azdrg112[,-1]) # covariates (gender, type1, age75)
# m4 <- negbinBvs(y = y, X = X, mcmc = list(M = 4000))
#
# # print results (check acceptance rate for 'rho')
# print(m4)
# summary(m4)
# plot(m4, burnin = FALSE)
#
# # adapte tuning parameter eps (and set BVS to FALSE)
# prior <- list(eps = 0.1)
# m5 <- negbinBvs(y = y, X = X, mcmc = list(M = 4000), prior = prior,
# BVS = FALSE)
#
# # print, summarize and plot results
# print(m5)
# summary(m5)
# plot(m5, burnin = FALSE, thin = FALSE)
# plot(m5, type = "acf", lag.max = 50)
# ## End(Not run)
Run the code above in your browser using DataLab