# TheilU

##### Theil's U Index of Inequality

Calculate Theil's U index of inequality.

- Keywords
- multivar

##### Usage

`TheilU(a, p, type = c(2, 1), na.rm = FALSE)`

##### Arguments

- a
a numeric vector with the actual observed values.

- p
a numeric vector containing the predictions.

- type
defining the type of Theil's two U measures, see Details. Default is 2.

- na.rm
logical, indicating whether

`NA`

values should be stripped before the computation proceeds. If set to`TRUE`

complete cases of`cbind(x, y)`

will be used. Defaults to`FALSE`

.

##### Details

Theil proposed two error measures, but at different times and under the same symbol U, which has caused some confusion.
U `type = 1`

is taken from Theil (1958, pp. 31-42). The argument `a`

represents the actual observations and `p`

the corresponding predictions. He left it open whether `a`

and `p`

should be used as absolute values or as observed and predicted changes.
Theil (1966, chapter 2) proposed U `type = 2`

as a measure of forecast quality: *"...where \(A_i\) and \(P_i\) stand for a pair of predicted and observed changes. ..."*
As \(U_1\) has some serious disadvantages (see Bliemel 1973) it is recommended to use \(U_2\).

##### References

Theil, H. (1958): *Economic Forecasts and Policy*. Amsterdam: North Holland.

Thiel, H. (1966): *Applied Economic Forecasting*. Chicago: Rand McNally.

Bliemel, F. (1973): Theil's Forecast Accuracy Coefficient: A Clarification, *Journal of Marketing Research* Vol. 10, No. 4 (Nov., 1973), pp. 444-446

##### See Also

##### Examples

```
# NOT RUN {
TheilU(1:10, 2:11, type=1)
TheilU(1:10, 2:11, type=2)
# }
```

*Documentation reproduced from package DescTools, version 0.99.36, License: GPL (>= 2)*

### Community examples

**navid.nobani@gmail.com**at Oct 27, 2017 DescTools v0.99.19

```library(forecast) a <- c(1,2,3,5,6,8,9) #actual p <- c(1,3,3,4,6,7,9) #forecasted TheilU(a,p) ``` [1] 0.1167748