In package descriptive, define some descriptive statistics with optional weight argument.
commit6f89e40c7f33f09c5b22b0d628d83c4bd853fa32
authorRobert Dodier <robert_dodier@users.sourceforge.net>
Sun, 15 Jan 2023 02:36:27 +0000 (14 18:36 -0800)
committerRobert Dodier <robert_dodier@users.sourceforge.net>
Sun, 15 Jan 2023 17:38:35 +0000 (15 09:38 -0800)
tree1f96236c09e40a249e8c0dacfdf35c30a17ccc6f
parent4e5234e8f61226bc09945b435c06041c7087a107
In package descriptive, define some descriptive statistics with optional weight argument.

The functions which recognize the optional weight argument are:
mean, noncentral_moment, central_moment, var, std, var1, and std1.

The weight argument may be a literal 1 (not a list), indicating equal
weight for all data, or a list of length equal to the number of data.
Weights cannot be negative, and the sum of weights cannot be zero.
The weights, if a list, need not sum to 1; the weights are normalized
by their sum in internal calculations.

When weights are integers, the effect is exactly the same as duplicating
each datum the number of times given by the corresponding weight.

This commit includes unit tests for the modified functions.
share/descriptive/descriptive.mac
share/descriptive/rtest_descriptive.mac