Stan with Stata, Part V: Kicking a marble around in a bucket
In the last few postings I have described how the Bayesian analysis program, Stan, can be called from within Stata. Before we can go any further we have to understand how Stan works, which is to say we need to understand the basics of Hamiltonian Monte Carlo, as this is Stan’s way of sampling from the posterior. I’ll start […]
wbslist update
Thanks to Ole-Petter Moe Hansen for pointing out a small bug in wbslist. The version released with my book would sometimes lose track of the format when listing a set of matrices. I managed to track down the source of the error. It seems that I had two counters, one tracking the matrices and the other […]
Stan with Stata, Part IV: Automation
Last time I presented a very basic do file for running Stan from within Stata and although the program worked, there were places where we had to find work-arounds that meant that the process was not fully automatic. In particular, we had to write the script manually, we used Stata’s shell command to run the compiled code and we had to copy […]
Stan with Stata, Part III: A first attempt
This week I am going to present a program that runs Stan from within Stata, but in this version, there will be a minimum of automation. Next time, I will modify the wbs programs, designed for running WinBUGS, so that they will also work with Stan and at that stage the process will be simpler to use but less transparent. We […]
Stan with Stata, Part II: installing and testing Stan
This week I want to install Stan on a Windows computer and check the installation independently of Stata, so that next week we can move on to controlling Stan from within Stata. Stan has several flavours, for instance, there is an R package that controls Stan, but for us the important version is the stand alone […]
Stan with Stata (Part 1): A plan of action
In the book ‘Bayesian Analysis with Stata’ I described how we can fit a Bayesian model using Stata to control WinBUGS and OpenBUGS and last year, in this blog, I showed how the same approach could be used to control another BUGS-like program called JAGS. So, currently, we have a choice of three programs for […]
MCMCglmm in Stata (Part 2)
Last time, I showed how we can write R code for fitting a Bayesian Generalized Linear Mixed Model and insert it into a Stata do file, so that the computation is performed by the R program, MCMCglmm, while the results are available in Stata. The drawback of that approach is that it requires the user […]
Software Updates
Over time my programs for Bayesian analysis with Stata evolve and, I hope, improve. Periodically, I update my webpage at https://www2.le.ac.uk/Members/trj to reflect these changes. There are three recent updates that might be of interest. Philip Besuner contacted me to report an error in the logdensity.ado file when calculating the log-density for the lognormal distribution. […]
MCMCglmm in Stata (Part I)
I always advise students not to tie themselves to one piece of statistical software, even when it is as good as Stata. It is inevitable that whichever statistical package they choose, there will be tasks that are easier in another program or analyses that their favourite does not offer. The problem with this advice is that it takes […]
Poisson regression with two random effects: MCMC by data augmentation Part II
Most of my postings are based on bits of code that were produced for other reasons; perhaps for my teaching or for my research or sometimes they are left over from when I was writing the book on Bayesian Analysis with Stata. So typically I spend a couple of hours each week on the blog; […]
Recent Comments