Baffled MCMClogit

Can someone explain to me why

simulatedCase <- rbinom(100,1,0.5)
simDf <- data.frame(CASE = simulatedCase)
posterior_m0 <<- MCMClogit(CASE ~ 1, data = simDf, b0 = 0, B0 = 1)

      

always results in an MCMC acceptance rate of 0? Any explanation would be greatly appreciated!

+2


source to share


2 answers


I think your problem is the model formula as logistic regression models have no error . So the model CASE ~ 1

should be replaced with something like CASE ~ x

(predictor variable x

required). Here's your example, modified:

CASE <- rbinom(100,1,0.5)
x <- 1:100
posterior_m0 <- MCMClogit (CASE ~ x, b0 = 0, B0 = 1)
classic_m0 <- glm (CASE ~ x,  family=binomial(link="logit"), na.action=na.pass)

      



So, I think your problem is not related to the MCMCpack library (disclaimer: I have never used this package).

+3


source


For those facing this problem:

It seems that MCMClogit function cannot handle anything other than B0 = 0 if your model only has interception.



If you add covariance, you can specify the precision exactly.

I'd look at other packages (like hands or rjags) if you really want to try this model. For a list of options available for Bayesian regression see http://cran.r-project.org/web/views/Bayesian.html

0


source







All Articles