Skip to main content
19 votes
Accepted

How to summarize credible intervals for a medical audience

Quick thoughts: 1) The key issue is what applied question you are trying to answer for your audience, because that determines what information you want from your statistical analysis. In this case, ...
John K. Kruschke's user avatar
18 votes
Accepted

Divergent transitions in Stan

A divergent transition in Stan tells you that the region of the posterior distribution around that divergent transition is geometrically difficult to explore. For example here is a quote from the ...
Patrick's user avatar
  • 1,419
16 votes

What is the purpose of "transformed variables" in Stan?

Objects declared in the transformed parameters block of a Stan program are: Unknown but are known given the values of the objects in the ...
Ben Goodrich's user avatar
  • 2,008
14 votes

Why are there recommendations against using Jeffreys or entropy based priors for MCMC samplers?

This is of course a diverse set of people with a range of opinions getting together and writing a wiki. I summarize I know/understand with some commentary: Choosing your prior based on computational ...
Björn's user avatar
  • 32.4k
11 votes
Accepted

How is Simplex related to statistics at all?

If you have a disjoint set of possible events (say three of them) that exhaust all possiblites, the probabilities of each of these events must sum to one: $$p_1 + p_2 + p_3 = 1$$ Being probabilities,...
Matthew Drury's user avatar
11 votes
Accepted

Low effective sample size but good R-hat is this a problem?

In BDA3 on page 285, they mention that $\hat{R}$ is an estimate of "the factor by which the scale of the current distribution for [a particular univariate parameter] might be reduced if the ...
Taylor's user avatar
  • 20.7k
10 votes

In Stan is there a way to use parameter posterior from old analysis as prior in new analysis?

As mentioned by previous answers, Stan, JAGS, and WinBUGS require that priors be specified as mathematical functions. If you've already got an MCMC-represented posterior from a previous analysis, ...
John K. Kruschke's user avatar
9 votes
Accepted

How to build a Bayesian regression model of a response that is a Gaussian mixture

Likelihood For a mixture of two Gaussians, the likelihood can be written as: $$ y_i \sim \pi N(y_i|\alpha_0 + x_i\beta, \sigma_0) + (1-\pi) N(y_i|\alpha_1 + x_i\beta, \sigma_1) $$ where $\pi \in [0, ...
AtALoss's user avatar
  • 478
9 votes
Accepted

Why are there recommendations against using Jeffreys or entropy based priors for MCMC samplers?

They do not provide any scientific/mathematical justification for doing so. Most of the developers do not work on this kind of priors, and they prefer to use more pragmatic/heuristic priors, such as ...
Prior's user avatar
  • 106
9 votes
Accepted

Stan $\hat{R}$ versus Gelman-Rubin $\hat{R}$ definition

I followed the specific link given for Gelman & Rubin (1992) and it has $$ \hat{\sigma} = \frac{n-1}{n}W+ \frac{1}{n}B $$ as in the later versions, although $\hat{\sigma}$ replaced with $\hat{\...
Aki Vehtari's user avatar
9 votes
Accepted

Is it appropriate to estimate a random slope without estimating the overall mean slope?

Fitting random slopes with the population-level slope fixed to zero is not out of the question - it's not mathematically or statistically ill-posed - but it's a rather weird model that would require ...
Ben Bolker's user avatar
  • 43.7k
9 votes

How to propagate measurement uncertainty in predictors *and* responses for multidimensional, non-parametric regression (and software to do it)?

One of the more interesting choices in R is rstan, where you could code this up yourself in the Stan modeling language (which tends to be amazing in that it can ...
Björn's user avatar
  • 32.4k
8 votes
Accepted

How to plot prior distributions in Stan?

As my previous answer was deleted, here is a more explicit one, with an example using a simple sampling from the prior: ...
Pascal's user avatar
  • 357
8 votes
Accepted

Bayesian lighthouse location estimation

This is a famous problem known as Gull's Lighthouse, from an example by Gull in 1988. It has deep implications when taken one additional step in both the social sciences and in physics. You actually ...
Dave Harris's user avatar
  • 7,670
8 votes

What is a good number of treedepth saturations for a fit stan model?

In No-U-Turn-Sampler a maximum tree depth of 10 is a sensible default, but occasionally you have to increase it. In my experience not usually by much. I might try 12 next and I have never had to go ...
Björn's user avatar
  • 32.4k
8 votes

What is a good number of treedepth saturations for a fit stan model?

I'll leave this as an "answer" as I don't have enough reputation to "comment" on this post. This webpage might be of interest to you. The development team describses here, although quite shortly, ...
baruuum's user avatar
  • 663
8 votes
Accepted

Impute binary outcome variable for GLM using Stan in R

Each value of y_miss can either be 0 or 1, so you need to marginalize over them with a statement such as ...
Ben Goodrich's user avatar
  • 2,008
7 votes
Accepted

Understanding Prior in rstanarm

First stan_lm only accepts one type of prior: ...
Wayne's user avatar
  • 21.2k
7 votes
Accepted

What do blank cells mean in the output of prior_summary in the brms package?

Possibility 2 is the correct one. Prior specification in brms is hierarchical in the sense that if a global prior for a parameter class is specified, it will be used for all coefficients of that class ...
Paul Buerkner's user avatar
7 votes

What is the PDF of a Normal convolved with a Laplace

Let's work it out from first principles, beginning with the hard work of computing a convolution. As an auxiliary calculation, consider the distribution of $W=X+Y$ where $Y$ has an Exponential ...
whuber's user avatar
  • 324k
6 votes

In Stan is there a way to use parameter posterior from old analysis as prior in new analysis?

Most software such as Stan, WingBUGS, SAS etc. requires you to provide an analytic form for the prior instead of MCMC samples. Possible ways around it are to refit the model with all data or to ...
Björn's user avatar
  • 32.4k
6 votes
Accepted

How and When to Use Marginalization in Stan

Stan only samples from continuous parameter spaces, so for something like a finite mixture model, it is necessary to do marginalization to use Stan. On the other hand, if you have a hierarchical model ...
HStamper's user avatar
  • 1,481
6 votes

Bayesian lighthouse location estimation

The flashes' positions are modeled precisely by the Cauchy, as @user25459 said, so it's no coincidence that Stan is able to estimate the true values using this model (I use $\alpha$ for $\mu$, and $\...
jpneto's user avatar
  • 762
6 votes
Accepted

Why does Stan initialize an MCMC chain with a random value generated uniformly from [-2, 2] instead of a random value generated from the prior?

The biggest problem with drawing from the prior is if a user is using a rather flat prior. For example, if a user is using a logistic regression model and they don't want the prior to have much of an ...
Cliff AB's user avatar
  • 21.1k
6 votes
Accepted

Matt's trick (reparametrization) makes my models slower, not faster

It is not unheard of for the centered parameterization to be better. This post on the Stan forums goes into the exact same issue. There it is suggested that [...] centered actually works better when ...
einar's user avatar
  • 4,272
5 votes
Accepted

Highest Density Interval in Stan

I don't know about pyStan specifically, but it's straight forward to compute an HDI from an MCMC sample, if you assume that the underlying distribution is unimodal. Basically, to compute the 95% HDI, ...
John K. Kruschke's user avatar
5 votes
Accepted

Marginalizing a Poisson-distributed count parameter in a Binomial Distribution

$y \mid p,\lambda$ is Poisson! Your marginalization, or at least the end result, is correct. The form you have obtained for the distribution is the probability mass function of a Poisson distribution ...
Juho Kokkala's user avatar
  • 7,923
5 votes

"Unidentified" hierarchical model in brms/stan - where to go from here?

From your model summary I see that you have 4209 obervations in total and 3091 persons. That is, most persons only have 1 corresponding data point and therefore it will be difficult to estimate the ...
Paul Buerkner's user avatar
5 votes
Accepted

How to use simulation to check the correctness of my Bayesian model?

It sounds as if you are looking for the procedure described in this paper, which is implemented in the BayesValidate R package and the pp_validate function in the ...
Ben Goodrich's user avatar
  • 2,008
5 votes
Accepted

Effect of smoking on lung cancer incidence with time-weighted pack-years

In Stan, you could start out like ...
Ben Goodrich's user avatar
  • 2,008

Only top scored, non community-wiki answers of a minimum length are eligible