francogrex
2007-May-03 07:21 UTC
[R] Bayesian logistic regression with a beta prior (MCMClogit)
Dear all, I am trying to use the logistic regression with MCMClogit (package: MCMCpack/Coda) and I want to put a beta prior on the parameters, but it's giving me error message (please see output below) no matter what shape 1 or 2 I use. It works perfect with the cauchy or normal priors. Do you know if there is a catch there somewhere? Thanks logpriorfun <- function(beta,shape1,shape2){ sum(dbeta(beta,shape1,shape2, log=T)) } posterior <- MCMClogit(nausea~nsaid*diuretic, data=w, verbose=2000,burnin = 1000, mcmc = 10000, user.prior.density=logpriorfun,shape1=1,shape2=1) user.prior.density(beta.start) == -Inf. Error in MCMClogit(nausea ~ nsaid * diuretic, data = w, verbose = 2000, : Respecify and call MCMClogit() again. -- View this message in context: http://www.nabble.com/Bayesian-logistic-regression-with-a-beta-prior-%28MCMClogit%29-tf3684970.html#a10300145 Sent from the R help mailing list archive at Nabble.com.
Cody_Hamilton at Edwards.com
2007-May-03 17:58 UTC
[R] Bayesian logistic regression with a beta prior (MCMClogit)
Dear Franco, Have you tried using the beta.start option in MCMClogit? (The problem may be where you are starting your chain.) Regards, -Cody francogrex <francogrex at mail. com> To Sent by: r-help at stat.math.ethz.ch r-help-bounces at st cc at.math.ethz.ch Subject [R] Bayesian logistic regression 05/03/2007 12:21 with a beta prior (MCMClogit) AM Dear all, I am trying to use the logistic regression with MCMClogit (package: MCMCpack/Coda) and I want to put a beta prior on the parameters, but it's giving me error message (please see output below) no matter what shape 1 or 2 I use. It works perfect with the cauchy or normal priors. Do you know if there is a catch there somewhere? Thanks logpriorfun <- function(beta,shape1,shape2){ sum(dbeta(beta,shape1,shape2, log=T)) } posterior <- MCMClogit(nausea~nsaid*diuretic, data=w, verbose=2000,burnin = 1000, mcmc = 10000, user.prior.density=logpriorfun,shape1=1,shape2=1) user.prior.density(beta.start) == -Inf. Error in MCMClogit(nausea ~ nsaid * diuretic, data = w, verbose = 2000, : Respecify and call MCMClogit() again. -- View this message in context: http://www.nabble.com/Bayesian-logistic-regression-with-a-beta-prior-%28MCMClogit%29-tf3684970.html#a10300145 Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help at stat.math.ethz.ch 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.