Expectations.jl
Expectations.jl copied to clipboard
Expectation operators for Distributions.jl objects
It would be neat if there was a generic fallback for non-supported distributions. I can come up with a simple solution for continuous distributions: ```julia # fallback for UnivariateContinuousDistribution import...
The Pareto case could be handled by using the fact that if $X$ is Pareto-dsitributed with minimal value $m$ and shape index $\alpha$, then $$Y = log(X) - log(m)$$ is...
Add `using Expectations` etc. General syntax: `expectation(x->f(x), Distribution(θ))` ```julia using Expectations, Distributions; E=expectation; const μ=0.0; const σ=1.0; E(x->x, Normal(μ,σ)) E(x->exp(x), Normal(μ,σ)) exp(μ+ (σ^2)/2.) E(x->x^2, Normal(μ,σ)) E(x->x^2+exp(x), Normal(μ,σ)) # D =...
From @theogf: > Expectations.jl being a (very nice) wrapper around quadrature methods, it would feel quite natural to add Monte Carlo integration as well. My point is that for D...
https://github.com/TuringLang/Bijectors.jl
Similar quadrature rule to #34 (Gauss-Laguerre), just do a change of variables.