# Calculation of intersection points with a distribution curve

How can I find the two intersections (x1, x2) of a distribution curve and a line y = 0.05 * Max[distribution]?

The MWE is:

infil = name <> ".dat"; list = OpenRead[infil]; data =
Import[list, "Table"];
bwerte = data[[All, 4]];
fdist = FindDistribution[bwerte];
{Anzahl, num} = HistogramList[bwerte, 300, "PDF"];
maxFreq = Max[heights]; level = maxFreq*0.1;
d = Plot[PDF[fdist, {x}], {x, 0, 4}, Filling -> Axis,
PlotRange -> All];
ois = Show[Histogram[bwerte, {Anzahl}, num &], d,
PlotRange -> Automatic,
Epilog -> {{Thick, Darker[Blue], Line[{{0, level}, {3, level}}] }}]


Thanks a lot!! Harald

• You can use FindRoot on the PDF of the distribution, with an appropriate starting point. If your distribution is unimodal, you can first use FindMaximum to determine the maximum, then use points to the left and right as starting points fo FindRoot. Dec 7 '17 at 12:37

Since you did not post your data I will just use normal data.

data = RandomVariate[NormalDistribution[2, 2/3], 3000];


The data range is

{xmin, xmax} = MinMax[data];


The estimated distribution is

fdist = FindDistribution[data];


The distribution's maximum is

max = Maximize[{PDF[fdist, x], xmin <= x <= xmax}, x]

(* {0.607209, {x -> 2.00522}} *)


You stated two different values for level: 0.05 Max[distribution] and maxFreq*0.1. I used the first.

level = 5/100 max[[1]];

sol = Quiet[
NSolve[
{PDF[fdist, x] == level,
xmin <= x <= xmax},
x], NSolve::ifun]

(* {{x -> 0.397022}, {x -> 3.61341}} *)

Show[
Histogram[data, 300, "PDF"],
Plot[{PDF[fdist, x], level}, {x, xmin, xmax}],
Graphics[{Red, AbsolutePointSize[5],
Point[{x, level} /. sol]}]]


• Thanks a lot!! This is exactly what I was looking for!!! Dec 7 '17 at 17:10