I have tried many times to plot a CDF from the following PDF code , But I failed to get that however I have used the command CumulantGeneratingfunction[, ] but it coudn't work , any Help ?and also the same with Histogram plot ?
f[z_?NumericQ, \[Mu]_?NumericQ] :=
NIntegrate[Sqrt[6]/Sqrt[2*Pi]Exp[-(z - \[Mu])^2/(Pi)
]* Erf[(z - \[Mu])/(\[Sigma] Sqrt[2*Pi])]* Erfi[(z - \[Mu])/(\[Sigma] Sqrt[2*Pi])], {\[Sigma], 1, \[Infinity]}]
pdfF[\[Mu]_?NumericQ] := PDF[ProbabilityDistribution[f[x, \[Mu]], {x, - \[Infinity], \[Infinity]}]]
With[{n = 5},
Show[
Plot[
Labeled[pdfF[#1][z], Row[{"\[Mu] = ", Rationalize[#1]}], Above], {z, -5, 5},
PlotRange -> All,
PlotStyle -> #2] &
@@@
Rest[{#, Hue[#]} & /@ Subdivide[0., 1., n]],
ImageSize -> Large]]
With[{n = 5}, NIntegrate[pdfF[#][z], {z, -5, 5}] & /@ (Range[n]/n)]
f
is not 1, so it is not a properly defined PDF function (e.g.NIntegrate[f[z, 3], {z, -∞, ∞}]
returns 1.01826); you need to introduce a normalization factor. Furthermore, your use ofPDF[ProbabilityDistribution[f[x, μ], {x, -∞, ∞}]]
is redundant:ProbabilityDistribution
will generate a distribution assuming that its first argument is a well-defined PDF, normalized to 1. When you applyPDF
to that, you just getf[x, μ]
back (evaluatepdfF[2]
), so usingPDF[ProbabilityDistribution[f[...], ...]]
is completely equivalent to using your ownf
. $\endgroup$