I also think there is a problem with WeightedData and the documentation...
With the same data generation:
Mean@d
Mean[WeightedData[d,
w]] (*Correct, but different from the documentation of Mean!*)
Mean[d w]/Total[w] (*From the documentation of Mean for WeightedData *)
As fo the variance, the problem seems linked with unbiasedness :
Variance@d (*unbiased*)
Mean[(d - Mean@d)^2] (nbpoints/(nbpoints - 1))(*unbiased*)
Variance[
WeightedData[d,
w]] (* Problematic definition in the documentation, \
for WeightedData*)
Mean[(d - Mean@d)^2] (* biased *)