Learn R Programming

BayesLogit (version 0.6.1)

compute.mixture: Compute Mixture

Description

Compute the means, variances, and probabilities to approximate a -log(Ga) distribution or a type III logistic distribution.

Usage

compute.mixture(shape, type=c("log.gamma", "logistic.iii"))

Arguments

shape

The shape parameter.

type

The type of distribution to approximate, either a -log(Ga(shape,1)) distribution or a type III logistic(shape) distribution.

Value

Returns a list with components m, v, p representing the mean, variance, and probability of the specific discrete mixture of normals.

Details

Fruhwirth-Schnatter et al. use tables of discrete mixtures of normals to approximate entire families of distributions. These approximations are useful for data augmentation techniques that lead to convenient posterior simulation for certain classes of generalized linear models. In particular, approximations to the -log(Ga) distribution and the type III logistic distribution are useful for negative binomial regression and for binomial logistic regression respectively.

This function generates the means, variances, and probabilities that approximate either a -log(Ga) or type III logistic distribution.

The code that produces these values can be found in the functions compute.mixture.lg and compute.mixture.l3, which cannot be called directly. compute.mixture.lg is an R translation of MATLAB code found in the bayesf package. compute.mixture.l3 is taken from the R package binomlogit. The function compute.mixture.l3 returns a list without an array of means, since they are identically zero.

References

Agnes Fussl. binomlogit: Efficient MCMC for Binomial Logit Models (2012).

Sylvia Fruhwirth-Schnatter. bayesf. URL <http://statmath.wu.ac.at/~fruehwirth/monographie/> (2007).

Sylvia Fruhwirth-Schnatter, Rudolf Fruhwirth, Leonhard Held, Havard Rue. Improved auxiliary mixture sampling for hierarchical models of non-Gaussian data. Statistics and Computing (2009).

Sylvia Fruhwirth-Schnatter and Rudolf Fruhwirth. Data Augmentation and MCMC for Binary and Multinomial Logit Models. Statistical Modelling and Regression Structures (2010), Springer-Verlag.

Agnes Fussl, Sylvia Fruhwirth-Schnatter and Rudolf Fruhwirth. Efficient MCMC for Binomial Logit Models (2013).

See Also

draw.indicators

Examples

Run this code
# NOT RUN {
## Approximate - log[Ga] using mixture of normals.
sp = 9
nm = compute.mixture(sp, "log.gamma")
nc = length(nm$m)

r  = sample.int(nc, 10, replace=TRUE, prob=nm$p)
e  = rnorm(10, nm$m[r], sqrt(nm$v[r]))

r.post = draw.indicators(e, nm)

## Approximate type III logistic using mixture of normals.
sp = 9
nm = compute.mixture(sp, "logistic.iii")
nc = length(nm$m)

r  = sample.int(nc, 10, replace=TRUE, prob=nm$p)
e  = rnorm(10, nm$m[r], sqrt(nm$v[r]))

r.post = draw.indicators(e, nm)

# }

Run the code above in your browser using DataLab