rbprobitGibbs {bayesm}R Documentation

Gibbs Sampler (Albert and Chib) for Binary Probit

Description

rbprobitGibbs implements the Albert and Chib Gibbs Sampler for the binary probit model.

Usage

rbprobitGibbs(Data, Prior, Mcmc)

Arguments

Data

list(y, X)

Prior

list(betabar, A)

Mcmc

list(R, keep, nprint)

Details

Model and Priors

z = X\beta + e with e \sim N(0, I)
y = 1 if z > 0

\beta \sim N(betabar, A^{-1})

Argument Details

Data = list(y, X)

y: n x 1 vector of 0/1 outcomes
X: n x k design matrix

Prior = list(betabar, A) [optional]

betabar: k x 1 prior mean (def: 0)
A: k x k prior precision matrix (def: 0.01*I)

Mcmc = list(R, keep, nprint) [only R required]

R: number of MCMC draws
keep: MCMC thinning parameter -- keep every keepth draw (def: 1)
nprint: print the estimated time remaining for every nprint'th draw (def: 100, set to 0 for no print)

Value

A list containing:

betadraw

R/keep x k matrix of betadraws

Author(s)

Peter Rossi, Anderson School, UCLA, perossichi@gmail.com.

References

For further discussion, see Chapter 3, Bayesian Statistics and Marketing by Rossi, Allenby, and McCulloch.

See Also

rmnpGibbs

Examples

if(nchar(Sys.getenv("LONG_TEST")) != 0) {R=2000} else {R=10}
set.seed(66)

## function to simulate from binary probit including x variable
simbprobit = function(X, beta) {
  y = ifelse((X%*%beta + rnorm(nrow(X)))<0, 0, 1)
  list(X=X, y=y, beta=beta)
}

nobs = 200
X = cbind(rep(1,nobs), runif(nobs), runif(nobs))
beta = c(0,1,-1)
nvar = ncol(X)
simout = simbprobit(X, beta)

Data1 = list(X=simout$X, y=simout$y)
Mcmc1 = list(R=R, keep=1)

out = rbprobitGibbs(Data=Data1, Mcmc=Mcmc1)
summary(out$betadraw, tvalues=beta)

## plotting example
if(0){plot(out$betadraw, tvalues=beta)}

[Package bayesm version 3.1-6 Index]