Created
April 18, 2023 20:34
-
-
Save ericnovik/e7dc23ca84320290409454d6728feb47 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data { | |
int<lower=0> N; | |
array[N] int<lower=0, upper=1> y; | |
real<lower=0> a; | |
real<lower=0> b; | |
} | |
parameters { | |
real<lower=0, upper=1> theta; | |
} | |
model { | |
// beta prior | |
target += (a - 1) * log(theta) + (b - 1) * log(1 - theta); | |
// likelihood | |
for (i in 1:N) { | |
target += log(theta) * y[i] + log(1 - theta) * (1 - y[i]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment