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
1
vote
0answers
11 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
130 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
29 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
6 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 ...
3
votes
1answer
120 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 ...
1
vote
0answers
6 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
47 views

Eliminating divergent transitions in Stan

I have the following dataset - ...
0
votes
1answer
13 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 ...
0
votes
0answers
7 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
120 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
31 views

Finite Binomial mixture model

I have a finite Binomial mixture model coded up in stan as below: ...
1
vote
1answer
36 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
26 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
25 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
21 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
45 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
21 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
28 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 ...
1
vote
0answers
54 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
39 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
89 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
75 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
88 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
54 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
24 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
159 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
18 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 ...
1
vote
1answer
63 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 ...
0
votes
0answers
26 views

Best way to get a single sequence of states using Viterbi algorithm in Stan/R

I am writing this up because it seems like there should be a standard, easy way to do this and I just haven't found it. I wrote up my Viterbi algorithm in Stan as shown here in the Stan User's Guide, ...
1
vote
1answer
75 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
37 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) \\ ...
0
votes
0answers
63 views

Specifying several independent priors in stan_glm() in R

I am using the function stan_glm() in R. I am using 4 predictor variables and I want to specify a univariate independent prior for each regression parameter. Right ...
1
vote
0answers
17 views

How to model repeated measurements with the same outcome in a Bayesian framework?

Can't think of a more accurate title, so I'll illustrate the problem with an example. I want to record temperature using cheap noisy sensors. I also have recordings from a gold-standard reference ...
4
votes
0answers
54 views

Why does Quadratic (Normal/Laplace) Approximation fail on multilevel models?

In Statistical Rethinking, 2nd Edition, section 13.1, Richard McElreath says: Why doesn’t simple quadratic approximation, using for example quap, work with multilevel models? When a prior is itself a ...
2
votes
1answer
82 views

Interpretation of coefficients in mixed-effects model with circular response?

I have a dataset from an experiment where wild ants were surveyed continuously for 24 hours under a number of temperature treatments (chambers). Whenever an ant was observed, the species of the ant ...
1
vote
1answer
424 views

brms intercept only model runs very slow

I am trying to learn brms package for multilevel modeling. A reproducible code is as below: ...
1
vote
0answers
16 views

hierachical modeling of body temperature data to design thresholds for CoVID-19 testing

I am working through designing an approach to identifying temperature thresholds for CoVID-19 testing. I thought I would post my problem and see if any had recommendations. Basically, I have a large ...
0
votes
0answers
37 views

elpd_diff and se_diff

My comparision result from RSTAN is as below: elpd_diff se_diff fit2 0.0 0.0 fit4 0.0 0.0 fit3 -0.9 0.3 fit1 -1.8 2.7 ...
5
votes
1answer
90 views

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

I am currently programming a hierarchical model in Stan. Following the advice from section 22.7 from the Stan manual, I reparametrized my model so it samples the individual differences from a $N(0,1)$ ...
2
votes
1answer
49 views

Intuitive explanation of PSIS-LOO cross-validation

I've been using Pareto-smoothed importance sampling (PSIS-LOO) cross-validation for diagnosis and comparing Bayesian models fitted with Stan/brms for a while now. ...
0
votes
1answer
22 views

estimate distribution of results from one experiment based on earlier experiment

I have results from an experiment where I counted how many times I got a positive result from independent bernoulli trials. I can estimate the uncertainity on the rate, and get 2.5%-97.5% CI for the ...
0
votes
0answers
24 views

Coxme/Surv_Stan model to Quantify Individual Consistency/Repeatability

I am not sure if I am barking up the wrong tree here. Briefly, I have experimental data with 2 trials repeated across 25 subjects (individuals). End goal: to establish some measure of consistency ...
1
vote
1answer
26 views

How do you generate data that can be used for a binomial family stan_glmer model with random effects?

I am wondering how I can generate binomial sample data that can be used for a stan_glmer random effects model. For example, is this a correct example? ...
3
votes
2answers
193 views

Are Jacobian adjustments necessary when the target parameter is a difference between two parameters in Stan?

[Note on cross-posting: This question has now been posted on the Stan Forums as well.] I want to model the index called Delta P (e.g., p.144 of this paper), which is basically a difference between two ...
4
votes
1answer
183 views

What is the PDF of a Normal convolved with a Laplace

I'd like to see if using Stan or similar I can successfully model Laplace noise added to data through the use of a convolved Normal-Laplace distribution and MCMC sampling. In the literature I can only ...
2
votes
1answer
112 views

Structural equation models without circular definition of latent variables

I'm trying to perform Bayesian structural equation modeling in Python and PyMC3, but I think the problem is similar for most probabilistic progamming languages, include JAGS, Stan, etc. SEMs are ...
0
votes
1answer
32 views

Define log likelihood for CJS model in Stan

FYI, I'm new to Stan and this is my first question here. I'm unsure how to calculate the log likelihood for a Cormack-Jolley-Seber model in Stan. Can anyone help me with this? Background: I've made ...
1
vote
1answer
81 views

Bayesian matrix factorization

I am working with Bayesian matrix factorization using the MovieLens database. Data consist of a matrix $n \times d$ of $n=943$ users and $d=1682$ movies where users assign a rate (1-5) to movies. ...
0
votes
0answers
69 views

Correlated random slopes in brms

I am experiencing a problem in fitting a brms model to count data. The model specification below results in a fit with a relatively low ESS (~1000-1200) given 4000 post-warmup iterations. This appears ...

1
2 3 4 5