Skip to content
Archive of posts tagged R

Short course on Bayesian data analysis and Stan 18-20 July in NYC!

Jonah Gabry, Vince Dorie, and I are giving a 3-day short course in two weeks. Before class everyone should install R, RStudio and RStan on their computers. (If you already have these, please update to the latest version of R and the latest version of Stan, which is 2.10.) If problems occur please join the […]

Kéry and Schaub’s Bayesian Population Analysis Translated to Stan

Hiroki ITÔ (pictured) has done everyone a service in translating to Stan the example models [update: only chapters 3–9 so far, not the whole book; the rest are in the works] from Marc Kéry and Michael Schaub (2012) Bayesian Population Analysis using WinBUGS: A Hierarchical Perspective. Academic Press. You can find the code in our […]

Jim Albert’s Baseball Blog

Jim Albert has a baseball blog: Baseball with R I sent a link internally to people I knew were into baseball, to which Andrew replied, “I agree that it’s cool that he doesn’t just talk, he has code.” (No kidding—the latest post as of writing this was on an R package to compute value above […]

McElreath’s Statistical Rethinking: A Bayesian Course with Examples in R and Stan

We’re not even halfway through with January, but the new year’s already rung in a new book with lots of Stan content: Richard McElreath (2016) Statistical Rethinking: A Bayesian Course with Examples in R and Stan. Chapman & Hall/CRC Press. This one got a thumbs up from the Stan team members who’ve read it, and […]

rstanarm and more!

Ben Goodrich writes: The rstanarm R package, which has been mentioned several times on stan-users, is now available in binary form on CRAN mirrors (unless you are using an old version of R and / or an old version of OSX). It is an R package that comes with a few precompiled Stan models — […]

R sucks

I’m doing an analysis and one of the objects I’m working on is a multidimensional array called “attitude.” I took a quick look: > dim(attitude) [1] 30 7 Huh? It’s not supposed to be 30 x 7. Whassup? I search through my scripts for a “attitude” but all I find is the three-dimensional array. Where […]

Stan 2.7 (CRAN, variational inference, and much much more)

Stan 2.7 is now available for all interfaces. As usual, everything you need can be found starting from the Stan home page: Highlights RStan is on CRAN!(1) Variational Inference in CmdStan!!(2) Two new Stan developers!!!  A whole new logo!!!!  Math library with autodiff now available in its own repo!!!!!  (1) Just doing install.packages(“rstan”) isn’t […]

Short course on Bayesian data analysis and Stan 19-21 July in NYC!

Bob Carpenter, Daniel Lee, and I are giving a 3-day short course in two weeks. Before class everyone should install R, RStudio and RStan on their computers. If problems occur please join the stan-users group and post any questions. It’s important that all participants get Stan running and bring their laptops to the course. Class […]

Stan 2.5, now with MATLAB, Julia, and ODEs

As usual, you can find everything on the Stan Home Page. Drop us a line on the stan-users group if you have problems with installs or questions about Stan or coding particular models. New Interfaces We’d like to welcome two new interfaces: MatlabStan by Brian Lau, and  Stan.jl (for Julia) by Rob Goedman. The new […]

What does CNN have in common with Carmen Reinhart, Kenneth Rogoff, and Richard Tol: They all made foolish, embarrassing errors that would never have happened had they been using R Markdown

Rachel Cunliffe shares this delight: Had the CNN team used an integrated statistical analysis and display system such as R Markdown, nobody would’ve needed to type in the numbers by hand, and the above embarrassment never would’ve occurred. And CNN should be embarrassed about this: it’s much worse than a simple typo, as it indicates […]

Stan goes to the World Cup

I thought it would be fun to fit a simple model in Stan to estimate the abilities of the teams in the World Cup, then I could post everything here on the blog, the whole story of the analysis from beginning to end, showing the results of spending a couple hours on a data analysis. […]

Comment of the week

This one, from DominikM: Really great, the simple random intercept – random slope mixed model I did yesterday now runs at least an order of magnitude faster after installing RStan 2.3 this morning. You are doing an awesome job, thanks a lot!

(Py, R, Cmd) Stan 2.3 Released

We’re happy to announce RStan, PyStan and CmdStan 2.3. Instructions on how to install at: As always, let us know if you’re having problems or have comments or suggestions. We’re hoping to roll out the next release a bit quicker this time, because we have lots of good new features that are almost ready […]

Identifying pathways for managing multiple disturbances to limit plant invasions

Andrew Tanentzap, William Lee, Adrian Monks, Kate Ladley, Peter Johnson, Geoffrey Rogers, Joy Comrie, Dean Clarke, and Ella Hayman write: We tested a multivariate hypothesis about the causal mechanisms underlying plant invasions in an ephemeral wetland in South Island, New Zealand to inform management of this biodiverse but globally imperilled habitat. . . . We […]

Bayesian nonparametric weighted sampling inference

Yajuan Si, Natesh Pillai, and I write: It has historically been a challenge to perform Bayesian inference in a design-based survey context. The present paper develops a Bayesian model for sampling inference using inverse-probability weights. We use a hierarchical approach in which we model the distribution of the weights of the nonsampled units in the […]

Transitioning to Stan

Kevin Cartier writes: I’ve been happily using R for a number of years now and recently came across Stan. Looks big and powerful, so I’d like to pick an appropriate project and try it out. I wondered if you could point me to a link or document that goes into the motivation for this tool […]

Stan Model of the Week: PK Calculation of IV and Oral Dosing

[Update: Revised given comments from Wingfeet, Andrew and germo. Thanks! I’d mistakenly translated the dlnorm priors in the first version — amazing what a difference the priors make. I also escaped the less-than and greater-than signs in the constraints in the model so they’re visible. I also updated to match the thin=2 output of JAGS.] […]

Stupid R Tricks: Random Scope

Andrew and I have been discussing how we’re going to define functions in Stan for defining systems of differential equations; see our evolving ode design doc; comments welcome, of course. About Scope I mentioned to Andrew I would prefer pure lexical, static scoping, as found in languages like C++ and Java. If you’re not familiar […]

R package for effect size calculations for psychology researchers

Dan Gerlanc writes: I read your post the other day [now the other month, as our blog is on a bit of a delay] on helping psychologists do research and thought you might be interested in our R package, “bootES”, for robust effect size calculation and confidence interval estimation using resampling techniques. The package provides […]

Scalable Stan

Bob writes: If you have papers that have used Stan, we’d love to hear about it. We finally got some submissions, so we’re going to start a list on the web site for 2.0 in earnest. You can either mail them to the list, to me directly, or just update the issue (at least until […]