views:

96

answers:

1

Could anybody 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 a MCMC acceptance ratio of 0? Any explanation would be greatly appreciated!

+2  A: 

I think your problem is the model formula, since logistic regression models have no error term. Thus you model CASE ~ 1 should be replaced by something like CASE ~ x (the predictor variable x is mandatory). Here is 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).

Leonardo de Oliveira Martins
This code works, but it fits two variables, the intercept and the linear term for the dependence on x. What I originally intended was to use MCMClogit just to fit the intercept, without dependence on x (a weird scenario, I know...)..
Alexander