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
0answers
7 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 ...
1
vote
1answer
45 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 ...
2
votes
1answer
72 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 ...
1
vote
0answers
21 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 being able to fit it successfully. It ...
0
votes
1answer
36 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: $...
1
vote
1answer
27 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$) ...
0
votes
0answers
16 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 ...
0
votes
0answers
19 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 ...
1
vote
0answers
20 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)$$ $$ \...
0
votes
0answers
25 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 ...
1
vote
0answers
75 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 ...
1
vote
0answers
65 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 ...
0
votes
0answers
37 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 ...
0
votes
1answer
42 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 ...
1
vote
1answer
69 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 ...
0
votes
0answers
25 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; ...
0
votes
0answers
16 views

Highly correlated posterior parameter draws when adding more predictors to the model

I’ve ran into a weird issue with my model that I can’t make sense of. I have a Poisson regression model that I has a lot of predictors (21). The weird thing is that if I include all 21 predictors the ...
0
votes
1answer
66 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?
0
votes
0answers
28 views

Log predictive density

We want to calculate the log predictive density of our bayesian linear regression model that we have been made with Stan in R. We would like to get some input of how we can calculate it because we`re ...
1
vote
0answers
44 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 ...
5
votes
1answer
273 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 ...
0
votes
0answers
41 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 ...
0
votes
0answers
33 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 ...
4
votes
2answers
153 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 ...
2
votes
0answers
12 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 ...
0
votes
1answer
156 views

Eliminating divergent transitions in Stan

I have the following dataset - ...
0
votes
1answer
69 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 ...
1
vote
0answers
10 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 ...
1
vote
1answer
245 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 ...
2
votes
1answer
54 views

Finite Binomial mixture model

I have a finite Binomial mixture model coded up in stan as below: ...
1
vote
1answer
49 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 ...
0
votes
0answers
79 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 ...
0
votes
0answers
49 views

Hierarchical Model for ragged/ unbalanced data (in STAN)

(I'm fairly new to Bayesian modelling please forgive me any minor accidents in my questions) I'm trying to model a data set in STAN, but don't understand why I get large no. divergent transitions. The ...
0
votes
0answers
27 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 ...
4
votes
0answers
47 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 ...
0
votes
0answers
34 views

How to implement a default prior in a stan_lmer() model?

I have found Rouder and Morey (2012) suggesting a default prior of cauchy(0,1). I would like to implement this in a linear mixed effects model I’m computing using stan_lmer(). However I have both ...
0
votes
0answers
45 views

Typical set clarification

I was reading more about the use of typical sets when it comes to MCMC methods, like this post by the Stan documentation. Unfortunately, I am confused by several points: One example I have seen ...
2
votes
0answers
68 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 ...
0
votes
1answer
119 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 ...
1
vote
0answers
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 ...
1
vote
0answers
156 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 ...
2
votes
0answers
102 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 ...
0
votes
1answer
182 views

R Stan: Rejecting initial value error only with real data, not with simulated data

I am trying to fit a non-linear function to a dataset using Stan and R. I tested my model with a simulated dataset. It works nicely. However, as soon as I use real data that is formatted exactly the ...
3
votes
1answer
68 views

How to interpret the univariate Fisher's noncentral hypergeometric density PMF?

This is my first time posting so I apologize in advance for any errors! I am struggling to understand the probability mass function (PMF) of the Fisher's noncentral hypergeometric distribution, which ...
-1
votes
2answers
33 views

Stan syntax, arrays versus integers? [closed]

I'm new to STAN, and on the job I've been given some sample training code. ...
4
votes
1answer
275 views

Finite Beta mixture model in stan -- mixture components not identified

I'm trying to model data $0 < Y_i < 1$ with a finite mixture of Beta components. To do this, I've adapted the code given in section 5.3 of the Stan manual. Instead of (log)normal priors, I am ...
1
vote
0answers
20 views

Generalised linear mixed model with Kent distribution family

I am working with spherical directional data. I need to estimate the parameters of the Kent distribution family. The data also has uniformly distributed noise. This paper describes similar problem ...
2
votes
1answer
109 views

Can divergent transitions signify that I am trying to fit too complex of a model / overfitting?

Divergent transitions are explained here (1) in the stan docs. They occur when the posterior has curvature that is varying too much. My thought was that maybe the posterior would vary a lot in regions ...
1
vote
1answer
91 views

Training a Bernoulli model using probabilities as inputs

I'm using two methods to train a Bernoulli model, and am trying to understand why they are not yielding similar results. For both methods, I have a length $N$ array of probabilities $\{\hat{y}^{(n)}\}...
1
vote
0answers
53 views

Marginalizing a time-series model in Stan

I'm trying to implement the following model in Stan $$ \theta[i] \thicksim Normal(0,1) \\ b[k] \thicksim Uniform(0.0, 2.5) \\ a[k] \thicksim Normal(0,1) \\ guess[k] \thicksim Uniform(0.0, 0.5) \\ ...

1
2 3 4 5