# pwm.ub: Unbiased Sample Probability-Weighted Moments In lmomco: L-Moments, Censored L-Moments, Trimmed L-Moments, L-Comoments, and Many Distributions

 pwm.ub R Documentation

## Unbiased Sample Probability-Weighted Moments

### Description

Unbiased sample probability-weighted moments (PWMs) are computed from a sample. The β_r's are computed using

β_r = n^{-1} {n-1 \choose r}^{-1} ∑^n_{j=1} {j-1 \choose r} x_{j:n}\mbox{.}

### Usage

```pwm.ub(x, nmom=5, sort=TRUE)
```

### Arguments

 `x` A vector of data values. `nmom` Number of PWMs to return (r = `nmom - 1`). `sort` Do the data need sorting? The computations require sorted data. This option is provided to optimize processing speed if presorted data already exists.

### Value

An R `list` is returned.

 `betas` The PWMs. Note that convention is the have a β_0, but this is placed in the first index `i=1` of the `betas` vector. `source` Source of the PWMs: “pwm.ub”.

### Note

Through a user inquiry, it came to the author's attention in May 2014 that some unrelated studies using PWMs in the earth-system sciences have published erroneous sample PWMs formula. Because lmomco is intended to be an authoritative source, here are some computations to further prove correctness with provenance:

```"pwm.handbookhydrology" <- function(x, nmom=5) {
x <- sort(x, decreasing = TRUE); n <- length(x); betas <- rep(NA, nmom)
for(r in 0:(nmom-1)) {
tmp <- sum(sapply(1:(n-r),
function(j) { choose(n - j, r) * x[j] / choose(n - 1, r) }))
betas[(r+1)] <- tmp/n
}
return(betas)
}
```

and a demonstration with alternative algebra in Stedinger and others (1993)

```set.seed(1)
glo <- vec2par(c(123,1123,-.5), type="glo"); X <- rlmomco(100, glo)
lmom2pwm(lmoms(X, nmom=5))\$betas # unbiased L-moments flipped to PWMs
  998.7932 1134.0658 1046.4906  955.8872  879.3349
pwm.ub(X, nmom=5)\$betas  # Hosking and Wallis (1997) and Asquith (2011)
  998.7932 1134.0658 1046.4906  955.8872  879.3349
pwm.handbookhydrology(X) # ** alert reverse sort, opposite usually seen**
  998.7932 1134.0658 1046.4906  955.8872  879.3349
```

W.H. Asquith

### References

Asquith, W.H., 2011, Distributional analysis with L-moment statistics using the R environment for statistical computing: Createspace Independent Publishing Platform, ISBN 978–146350841–8.

Greenwood, J.A., Landwehr, J.M., Matalas, N.C., and Wallis, J.R., 1979, Probability weighted moments—Definition and relation to parameters of several distributions expressable in inverse form: Water Resources Research, v. 15, pp. 1,049–1,054.

Stedinger, J.R., Vogel, R.M., Foufoula-Georgiou, E., 1993, Frequency analysis of extreme events: in Handbook of Hydrology, ed. Maidment, D.R., McGraw-Hill, Section 18.6 Partial duration series, mixtures, and censored data, pp. 18.37–18.39.

Hosking, J.R.M., 1990, L-moments—Analysis and estimation of distributions using linear combinations of order statistics: Journal of the Royal Statistical Society, Series B, v. 52, pp. 105–124.

`pwm.pp`, `pwm.gev`, `pwm2lmom`
```pwm <- pwm.ub(rnorm(20))