Comments (5)
You also don't need blocks with nothing in them and you can vectorize everything. This model should look like this:
data {
int N[2];
vector[N[1]] y1;
vector[N[2]] y2;
}
parameters {
vector[2] mu;
vector<lower=0>[2] sigma;
}
model {
mu ~ normal(0, 10);
sigma ~ cauchy(0, 5);
y1 ~ normal(mu[1], sigma[1]);
y2 ~ normal(mu[2], sigma[2]);
}
It'd be even easier if we had ragged arrays.
from example-models.
The case studies eventually go on the web site repo. Your Stan model has lots of problems you can see in just this fragment:
parameters { //The primary parameters of interest that are to be estimated.
real mu1; // mean of y1
...
real<lower=0> sigma1; // standard deviation of y1
...
}
model { // Where your priors and likelihood are specified. Uniform, cauchy, and normal
// priors might be a good place to start?
mu1 ~ uniform(0, 30); // uniform prior, maybe try half-normal, exp, or half-cauchy
...
y1 ~ normal(mu1, sigma1);
...
The code itself has some problems:
- if you put a uniform distribution on
mu1
, then you need to constrain the parameter to have matching lower and upper bounds---Stan models should have a finite log likelihood for all parameter values meeting the declared constraints - we recommend much more informative priors
The doc also has some issues
mu1
isn't the mean ofy1
, it's a location parameter- you don't want to doc the language in a program, such as what the parameters block is
- you have lingering open-ended questions on the model---these are best left on the outside
from example-models.
@bob-carpenter Thanks for the feedback! I'll work on correcting this. This is a learning process for me.
from example-models.
For the moment, we're trying to keep the case studies to best practices recommendations for Stan. We're working on establishing a place for more community oriented sharing of work we wouldn't need to vet so closely. There are prior recommendations on the stan-dev/stan wiki and in the manual regression chapter.
from example-models.
Thanks again @bob-carpenter ! I am working on how to vectorize data. I appreciate the model re-write.
ara
from example-models.
Related Issues (20)
- `stan_demo` example 500 not working HOT 4
- Missing function in Introduction
- Error in BPA Ch.10 js_super.stan with possible fix HOT 1
- rats ref link at top of stan files is broken
- Add .data.R files for knitr models HOT 1
- Rdump format
- Reorganize the stan example repository HOT 13
- sampling() fails in Lotka-Volterra example HOT 3
- Lotka-Volterra example not running HOT 1
- BUGS Background Information for Litter Example HOT 1
- Failed to build Lotka Vollterra on Mac OS / clang HOT 9
- reduce_sum case study will be out of date once new cmdstanr pull gets merged
- Example script `fit_nyc_bym2.R` to use model `bym2_offset_only.stan` doesn't work HOT 1
- Subtle error in some capture-recapture likelihoods HOT 3
- [Error] Validate transformed params
- Survey.stan example from Cognitive Modeling - Expected end of file after end of generated quantities block. HOT 9
- Which book/chapter HOT 1
- updates to ARM model for normal_id_glm - variable name "cov" should be "x_as_mat" or something like that HOT 6
- add Python scripts to BYM12 case study
- Parameter names for stan file HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from example-models.