Returns the values on the diagonal of the hat matrix, which is the matrix that transforms the response vector (minus any offset) into the fitted values (minus any offset). Note that this method should only be used for linear mixed models. It is not clear if the hat matrix concept even makes sense for generalized linear mixed models.

# S3 method for class 'merMod'
hatvalues (model, fullHatMatrix = FALSE, ...)

Arguments

model

An object of class merMod.

fullHatMatrix

Return full hat matrix (not just diagonal values)?

...

Not currently used

Value

The diagonal elements of the hat matrix.

Examples

m <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
hatvalues(m)
#>          1          2          3          4          5          6          7 
#> 0.22930404 0.16972999 0.12682372 0.10058520 0.09101445 0.09811147 0.12187625 
#>          8          9         10         11         12         13         14 
#> 0.16230880 0.21940911 0.29317719 0.22930404 0.16972999 0.12682372 0.10058520 
#>         15         16         17         18         19         20         21 
#> 0.09101445 0.09811147 0.12187625 0.16230880 0.21940911 0.29317719 0.22930404 
#>         22         23         24         25         26         27         28 
#> 0.16972999 0.12682372 0.10058520 0.09101445 0.09811147 0.12187625 0.16230880 
#>         29         30         31         32         33         34         35 
#> 0.21940911 0.29317719 0.22930404 0.16972999 0.12682372 0.10058520 0.09101445 
#>         36         37         38         39         40         41         42 
#> 0.09811147 0.12187625 0.16230880 0.21940911 0.29317719 0.22930404 0.16972999 
#>         43         44         45         46         47         48         49 
#> 0.12682372 0.10058520 0.09101445 0.09811147 0.12187625 0.16230880 0.21940911 
#>         50         51         52         53         54         55         56 
#> 0.29317719 0.22930404 0.16972999 0.12682372 0.10058520 0.09101445 0.09811147 
#>         57         58         59         60         61         62         63 
#> 0.12187625 0.16230880 0.21940911 0.29317719 0.22930404 0.16972999 0.12682372 
#>         64         65         66         67         68         69         70 
#> 0.10058520 0.09101445 0.09811147 0.12187625 0.16230880 0.21940911 0.29317719 
#>         71         72         73         74         75         76         77 
#> 0.22930404 0.16972999 0.12682372 0.10058520 0.09101445 0.09811147 0.12187625 
#>         78         79         80         81         82         83         84 
#> 0.16230880 0.21940911 0.29317719 0.22930404 0.16972999 0.12682372 0.10058520 
#>         85         86         87         88         89         90         91 
#> 0.09101445 0.09811147 0.12187625 0.16230880 0.21940911 0.29317719 0.22930404 
#>         92         93         94         95         96         97         98 
#> 0.16972999 0.12682372 0.10058520 0.09101445 0.09811147 0.12187625 0.16230880 
#>         99        100        101        102        103        104        105 
#> 0.21940911 0.29317719 0.22930404 0.16972999 0.12682372 0.10058520 0.09101445 
#>        106        107        108        109        110        111        112 
#> 0.09811147 0.12187625 0.16230880 0.21940911 0.29317719 0.22930404 0.16972999 
#>        113        114        115        116        117        118        119 
#> 0.12682372 0.10058520 0.09101445 0.09811147 0.12187625 0.16230880 0.21940911 
#>        120        121        122        123        124        125        126 
#> 0.29317719 0.22930404 0.16972999 0.12682372 0.10058520 0.09101445 0.09811147 
#>        127        128        129        130        131        132        133 
#> 0.12187625 0.16230880 0.21940911 0.29317719 0.22930404 0.16972999 0.12682372 
#>        134        135        136        137        138        139        140 
#> 0.10058520 0.09101445 0.09811147 0.12187625 0.16230880 0.21940911 0.29317719 
#>        141        142        143        144        145        146        147 
#> 0.22930404 0.16972999 0.12682372 0.10058520 0.09101445 0.09811147 0.12187625 
#>        148        149        150        151        152        153        154 
#> 0.16230880 0.21940911 0.29317719 0.22930404 0.16972999 0.12682372 0.10058520 
#>        155        156        157        158        159        160        161 
#> 0.09101445 0.09811147 0.12187625 0.16230880 0.21940911 0.29317719 0.22930404 
#>        162        163        164        165        166        167        168 
#> 0.16972999 0.12682372 0.10058520 0.09101445 0.09811147 0.12187625 0.16230880 
#>        169        170        171        172        173        174        175 
#> 0.21940911 0.29317719 0.22930404 0.16972999 0.12682372 0.10058520 0.09101445 
#>        176        177        178        179        180 
#> 0.09811147 0.12187625 0.16230880 0.21940911 0.29317719