Skip to contents

The naive multilevel analogue of R-squared can go negative when predictors are added, because the separate variance components are not each individually reduced. Snijders and Bosker define explained variance on the total residual variance of an individual observation, sigma2_e + sigma2_u, comparing the fitted model against the empty model; so defined it does not go negative for a useless predictor.

Usage

Snr2(sigma2_e1, sigma2_u1, sigma2_e0, sigma2_u0)

Arguments

sigma2_e1

Level-1 residual variance of the fitted model.

sigma2_u1

Level-2 intercept variance of the fitted model.

sigma2_e0

Level-1 residual variance of the empty model.

sigma2_u0

Level-2 intercept variance of the empty model.

Value

List with estimate, total1, total0, icc0, icc1, reduction, method.

Details

Formula: R2_1 = 1 - (sigma2_e1 + sigma2_u1) / (sigma2_e0 + sigma2_u0).

References

Snijders, T. A. B. and Bosker, R. J. (1994). Modeled variance in two-level models. Sociological Methods and Research 22(3):342-363. doi:10.1177/0049124194022003004

Examples

Snr2(1, 0.5, 4, 1)
#> $estimate
#> [1] 0.7
#> 
#> $total1
#> [1] 1.5
#> 
#> $total0
#> [1] 5
#> 
#> $icc0
#> [1] 0.2
#> 
#> $icc1
#> [1] 0.3333333
#> 
#> $reduction
#> [1] 3.5
#> 
#> $method
#> [1] "R2_1 = 1 - (s2_e1+s2_u1)/(s2_e0+s2_u0) [Snijders & Bosker 1994]"
#>