| BCLogit {Baldur} | R Documentation |
BCLogit produces iid draws from the posterior density of a bayesian conditional logit model with a multivariate normal prior.
BCLogit(y,X,alpha,mu,P,draws,Prec=FALSE,A=FALSE)
y |
n*m Matrix with counts for the m alternatives |
X |
n*km Matrix with the values for the independent variables associated with each alternativs |
alpha |
n*m Matrix added to Xbeta |
mu |
k*1 Prior Mean Vector |
P |
k*k Prior Precision Matrix (must be Positive definite) |
draws |
Number of desired draws from the posterior density |
Prec |
Optional logical argument with default Prec=FALSE. If argument is set to TRUE, the matrix P is treated as a prior precision matrix. |
A |
Optional logical argument with default A=FALSE. If argument is set to TRUE, the function returns not only the simulated draws from the posterior density but also a vector with information related to the acceptance rate for the underlying accept/reject procedure (see below). |
Makes use of the likelihood subgradient density accept/reject procedure of Nygren and Nygren (2006) in order to generate iid samples from the posterior density of a Bayesian conditional logit model. If the posterior density is close to multivariate normal, then the expected number of draws should be approximately equal to $(2/sqrt{pi})^{k(m-1)}$.
If A=FALSE, a matrix beta. If A=TRUE, a list containing the matrix beta and a matrix Accept.:
beta |
draws*k(m-1) matrix with the iid draws for the model parameters. |
Accept |
draws*1 matrix with the number of candidates for each draw that were required before acceptance in the accept/reject procedure. |
Kjell Nygren knygren@us.imshealth.com
data(Travel,package="Baldur") y<-as.matrix(Travel[,2:5]) X<-as.matrix(Travel[,6:29]) alpha<-matrix(0,nrow=210,ncol=4) mu<-matrix(0,nrow=6,ncol=1) P<-100*diag(6) draws<-100 system.time(sim<-BCLogit(y,X,alpha,mu,P,draws))