Description Usage Arguments Details Value See Also
Fiting the following mixture model:
θ\sim N(μ, τ^2), σ^2 \sim IG(α, β), y_i~(1-p)N(θ, σ^2)+pN(θ, c*σ^2)
where p and c are fixed by the user
1 2 3 4 5 6 7 8 9 10 11 12 13 | fitMixture(
y,
theta.lims,
length.theta,
sigma2.lims,
length.sigma2,
mu,
tau,
alpha,
beta,
p,
c
)
|
y |
vector of data |
tau |
mean and standard deviation of the normal prior distribution on μ |
alpha |
prior shape and scale of inverse gamma prior on σ^2 |
beta |
prior shape and scale of inverse gamma prior on σ^2 |
p, c |
fixed values for p and c in above model |
This implementation is fit on a grid of θ and σ^2 using Riemann sum numerical integration to find the marginal distribution of the data in a similar way as in fitOrderStat. This is rather naive but is relatively quick - it only works well if the choice of grid on which the Riemann sum is done is chosen carefully. The grid is specified by theta.lims, sigma2.lims, length.theta, and length.sigma2. The grid should cover the region of non-negligble posterior mass. The number of grid points (length.theta/length.sigma2) must be large enough for good precision. However, larger values increase computation time.
A list of length 4: the joint posterior, the two marginals, and the posterior means
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.