# NOT RUN {
library(ggplot2)
ais_female <- subset(ais, Sex == 1)
y <- ais_female$BMI
x <- matrix(ais_female$LBM, 1)
tau <- c(0.1, 0.5, 0.9)
case <- rep(1:length(y), length(tau))
prob <- frame_bayes(y, x, tau, M = 5000, burn = 1000,
method = 'bayes.prob')
prob_m <- cbind(case, prob)
ggplot(prob_m, aes(x = case, y = value )) +
geom_point() +
geom_text(aes(label = case)) +
facet_wrap(~variable, scale = 'free') +
xlab("case number") +
ylab("Mean probability of posterior distribution")
It takes time to run the following code.
kl <- frame_bayes(y, x, tau, M = 50, burn = 10,
method = 'bayes.kl')
kl_m <- cbind(case, kl)
ggplot(kl_m, aes(x = case, y = value)) +
geom_point() +
geom_text(aes(label = case)) +
facet_wrap(~variable, scale = 'free')+
xlab('case number') +
ylab('Kullback-Leibler')
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab