# Weighted smooth histogram

I have a large list $$L$$ ($$|L| \sim 100000$$) of pairs $$\{x_i,w_i\} \in \mathbf{R} \times [0,1]$$ subject to the constraint that

$$\qquad \sum w_i = 1.$$

I would like to use $$L$$ to graph a smooth function which "approximates" the PDF

$$\qquad \sum w_i \cdot \delta(x - x_i)$$

If all the $$w_i$$ were equal to $$1/|L|$$, then I could simply take the list of the numbers $$x_i$$ and apply SmoothHistogram. Is there any way to do a "weighted" smooth histogram? If not, some other way?

In practice, the numbers $$w_i$$ satisfy $$5/|L| \ge w_i \ge 1/(5 |L|)$$.

SeedRandom[1]
data = Transpose[{RandomReal[10, 100], Normalize @ RandomReal[1, 100]}];

wd = WeightedData @@ Transpose[data]

SmoothHistogram[wd]


Compare with SmoothHistogram of data without the weights:

SmoothHistogram[data[[All,1]]]


• This completely and succinctly answers my question, and includes a working example that makes it easy for me to reproduce. Thanks! – user67131 Aug 26 '19 at 20:00
• @user67131, my pleasure. Thank you for the accept. And welcome to mma.se. – kglr Aug 26 '19 at 20:12