##########################################################################
## Access simulated data set #############################################
##########################################################################
data(sim_SA)
##########################################################################
## Set priors ############################################################
##########################################################################
priors <- list(a = 1, r = 1, theta = c(0.01, 0.00001))
##########################################################################
## Run model #############################################################
##########################################################################
res <- saBayes(formula = Human~Source1+Source2+Source3+Source4+Source5,
time=~Time, location=~Location, type=~Type,
data=sim_SA$data, priors = priors,
alpha_conc = 1, prev = sim_SA$prev,
likelihood_dist = "pois", n_iter = 20)
##########################################################################
#### Summary #############################################################
##########################################################################
s <- summary(res, alpha = 0.05, burn_in = 1, thin = 1)
# print the median and HPD for the type effects
s$q
# print the median and HPD for the lambda's for each source
# for time 2, location A
s$lj_proportion$time2$locationA
## or
s$lj_proportion[[2]][[1]]
Run the code above in your browser using DataLab