Skip to content

Instantly share code, notes, and snippets.

@arosh
Last active January 2, 2022 05:55
Show Gist options
  • Save arosh/69331f37ae160b71917d53ddcd3c279c to your computer and use it in GitHub Desktop.
Save arosh/69331f37ae160b71917d53ddcd3c279c to your computer and use it in GitHub Desktop.
hotbath
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
data {
int<lower=0> Y[4];
}
parameters {
real mu;
real<lower=0> sigma;
}
transformed parameters {
vector<lower=0>[4] theta;
theta[1] = normal_cdf(39.5 | mu, sigma);
theta[2] = normal_cdf(40.5 | mu, sigma) - normal_cdf(39.5 | mu, sigma);
theta[3] = normal_cdf(41.5 | mu, sigma) - normal_cdf(40.5 | mu, sigma);
theta[4] = 1 - normal_cdf(41.5 | mu, sigma);
}
model {
Y ~ multinomial(theta);
}
generated quantities {
int<lower=0> Y_pred[4];
Y_pred = multinomial_rng(theta, sum(Y));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment