fitMixture: A standard Bayesian mixture model for outliers using a...

Description Usage Arguments Details Value See Also

View source: R/fitMixture.R

Description

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

Usage

 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
)

Arguments

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

Details

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.

Value

A list of length 4: the joint posterior, the two marginals, and the posterior means

See Also

fitOrderStat


jrlewi/brlm documentation built on March 17, 2021, 1:10 a.m.