Skip to contents

PR = (sigma2_e(null) - sigma2_e(full)) / sigma2_e(null).

Usage

Mlpv(y, X, cluster)

Arguments

y

Response, length n.

X

Level-1 predictors without an intercept column, n by p.

cluster

Cluster identifier per observation.

Value

List with estimate (PR), pr, sigma2_null, sigma2_full, df_null, df_full, n_clusters, p, n.

Details

The null model is the one-way random-effects ANOVA – cluster intercepts and nothing else – and the full model adds the level-1 predictors X on top of those same intercepts. Both residual variances are computed on the within-cluster (fixed-effects) transformation, which sweeps the cluster means out of y and X; that is what makes them comparable, since both are then variances of the same deviations about the same intercepts.

Degrees of freedom are n - J for the null model and n - J - p for the full one, J being the number of clusters. Using them, rather than dividing both by n, is what stops a predictor from appearing to explain variance purely by being counted.

PR is NOT bounded below by zero. A negative value is a real and informative outcome – the added predictors cost more degrees of freedom than they repaid – and is reported as it comes out rather than clamped.

References

Raudenbush and Bryk (2002), Hierarchical Linear Models, 2nd ed., Sage, ch. 4, "proportion reduction in variance" at level 1. The quantity is implemented exactly as the ratio printed above, its standard published form.

Examples

Mlpv(y = c(1, 2, 3, 4, 5, 6, 7, 8), X = c(1, 2, 3, 4, 5, 6, 7, 8),
  cluster = data.frame(x = c(1, 2, 3, 4), y = c(2, 4, 5, 9)))
#> $estimate
#> [1] 1
#> 
#> $pr
#> [1] 1
#> 
#> $sigma2_null
#> [1] 3.25
#> 
#> $sigma2_full
#> [1] 4.930381e-31
#> 
#> $df_null
#> [1] 2
#> 
#> $df_full
#> [1] 1
#> 
#> $n_clusters
#> [1] 6
#> 
#> $p
#> [1] 1
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "Proportional reduction in level-1 variance"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"