BayesMix: An R package for Bayesian Mixture Modeling
Bettina Grun
Department of Statistics and Probability Theory
Vienna University of Technology
Abstract
The R package BayesMix provides the functionality for estimating univariate Gaussian mixture models with MCMC methods. Within a given model class users can modify the prior specifications and the initial values for developing a suitable model for their data. Furthermore, tools for analyzing the output of the MCMC simulations as, e.g., diagnostic plots, are available. The package is intended to be accompanying material for Fruhwirth-Schnatter(2006). With this package the user can comfortably reproduce some of the results presented in the book. The data sets and functions for generating the initial values and prior
specifications in the book are provided.
http://statmath.wu.ac.at/~gruen/BayesMix/bayesmix-intro.pdf
Bayesian Generalized Linear Models using R2WinBUGS
https://aquila2.iseg.utl.pt/aqui ... tFile&fileId=132907
model
{
for( i in 1 : N ) {
r ~ dbin(p,n)
logit(p) <- alpha + beta * (x - mean(x[]))
rhat <- n * p
phat <- r/n
}
beta ~ dnorm(0.0, 0.001)
alpha ~ dnorm(0.0, 0.001)
}
> data.b <- c("x", "n", "r", "N"); par.b <- c("alpha", "beta")
> bin.reg <- bugs(data.b, inits=NULL, par.b, "model-beetles1.txt",
n.chains = 3, n.iter = 20000, n.thin=1, bugs.directory = bugsdir,
+ working.directory = getwd(), clearWD=TRUE, debug=TRUE)
>
> print(bin.reg, digits=3)
alpha <- bin.reg$sims.array[,1 ,"alpha"]
beta <- bin.reg$sims.array[,1 ,"beta"]
invlogit <- function(x)
{
1/(1 + exp(-x))
}
plot(x, r/n, cex=2, col="red", pch="o", type="b")
for(b in 1: 50){
points(x, invlogit((alpha - beta*mean(x)) + beta * x),
cex=0.5, type="l", col="grey", lty=3)
}
Simple linear regression using R2OpenBUGS
Testing Bugs Installation with Examples
The purpose of this annotated R code is simply to check that your installation of OpenBUGS, JAGS, BRugs, R2OpenBUGS, Rjags & R2jags are all running and talking to each other in the way that they should. It is assumed that all of these programs have been installed (see, e.g., "Installing BUGS and the R to BUGS Interface"; the installing.bugs.jags.pdf is available on the Psych 548 website). The R-code for this document is shown as text at the end of this file, and also as an ascii file, test.bugs.install.txt. If you want to run the code as you are reading this document, I recomment that you load the text file, test.bugs.install.txt, into RStudio or your favorite programming editor. It will be easier to transfer the code to R from a programming editor than from this pdf file.
Two Way Anova using BUGS
Main ContentsHierarchical Model using WinBUGS and R(Bayesian Data Analysis,Andrew Gelman)
http://www.stat.columbia.edu/~gelman/bugsR/software.pdf
大小:1.56 KB
只需: 1 个论坛币 马上下载
CAR model with spatially-varying coefficients using R2WinBUGS
本附件包括:
Chris Sims, who got the Nobel Prize in Economics, or more precisely the Sveriges Riksbank Prize in Economic Sciences, has [also] done work in Bayesian econometrics. See for instance his talk on Why Econometrics Should Always and Everywhere Be Bayesian. Or his analysis of a counterexample of Larry Wasserman’s. He even has a tech report on adaptive Metropolis-Hastings algorithms (that apparently did not get published). He has also been teaching Bayesian statistics and econometrics at Princeton for many years, so this is a cool day for Bayesian stats! (The picture of a switching regime estimation on his webpage is actually similar to a rendering of mine from the late 90′s)
扫码加好友,拉您进群



收藏
