Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

discrete.bayes

Posterior distribution with discrete priors


Description

Computes the posterior distribution for an arbitrary one parameter distribution for a discrete prior distribution.

Usage

discrete.bayes(df,prior,y,...)

Arguments

df

name of the function defining the sampling density

prior

vector defining the prior density; names of the vector define the parameter values and entries of the vector define the prior probabilities

y

vector of data values

...

any further fixed parameter values used in the sampling density function

Value

prob

vector of posterior probabilities

pred

scalar with prior predictive probability

Author(s)

Jim Albert

Examples

prior=c(.25,.25,.25,.25)
names(prior)=c(.2,.25,.3,.35)
y=5
n=10
discrete.bayes(dbinom,prior,y,size=n)

LearnBayes

Functions for Learning Bayesian Inference

v2.15.1
GPL (>= 2)
Authors
Jim Albert
Initial release
2018-03-18

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.