I have not found a library for pgfplots with "proper" (=normalized, standardized) definitions of distributions so that we don't reinvent the wheel each time we need to call these functions
- the density
- the inverse
- the cumulative
- the multivariate representation
Context
Plotting and using probability distributions (Probability_distribution, discrete and continuous) is extremely common on posts (here, here, here, here and so many others). But these 4 links leads already to 4 ways to write it
- (gauss, 2 inputs)
gauss(\m,\s)=1/(\s*sqrt(2*pi))*exp(-((x-\m)^2)/(2*\s^2)); - (gauss, 3 inputs)
gauss(\x,\u,\v)=1/(\v*sqrt(2*pi))*exp(-((\x-\u)^2)/(2*\v^2)); - (Gauss, 4 inputs)
Gauss(\x,\y,\z,\u)=1/(\z*sqrt(2*pi))*exp(-((\x-\y+\u*(\x-\y)*sign(\x-\y))^2)/(2*\z^2)); - (gauss, not gauss)
gauss(\x,\y)=exp(-\x*\x-\y*\y);
I am surprised there is not already an existing package "normalizing" the use of these probability distributions, so
- have I missed something in my (google/texSE) research?
statisticsseems to handle only formatting tables in statistics.
NB: Other functions found on different posts
binom(\k,\n,\p)=\n!/(\k!*(\n-\k)!)*\p^\k*(1-\p)^(\n-\k);Poisson(\x,\L)=(\L^{\x})*exp(-\L)/({\x}!);gamma(\z)=(2.506628274631*sqrt(1/\z) + 0.20888568*(1/\z)^(1.5) + 0.00870357*(1/\z)^(2.5) - (174.2106599*(1/\z)^(3.5))/25920 - (715.6423511*(1/\z)^(4.5))/1244160)*exp((-ln(1/\z)-1)*\z);gammapdf(\x,\k,\theta) = \x^(\k-1)*exp(-\x/\theta) / (\theta^\k*gamma(\k));- ...
xenters into the expression. So there's really only one way to do it. That said, defining a package to put a wrapper around a function seems like it would end up needing a lot of code that people would need to look up how to use the package in order for those people to avoid writing a lot of code that people would need to look up how to use to write their own Gaussian. – Teepeemm May 17 '20 at 12:41\oval{Flush Drum}to make an appropriate shape with lots of code behind the scenes. The best you can hope for is\gaussian(\m,\s)with a single line of code behind the scenes. I don't know that you'd end up gaining all that much from a package. But again, I'm not an expert in pgf nor TikZ, so maybe it would turn out well. – Teepeemm May 17 '20 at 15:58\tikzset{declare function={f(\x)=...;g(\x)=...}}. So there's not much need for any in depth knowledge aboutpgfkeysin that sense. – Torbjørn T. May 23 '20 at 19:42\tikzset. I thought there would be a smarter way to integrate these functions but it seems that simple is the answer here :). I should probably post as answer what I already have, maybe the community can kindly add some more on the go (?) – JeT May 23 '20 at 20:13