dRUMHAM
simulates the posterior distribution of the regression coefficients of a binomial logit model and returns the MCMC draws. The sampling procedure is based on an algorithm using data augmentation, where the regression coefficients are estimated by rewriting the binomial logit model as a latent variable model called difference random utility model (dRUM). For binomial observations where the success rate yi/Ni
is neither close to 0 nor close to 1 we use the normal distribution as for the dRUMIndMH
sampler to approximate the Type III generalized logistic distributed error in the dRUM representation. For extreme ratios yi/Ni <= low<="" code=""> and yi/Ni >= up
the error is approximated by the precise scale mixture of normal distributions as used for the dRUMAuxMix
sampler. The resulting posterior of this regression model is then used as proposal density for the regression coefficients.
=>
dRUMHAM(yi, Ni, X, sim = 12000, burn = 2000, b0, B0, start, low = 0.05, up = 0.95, verbose = 500)
dims = ncol(X)
containing the prior mean. Otherwise a vector of zeros is used.
dims x dims
prior variance-covariance matrix. Otherwise a diagonal matrix with all diagonal elements equal to 10 is used.
dims = ncol(X)
containing the starting values for the regression parameters. Otherwise a vector of zeros is used.
yi/Ni <= low<="" code=""> the precise mixture approximation is used instead of the simpler normal approximation. The default value is 0.05.
=>
yi/Ni >= up
the precise mixture approximation is used instead of the simpler normal approximation. The default value is 0.95.
verbose
-th iteration step a status report is printed (default: verbose = 500
). If 0, no output is generated during MCMC sampling.
c("binomlogitHAM","binomlogit")
containing
dims x sim
matrix of sampled regression coefficients from the posterior distributionsim
burn
dims = ncol(X)
)t = length(yi)
); covariate patterns where Ni = 0
are not includedb0
B0
low
up
sim-burn
MCMC draws after burn-insim-burn
MCMC draws after burn-inprint
, summary
and plot
. The print
method prints the number of observations and covariates entered in the routine, the total number of MCMC draws (including burn-in), the number of draws discarded as burn-in, the runtime used for the whole algorithm and for the sim-burn
MCMC draws after burn-in and the acceptance rate. The summary
method additionally returns the boundaries low
and up
used for HAM sampling, the prior parameters b0
and B0
and the posterior mean for the regression coefficients without burn-in. The plot
method plots the MCMC draws and their acf for each regression coefficient, both without burn-in.
dRUMIndMH
, dRUMAuxMix
, IndivdRUMIndMH
## Hybrid auxiliary mixture sampling in the aggregated dRUM representation
## of a binomial logit model
## load caesarean birth data
data(caesarean)
yi <- as.numeric(caesarean[,1])
Ni <- as.numeric(caesarean[,2])
X <- as.matrix(caesarean[,-(1:2)])
## start HAM sampler
ham1 <- dRUMHAM(yi,Ni,X)
## Not run:
# ham2 <- dRUMHAM(yi,Ni,X,low=0.01,up=0.99)
# ## End(Not run)
print(ham1)
summary(ham1)
plot(ham1)
Run the code above in your browser using DataLab