The \(r^{th}\) population moment is defined as \(m_r = (1/N) \sum_{k \in U} (y_k - \bar{y}_U)^r\) where U is the set of population units,
N is the population size, and \(\bar{y}_U\) is the population mean.
When the input is for the whole population, wtd.moments evaluates this directly for \(r=2, 3, 4\).
When the input is for a sample, the \(r^{th}\) moment is estimated as \(\hat{m}_r = (K/\hat{N}) \sum_{k \in s} ( w_k (y_k - \hat{\bar{y}}_U)^r ), r=2, 3, 4\)
where \(s\) is the set of sample units, \(w_k\) is the weight for sample unit \(k\), \(\hat{N} = \sum_s w_k\), and
\(\hat{\bar{y}}_U = \sum_{k \in s} w_k y_k / \hat{N}\).
When \(r=2\), \(K=n/(n-1)\) so that the estimator equals the unbiased variance estimator if the sample is a simple random sample;
if \(r=3,4\), then \(K=1\). The function also computes or estimates the population skewness, defined as \(m_3/m_2^{3/2}\)
and the population kurtosis, \(m_4/m_2^2\).
The weights should be scaled for estimating population totals. The sample can be obtained from any complex design. The estimators produced by wtd.moments are consistent for general sample designs but not unbiased (except for \(r=2\) and SRS).