Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:
Here is some further information on weights in statistics in general, and SAS and Stata specifically: https://blogs.sas.com/content/iml/2017/10/02/weight-variables-in-statistics-sas.html Quote: use the FREQ statement to specify integer frequencies for repeated observations. Use the WEIGHT statement when you want to decrease the influence that certain observations have on the parameter estimates. http://support.sas.com/kb/22/600.html https://www.stata.com/manuals13/u20.pdf#u20.23 Executive summary: - Stata defines four different kinds of weights; - SAS defines two, WEIGHT and FREQ (frequency); - SAS truncates FREQ values to integers, with zero or negative meaning that the data point is to be ignored; - Using FREQ is equivalent to repeating the data points. In Python terms: mean([1, 2, 3, 4], freq=[1, 0, 3, 1]) would be equivalent to mean([1, 3, 3, 3, 4]). - Weights in SAS are implicitly normalised to sum to 1, but some functions allow you to normalise to sum to the number of data points, because it sometimes makes a difference. - It isn't clear to me what the physical meaning of weights in SAS actually is. The documentation is unclear, it *could* as simple as the definition of weighted mean here: https://en.wikipedia.org/wiki/Weighted_arithmetic_mean#Mathematical_definition but how that extends to more complex SAS functions is unclear to me. (And for what its worth, I don't think SAS's MEAN function supports weights at all. Any SAS users here that could comment?) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue20479> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com