Description Usage Arguments Value Examples
View source: R/plotBayes_function.R
This function plots the prior, likelihood, and posterior distribution of the sample mean. It reports the MAP (maximum a posteriori) and EAP (expected a posteriori) estimates of the mean as well as the 95% credible interval around the MAP.
1 2 |
data |
A vector of data |
prior.type |
The type of distribution for the prior. Can be "uniform" or "normal" |
prior.parameters |
A vector of length two providing the parameter values for the prior. When prior.type="normal", the values are the mean and sd. When prior.type="uniform", the values are the min and the max. |
min |
The minimum possible value of mu to consider. |
max |
The maximum possible value of mu to consider. |
points |
The number of values of mu to be calculated, higher means more precision. Defaults to 1000. |
credible |
The width of the credible interval specified as a number between zero and one. Defaults to 0.95 for a 95% credible interval. |
Returns a list with the following components:
mean
The sample mean of the data.
map
The maximum a posteriori estimate of the mean.
eap
The expected a posteriori estimate of the mean.
credible.interval
The values defining the endpoints of the Bayesian credible interval.
1 2 3 4 5 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.