# Using dbeta to represent a uniform distribution of bounds(0, 1)
x <- seq(-.1, 1.1, .001)
plot(x, dbeta(x, 1, 1),
type = "l", ylab = "Density", xlab = "x",
lwd = 2, cex.lab = 1.5, cex.axis = 2
)
## Create an S4 prior object
p_prior <- BuildPrior(
p0 = c(A = 0.15, B = 0.45, mean_v = 2.25, sd_v = 0.15, t0 = 0.2),
p1 = rep(0.1, 5),
lower = rep(NA, 5),
upper = rep(NA, 5),
dist = rep("tnorm", 5),
log_p = rep(NA, 5)
)
print_prior(p_prior)
# Use the beta distribution to create uniform densities
# lower and upper set the bounds. If lower is NA, it will be set to 0.
# If upper is NA, it will be set to 1.
p_prior <- BuildPrior(
p0 = c(A = 1, B = 1, mean_v = 1, sd_v = 1, t0 = 1),
p1 = rep(1, 5),
lower = rep(0, 5),
upper = rep(5, 5),
dist = rep("beta", 5),
log_p = rep(FALSE, 5)
)
p0 <- plot_prior(p_prior, font_size = 3.5, cex = 3.5)
Run the code above in your browser using DataLab