Hi,
what I see so far is that you have specified your user.prior.density correctly.
The error comes from the prior precision matrix B0 in combination with the
marginal.likelihood set to Laplace. B0, if not explicitly specified, defaults
to zero, which results in eigenvalues of zero. If Laplace is indicated for
the marginal.likelihood, the algorithm usually calls an optimization over
logpost.logit in BayesianFactors.R where the matrix B0 is tried to be
solved by solve(B0) ... as it is a zero matrix its linear equation system is
exactly singular and cannot be solved. The Function MCMClogit knows about this
fact and gives out a warning Cannot calculate marginal likelihood with
improper prior while changing marginal.likelihood to none.
So concluding: Choose your user.prior.density with marginal.likelihood = none
and all is fine (implicitly it is done so nevertheless).
Best
Simon
P.S. Using a name on a community help list will certainly improve the number of
answers to your questions.
On Jul 29, 2013, at 3:00 AM, ba0728 haleyb...@att.net wrote:
I'm an undergrad who is new to MCMCpack and I haven't been able to find an
answer to my problem online yet: I'm attempting to run MCMClogit with a
Cauchy proper prior but I'm getting the warning Cannot calculate marginal
likelihood with improper prior (my purposes require the marginal likelihood
calculation so I understand that I need to use a proper prior).
I'm trying to simulate the user-defined independent Cauchy prior with
additional args as specified in the MCMCpack User Manual (p. 76, April 2013
version). My input data has been standardized (mean = 0, sd = 0.5 for
non-binary variables, and binary variables with mean of 0 and difference of
1 between upper and lower ends) according to the Gelman 2008 paper on
logistic regression
(www.stat.columbia.edu/~gelman/research/published/priors11.pdf).
When I run the example data set (birthwt) from the User Manual, the
logpriorfun works correctly allowing the marginal likelihood to be
generated. However, when I try running my data with the logprior fun, I get
a warning that the prior is improper. Here is the code I am running:
*logpriorfun = function(beta, location,scale){
sum(dcauchy(beta, location, scale, log = TRUE))
}*
* MCMC.2= MCMClogit(DEAD ~ YEARS + MALE + x1 + x2 + x3+ x4 +x5 + x6 + x7 +
x8 + x9, tune= 0.65,burnin =500, mcmc=5000, data = dat, marginal.likelihood
= Laplace, user.prior.density=logpriorfun, logfun=TRUE, location = 0,
scale=2.5)
*
*@
The Metropolis acceptance rate was 0.27418
@
Warning message:
In MCMClogit(DEAD ~ YEARS + MALE + x1 + x2 + x3 + :
Cannot calculate marginal likelihood with improper prior*
Any advice on how to fix my arguments so it is a proper prior and will allow
me to generate a marginal likelihood using the Laplace approximation? Or how
should I be coding a Cauchy proper prior? I'm having problems defining the
priors.
Thanks, B.
--
View this message in context:
http://r.789695.n4.nabble.com/MCMClogit-Cannot-calculate-marginal-likelihood-with-improper-prior-tp4672561.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.