Created
July 31, 2018 21:38
-
-
Save cqfd/b5cc3955da4a13600d8af4181f8d286f to your computer and use it in GitHub Desktop.
Stan model for MacKay's Chapter 3 particle detector example.
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 N; | |
real<lower=1, upper=20> observations[N]; | |
} | |
parameters { | |
real<lower=0> lambda; | |
} | |
model { | |
real Z = exp(-1/lambda) - exp(-20/lambda); | |
for (i in 1:N) { | |
target += exponential_lpdf(observations[i] | 1/lambda) - log(Z); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment