Skip to content

Instantly share code, notes, and snippets.

@aakhmetz
Created December 9, 2024 07:21
Show Gist options
  • Save aakhmetz/205461cf16d1f295e808fb363b088575 to your computer and use it in GitHub Desktop.
Save aakhmetz/205461cf16d1f295e808fb363b088575 to your computer and use it in GitHub Desktop.
20241209_Bayesian_class
{
"a0": 0.700102,
"b0": 1,
"N": 94,
"k": 8
}
data {
real<lower = 0> a0;
real<lower = 0> b0;
int<lower = 1> N; // total number of infections
int<lower = 0, upper = N> k; // number of infections among vaccinated
}
parameters {
real<lower = 0, upper = 1> theta;
}
transformed parameters {
real<lower = -1, upper = 1> VE = (1 - 2 * theta) / (1 - theta);
}
model {
theta ~ beta(a0, b0);
//target += beta_lpdf(theta | a0, b0);
k ~ binomial(N, theta);
}
generated quantities {
int k_pred = binomial_rng(N, theta);
}
{"title":"Untitled"}
{"num_chains":4,"num_warmup":1000,"num_samples":1000,"init_radius":2}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment