# Plot of histogram similar to output from @risk

In order to analyze simulated data, @risk provides a histogram with handle bars, so that we can move these handles to see what proportion of data are on each side. For example,

I am trying to create similar graph for my empirical data, but I have no idea how to do it. Any help starting with the following code would be much appreciated.

   mydata = RandomVariate[TriangularDistribution[{100, 400}, 200], 5000];
Histogram[mydata, Automatic, "Probability"]
mydist = EmpiricalDistribution[mydata]; A starting point:

BlockRandom[SeedRandom; (* for reproducibility *)
mydata = RandomVariate[TriangularDistribution[{100, 400}, 200], 5000]];

DynamicModule[{hd, hist, xmin, xmax, yr},
Manipulate[Show[hist,
Plot[PDF[hd, x], {x, h[[1, 1]], h[[2, 1]]},
Exclusions -> None, Filling -> {1 -> Axis},
FillingStyle -> Opacity[0.8, Pink],
PlotPoints -> 95, PlotRange -> yr,
PlotStyle -> Directive[AbsoluteThickness, Pink]],
Axes -> None, Frame -> True,
GridLines -> {{h[[1, 1]], h[[2, 1]]}, None},
Method -> {"GridLinesInFront" -> True},
PlotLabel -> StringForm["%",
100 Round[Abs[CDF[hd, h[[2, 1]]] -
CDF[hd, h[[1, 1]]]],
0.001]]],
{{h, {{xmin, 0}, {xmax, 0}}}, Locator, Appearance -> None},
Initialization :> (hd = HistogramDistribution[mydata];
{xmin, xmax} = First[hd["Domain"]];
hist = Histogram[mydata, Automatic, "PDF",
ChartBaseStyle ->
Directive[EdgeForm[], LightPink]];
yr = Last[Chartingget2DPlotRange[hist]];)]] Try this:

With[{dist = CDF[mydist]},
Manipulate[
Histogram[mydata, Automatic, "Probability",
PlotRange -> {MinMax@mydata, All},
PlotLabel ->
StringForm["Percent Inside: " ,
dist[bounds[]] - dist[bounds[]]],
Epilog ->
{
EdgeForm[None],
GrayLevel[1, .5],
Rectangle[
{Min@mydata, 0},
{bounds[], 1000000}
],
Rectangle[
{bounds[], 0},
{Max@mydata, 1000000}
]
}
],
{
{bounds, Rescale[{.25, .75}, {0, 1}, MinMax@mydata]},
Sequence @@ MinMax@mydata,
ControlType -> IntervalSlider
}
]
]
` 