if (FALSE) {
## default improper uniform prior
data(birthwt)
posterior <- MCMClogit(low~age+as.factor(race)+smoke, data=birthwt)
plot(posterior)
summary(posterior)
## multivariate normal prior
data(birthwt)
posterior <- MCMClogit(low~age+as.factor(race)+smoke, b0=0, B0=.001,
data=birthwt)
plot(posterior)
summary(posterior)
## user-defined independent Cauchy prior
logpriorfun <- function(beta){
sum(dcauchy(beta, log=TRUE))
}
posterior <- MCMClogit(low~age+as.factor(race)+smoke,
data=birthwt, user.prior.density=logpriorfun,
logfun=TRUE)
plot(posterior)
summary(posterior)
## user-defined independent Cauchy prior with additional args
logpriorfun <- function(beta, location, scale){
sum(dcauchy(beta, location, scale, log=TRUE))
}
posterior <- MCMClogit(low~age+as.factor(race)+smoke,
data=birthwt, user.prior.density=logpriorfun,
logfun=TRUE, location=0, scale=10)
plot(posterior)
summary(posterior)
}
Run the code above in your browser using DataLab