Description Usage Arguments Value Source References See Also Examples
Define the posterior distribution function for π (θ | t ), with a gamma prior distribution π ( θ; α, β ) and a gamma sampling distribution with known shape parameter a and unknown rate parameterθ.
1 |
t |
a sample data from a gamma distribution with shape a and rate θ ( t > 0 ). |
a |
the known shape parameter of the gamma sampling distribution (a > 0). |
shape |
the shape parameter of the prior gamma distribution for unknown θ (α > 0). |
rate |
the rate parameter of the prior gamma distribution for unknown θ (β > 0). |
scale |
equals 1 / rate ( > 0). |
An object of class "g12post
" is returned.
prior |
the prior distribution for unknown θ , i.e. the gamma(α,β) distribution. |
likelihood |
the likelihood function of t given θ, i.e. the f(t | θ) distribution. |
posterior |
the posterior distribution of θ given t. |
theta |
the unknown rate parameter of the gamma sampling distribution t π ( θ; α, β ). |
pri.shape |
the shape parameter of the gamma distribution for prior. |
pri.rate |
the rate parameter of the gamma distribution for prior. |
pos.shape |
the shape parameter of the gamma distribution for posterior. |
pos.rate |
the rate parameter of the gamma distribution for posterior. |
model |
the prior and likelihood type to produce the posterior. |
For theory details, based on STATG012 slides 5 Example 5.4 from Moodle at UCL.
Fink, D. 1997. A Compendium of Conjugate Priors. Weblink.
summary.g12post
for summararies of prior
and posterior distribution.
plot.g12post
for plots of prior and posterior
distribution.
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## an exponential distribution with a gamma prior, similiar
## as Example 5.4 from slides 6
## generate a sample of 10 observations from an exponential distribution
x <- rexp(10)
## find the posterior density and summary it
gam <- gamgam(x, a = 1, 4, 2)
summary(gam)
## generate a sample of 50 observations from a gamma distribution with a = 2
y <- rgamma(10, shape = 2)
## find the posterior density and plot it
ex <- gamgam(y, a = 2, 4, 2)
plot(ex, leg_pos = "center" , box.lty=0)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.