butools.trace.PdfFromWeightedTrace

butools.trace.PdfFromWeightedTrace()
Matlab: [x, y] = PdfFromWeightedTrace(trace, weights, intBounds)
Mathematica: {x, y} = PdfFromWeightedTrace[trace, weights, intBounds]
Python/Numpy: x, y = PdfFromWeightedTrace(trace, weights, intBounds)

Returns the empirical density function of a trace consisting of weighted data.

Parameters:

trace : vector of doubles

The trace data

weights : vector of doubles

The weights corresponding to the trace data

intBounds : vector of doubles

The array of interval boundaries. The pdf is the number of samples falling into an interval divided by the interval length.

Returns:

x : vector of doubles

The center of the intervals (the points where the empirical pdf is calculated)

y : vector of doubles

The values of the empirical pdf at the given points

Examples

For Matlab:

>>> wtrace = [0.12, 1.23, 0.546, 0.6765, 1.34, 2.34];
>>> weights = [12., 1., 34., 23., 8., 2.];
>>> x = (0.0:0.1:3.0);
>>> [x, y] = PdfFromWeightedTrace(wtrace, weights, x);
>>> plot(x, y)

For Mathematica:

>>> wtrace = {0.12, 1.23, 0.546, 0.6765, 1.34, 2.34};
>>> weights = {12., 1., 34., 23., 8., 2.};
>>> x = Range[0.0,3.0,0.1];
>>> {x, y} = PdfFromWeightedTrace[wtrace, weights, x];
>>> ListLinePlot[{Transpose[{x, y}]}]

For Python/Numpy:

>>> wtrace = [0.12, 1.23, 0.546, 0.6765, 1.34, 2.34]
>>> weights = [12., 1., 34., 23., 8., 2.]
>>> x = np.arange(0.0,3.1,0.1)
>>> x, y = PdfFromWeightedTrace(wtrace, weights, x)
>>> plt.plot(x, y)