Integrate function

Is there a function in stan that will integrate over a custom lpdf to test if it integrates to 1?

If so, can you provide any links or examples on how to call that function?

As example, the custom lpdf is just the Normal

real custom_normal_lpdf(real y, real mu, real scale){
out = log(sigma)−0.5*log(2*pi)−(y−mu)^2/(2*sigma^2)

Thank you

1 Like

integrate_1d is what you are looking for…but maybe google will do an auto correct here - just search the Stan user function reference manual?

1 Like

See the example in the thread Testing user defined probability function implementations in Stan generated quantities