I was going to update my geomagnetic storm extreme value analysis example, and wanted to use new _lpdf, _lccdf syntax for my user defined functions. While looking for the information in the Stan manual 2.16.0, which is the latest linked in http://mc-stan.org/users/documentation/index.html, I got confused what is difference between
reals y
, real[] y
, and real y[]
in function signatures
After some searching I found the description of “The pseudo-type reals” p. 495, but that specific section could also have an example of actual function definitions to help someone who wants to write a user defined distribution functions. I think I should have function signatures
functions {
real gpareto_lpdf(real y[], real k, real sigma) {
...
real gpareto_lccdf(real y[], real k, real sigma) {
...
in order to be able to have code
y ~ gpareto(k, sigma);
and
for (n in 1:N)
log_lik[n] = gpareto_lpdf(y[n] | k, sigma);
for (n in 1:Nt)
predccdf[n] = exp(gpareto_lccdf(yt[nt] | k, sigma));
Is the bar |
notation working also for the user defined functions?