Diagonal values of the Hat matrix | R Documentation |

Diagonal values of the Hat matrix.

```
leverage(x)
```

`x` |
A matrix with independent variables, the design matrix. |

The function returns the diagonal values of the Hat matrix used in linear regression. We did not call it "hatvalues" as R contains a built-in function with such a name.

A vector with the diagonal Hat matrix values, the leverage of each observation.

Michail Tsagris.

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.

Hansen, B. E. (2019). Econometrics.

```
gee.reg, bic.regs, ztp.reg
```

```
x <- as.matrix( iris[1:50, 1:4] )
a <- leverage(x)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.