Questions tagged [stan]

Stan is software for Bayesian estimation using the No-U-Turn sampling (NUTS) algorithm instead of the simpler Gibbs sampling (BUGS).

Filter by
Sorted by
Tagged with
0 votes
1 answer
33 views

Methods for modelling distributions?

As predictor X I have particle size distributions and I would like to run a model y ~ X. I.e. each trial has a response ...
user avatar
  • 115
0 votes
0 answers
26 views

What is the correct bayesian formulation for the zero-truncated Poisson lognormal model?

In ecology we use compound distributions to describe species-abundance data. One example is the Poisson Lognormal (PLN) distribution which is a Poisson distribution with rate parameter $\lambda$ that ...
user avatar
1 vote
1 answer
21 views

Parallel with Weighted Least Squared in Bayesian Regression

I have a dataset with a column of ratios $Y = z_1 / z_2$, which will be my depending variable, and a set of columns that explain $Y$. Here $z_1$ means "imports" and $z_2$ means "exports&...
user avatar
0 votes
0 answers
42 views

Can we define inverse gamma priors in stan_glmer()?

Although I tried to read the manual, I don't quite see how I can incorporate the following model in stan_glmer(). $Y_{ij}|\mu_j,\sigma_y \sim N(\mu_j,\sigma_y^2)$ $\...
user avatar
  • 3,355
1 vote
1 answer
48 views

Posterior distributions --- what's the correct way to see it?

When running models from a bayesian perspective — a regression for example — we get posterior distribution for every parameter/statistic we want, right? I’m wondering whether I should see this this ...
user avatar
  • 541
1 vote
1 answer
37 views

Bayesian GLM where the response variable is count classes

Description of data I have to analyze some data where the response variable is the counts of number of insects observed feeding on a bait at many time points. The treatments are three different types ...
user avatar
  • 123
0 votes
0 answers
15 views

Estimating Proportions with Uncertainty from the American Community Survey

I'm interested in estimating Bayesian statistics related to some proportions from the American Community Survey (ACS). The American Community Survey has several useful handbooks here and two pertinent ...
user avatar
  • 141
9 votes
1 answer
166 views

Marginalizing out discrete response variables in Stan

There's been quite a bit of discussion and confusion about how to marginalize out discrete response variables in Stan (e.g. binary or ordinal data). See, for instance: Impute binary outcome variable ...
user avatar
  • 135
0 votes
0 answers
100 views

fit a model with a skewed distribution response with brms R package

I have some basics with STAN, and would like to move to the brms package for data analysis. I would like to correlate a metric to several variable (6 traits) and I also included 2 random effects. I ...
user avatar
  • 1
1 vote
1 answer
31 views

How to write proportionality in a Stan model?

I am having difficulties in writing the following equation into a Stan model. $$ y_i = \mu(x_i) + \epsilon_i \\ \epsilon_i \sim N(\theta,\sigma^2) \\ \mu(x_i) = a + b x_i \\ p(a) = p(b) \propto 1 \\ \...
user avatar
  • 11
0 votes
0 answers
26 views

Bayesian paired samples difference estimate

Let's say I have some observational clinical data of $N$ patients. They have a score (from 1 to 7) which is their level of symptom severity (1 being no symptoms, 7 being extremely symptomatic) at ...
user avatar
0 votes
0 answers
8 views

How to properly state a change in the highest distribution interval width?

Dear Bayesian modelers, could you help me with some lingo? Consider that we fit a Bayesian regression, really generic, y ~ alpha + beta*x. Let's focus on beta, the regression slope, which supposedly ...
user avatar
0 votes
0 answers
66 views

Does thinning in JAGS/Stan reduce computational time for simulating a chain of a given length?

Question Let's say we have a complicated model whose posterior distribution we want to draw from using MCMC. To do this, we simulate a chain of total length $N=10,000$. For the sake of this question, ...
user avatar
  • 158
0 votes
0 answers
17 views

Analysing repeated movement trajectories - is a GP the right approach?

I have some data where I have multiple conditions per subject (humans, in this case), who made repeated movements under these conditions. I'm interested in the variability of these movements. The data ...
user avatar
1 vote
1 answer
55 views

Help with rstan models [closed]

I would need help in order to write a specific Stan model. The biological question The idea of the model is modeling the number of Bones (NbBones : discret ...
user avatar
2 votes
1 answer
103 views

Difference in fitting to right censored data between MLE and Bayesian method

I am fitting a Weibull curve to right censored data. I am doing it by general MLE method using Survival::survreg() as well as Bayesian method using brms::brm. I am pretty sure that I am getting the ...
user avatar
1 vote
0 answers
103 views

How to fit a scalable Bayesian VAR model in Stan/JAGS

I am trying to fit a Bayesian vector auto regressive model but I am struggling with the computation. I tried both JAGS and Stan to fit the model but I have never been able to fit it successfully. It ...
user avatar
  • 300
1 vote
1 answer
165 views

How to add Gaussian noise on top of a logistic regression model in Stan?

I am building the following model for logistic regression in Stan (pystan): Predictor: $\eta_t = \beta_1 x_{1,t} + \beta_2 x_{2,t} + \beta_3 x_{3,t} + \beta_4 x_{4,t} + \sigma \epsilon_t$ Outcome: $...
user avatar
1 vote
1 answer
51 views

In JAGS, how can I fix a parameter to a distribution, as opposed to just a constant?

The first code chunk below (model1) is a JAGS script designed to estimate a two-group Gaussian mixture model with unequal variances. I am looking for a way to fix one of the parameters (say $\mu_2$) ...
user avatar
0 votes
0 answers
18 views

When doing a ROPE analysis for dichotomous predictors what kind of coding should I use?

I am using stan_lmer() to run a mixed effects analysis. The key variable I am interested in testing for the ROPE is an interaction between two dichotomous predictors. I understand that the scale of ...
user avatar
  • 1,641
0 votes
0 answers
24 views

How do I write the Jeffreys prior for error variance in stan? p(mu, sigma1^2, ... , sigmaC^2) propto Prod{ sigmai^-2 }

I need to model the Jeffreys prior for error variance in a heteroscedastic ANOVA design in rstan. That is to say, $\pi(\mu,\sigma_1^2,\dotsb,\sigma_C^2)\varpropto\Pi_{i=1}^{C}\sigma_i^{-2}$. Is the ...
user avatar
1 vote
0 answers
24 views

Bayesian estimation of ARMA coefficients

It's clear to me how to find the parameters of an AR(p) process in a Bayesian setting. E.g., AR(2), we could do $$ \alpha_1 \sim \mathcal{Normal}(0, 1)$$ $$ \alpha_2 \sim \mathcal{Normal}(0, 1)$$ $$ \...
user avatar
0 votes
0 answers
33 views

Success rate in BetaBinomial given weighted samples

I need advice on modeling my use case. Lets assume you have a population of X items and you have N trials. Each item $i$ from the overall population is selected/sampled to be evaluated with ...
user avatar
  • 1
2 votes
1 answer
249 views

Default Priors for Intercept and Standard Deviations in R package brms

The only resource I found explaining the default priors in brms is its manual (newest version, updated 03/14/2021) for function set_prior(). For the intercept, the manual does not specify how the ...
user avatar
  • 21
1 vote
0 answers
155 views

Is my Stan model correct? The Jeffreys prior for a heteroscedastic mixed-effects model

I am using rstan to derive MCMC samples from a heteroscedastic mixed-effects model with different residual variances $\sigma_j$ for each experimental condition $j$. One assumption is the Jeffreys ...
user avatar
0 votes
0 answers
112 views

Reproduce results of bayesglm with stan_glm

As indicated in the title, I am trying to reproduce the results of the bayesglm function with the stan_glm. In principle, the ...
user avatar
  • 21
0 votes
1 answer
56 views

Stop stan when it reaches convergence (Rhat = 1) [closed]

I'm doing a Bayesian analysis, which involves changing the warmup and iterations (many times per day). I wanted to know if there is a loop to automatically change warmups and interactions and stop the ...
user avatar
  • 3
1 vote
1 answer
70 views

Survival analysis for different diseases on same patients

I want to apply survival analysis on UFC-fights. Each fighter represents a "disease" and each knock-out is a "death". Each UFC fight consists of a number of rounds and the number ...
user avatar
  • 11
0 votes
0 answers
59 views

High pareto k values in bayesian occupancy modelling using UBMS package in R?

I'm using the new R package 'UBMS' to model occupancy which uses STAN within a Bayesian framework. My current 'best' model based on LOOIC values is the following; ...
user avatar
  • 1
0 votes
1 answer
280 views

Can PyStan models be used to make predictions after fitting?

Once I've fit a PyStan model, how can I use it to make future predictions without re-fitting?
user avatar
  • 103
1 vote
0 answers
74 views

Regression with SARIMA errors

After an SARIMA transformation, is $\epsilon_t$ equal to the difference in observed original $y_t$ from its estimate or the equivalent quantity for transformed $y_t$, $y'_t$? The motivation: I am ...
user avatar
  • 121
6 votes
1 answer
531 views

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

Background Errors-in-variables models are defined as: regression models that account for measurement errors in the independent variables. In contrast, standard regression models assume that those ...
user avatar
0 votes
0 answers
51 views

Bayesian sequential updating with current Bayesian sampling software?

I'm having a hard time implementing sequential updating with current software, I don't even know how to start. Basically, I'm having to refit the whole model by simply appending the new data to the ...
user avatar
1 vote
0 answers
94 views

How do I get around this "Argument 'coef' may not be specified when using boundaries."

I have a model, the brms code is given below. It is a system of equations (I am estimating demand for two categories of goods). Economic theory tells me that the intercepts have to be restricted to ...
user avatar
6 votes
2 answers
402 views

Example where the posterior from Jags and Stan are really different and have real impacts on decisions using the model

I have seen many people claiming Stan is "much better" than JAGS, meaning roughly this: "although Jags is much faster, the quality of the samples is worse. So it's worth waiting for the ...
user avatar
2 votes
0 answers
15 views

Method for Predicting Longitudinal Diagnostic Switching and Instability

Context Within my field (neuropsychology), there is a well-known issue for some individuals to have very unstable diagnoses overtime. My area of interest is in dementia where the ideal diagnostic ...
user avatar
  • 664
1 vote
1 answer
339 views

Eliminating divergent transitions in Stan

I have the following dataset - ...
user avatar
0 votes
1 answer
225 views

How to extract predicted values from stan_lmer()

I fitted a stan_lmer model and tried to extract predicted (predict() function) but R suggested me to use posterior_predict() but cannot at this point plot the predicted vs observed plot, as I have a ...
user avatar
  • 11
1 vote
0 answers
19 views

Using discrete random variable as index in JAGS

I have a model that can be distilled into, $$d \sim U(1,20)$$ $$Y_t \sim N(X_{t-d},\sigma^2)$$ for two time series that have observations from $Y_{1,..,t}$ and $X_{1,...,t}$. I'm trying to code it up ...
user avatar
1 vote
2 answers
397 views

Why do Pareto/NBD models require custom likelihood functions in PyMC3 and Stan?

I'm interested in Bayesian modeling of customer lifetime value (CLV), preferably via PyMC3. I've found that research in this area started mid-to-late 1900's and has remained active since. It would ...
user avatar
  • 1,650
2 votes
1 answer
104 views

Finite Binomial mixture model

I have a finite Binomial mixture model coded up in stan as below: ...
user avatar
1 vote
1 answer
65 views

Why are my predictied values from a Bayesian AR(1) model lagging behind the data?

Summary: I have simulated some data on an AR(1) process in R and fit the model in Stan. When plotting the predictions, the predicted values tend to lag behind the true values. Why is this? Detail I am ...
user avatar
  • 135
0 votes
0 answers
138 views

Bayesian model validation LOOCV

I am fitting a Bayesian logistic regression using Stan in R. My model will be used for drawing inference rather than prediction. My dataset is very small (around 50 observations) so I am planning on ...
user avatar
0 votes
0 answers
45 views

How do I implement a default prior of cauchy(0,1) in rstanarm?

What I intend to do is use a default prior on my coefficients, and then to compute Bayes Factors for those coefficients. Rouder and Morey (2012) say: "When using the Cauchy prior, s describes the ...
user avatar
  • 1,641
4 votes
0 answers
50 views

Priors as Controls : Bayesian Regression

I have a general question about Bayesian Regression Modeling and how a prior might be used as a means to control for (close to) simultaneous events. I often face a situation where I have a time series ...
user avatar
  • 7,650
2 votes
0 answers
82 views

How to define informative priors from previous studies using stan_glm?

I am trying to develop a linear regression model for estimating stature from handprint measurements. I would like to employ the Bayesian approach and define informative priors from the previous ...
user avatar
  • 21
1 vote
1 answer
250 views

Specifying specific priors for a correlation matrix via Stan

I'm trying to estimate a correlation matrix for a model where I already have a sense of the values of the off-diagonals based on existing studies. I'm quite new to Bayesian analysis so trying to learn ...
user avatar
1 vote
0 answers
21 views

Structuring Composed Bayesian Programs

I am considering writing some stan code to predict soccer game outcomes. More specifically, I thought that modelling the two halves of a game separately and then combining them would be an interesting ...
user avatar
1 vote
0 answers
285 views

Choosing a prior for the intercept in a logistic regression with increased -INF probability?

I am trying to fit a simple logistic regression of the kind: n ~ binomial(N, theta) theta = inv_logit( a + x * b ) where x is either 0 or 1 depending if a ...
user avatar
  • 11
2 votes
0 answers
148 views

How to incorporate multiple likelihoods in a probabilistic graphical model with Stan?

Data composition: In beta testing of a video game, users were assigned tasks in a many-to-many relationship. At the end of every day, users were asked to self evaluate (for each task) whether they ...
user avatar
  • 1,650

1
2 3 4 5