Get startedGet started for free

Interval estimates

Suppose Rebekah's posterior density for P is a beta curve with shape parameters 24.13 and 7.67.

To find a 90% Bayesian probability interval, you can use the beta quantile function qbeta() where the inputs are the probabilities 0.05 and 0.95.

Then you can use the beta_interval() function to plot the interval with some helpful annotations:

qbeta(c(0.05, 0.95), 24.13, 7.67)
beta_interval(0.90, c(24.13, 7.67))

This exercise is part of the course

Beginning Bayes in R

View Course

Exercise instructions

Suppose Harry also wants to find a probability interval for P; his beliefs about the proportion P are described by a beta curve with parameters 19 and 7.

  • Store the shape parameters of Harry's beta curve in a vector ab.
  • Use the function qbeta() to construct a 90% interval.
  • Use the beta_interval() function to visualize this probability interval.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Vector of beta parameters for Harry: ab


# Compute 90 percent interval


# Show the interval that is computed
Edit and Run Code