Displaying 2 results from an estimated 2 matches for "logpriorfun".
2007 May 03
1
Bayesian logistic regression with a beta prior (MCMClogit)
...ion 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 ~ ns...
2007 Mar 09
1
MCMC logit
...sidering four covariates
> d.df=as.data.frame(read.table("c:/tina/phd/thesis/data/modified_data1.1.txt",header=T,sep=","))
> y=d.df[,ncol(d.df)]
> x=d.df[,1:4]
> c.df=cbind(y,x)
> #x=cbind(1,x)
> p <- ncol(c.df)
>
> # marginal log-prior of beta[]
> logpriorfun <- function(beta, mu, gshape, grate)
+ {
+ logprior = -p*log(2) + log(gamma(p+gshape)) - log(gamma(gshape))
+ + gshape*log(grate) - (p+gshape)* log(grate+sum(abs(beta)))
+ return(logprior)
+ }
> require(MCMCpack)
Loading required package: MCMCpack
Loading required package: coda
Loading requir...