| rbprobitGibbs(bayesm) | R Documentation |
rbprobitGibbs implements the Albert and Chib Gibbs Sampler for the binary probit model.
rbprobitGibbs(Data, Prior, Mcmc)
Data |
list(X,y) |
Prior |
list(betabar,A) |
Mcmc |
list(R,keep) |
Model: y = Xbeta + e. e ~ N(0,I). Prior: beta ~ N(betabar,A^-1).
List arguments contain
XybetabarARkeepbetadraw |
R/keep x k array of betadraws |
Peter Rossi, Graduate School of Business, University of Chicago, Peter.Rossi@ChicagoGsb.edu.
For further discussion, see Bayesian Statistics and Marketing
by Allenby, McCulloch, and Rossi, Chapter 3.
http://gsbwww.uchicago.edu/fac/peter.rossi/research/bsm.html
## rbprobitGibbs example
##
set.seed(66)
simbprobit=
function(X,beta) {
## function to simulate from binary probit including x variable
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)
Data=list(X=simout$X,y=simout$y)
Mcmc=list(R=2000,keep=1)
out=rbprobitGibbs(Data=Data,Mcmc=Mcmc)
cat(" Betadraws ",fill=TRUE)
mat=apply(out$betadraw,2,quantile,probs=c(.01,.05,.5,.95,.99))
mat=rbind(beta,mat); rownames(mat)[1]="beta"; print(mat)