z_ij = (x_ij - xbar_j) / sd_j.
Value
List with estimate (the z vector), z, cluster_means, cluster_sds, cluster_ids, n_undefined, n_clusters, n.
Details
The centring step is not recomputed here: it is Cwcenter (module cwcm), the
single implementation of group-mean centring in this package. What
this module adds is the division by the within-cluster standard
deviation, which is what separates a z-score from a centred score:
centring removes the cluster's location, scaling also removes its
spread, so clusters with different variability become comparable and
every cluster ends with mean 0 and standard deviation 1 by
construction.
That last property is also the cost. Between-cluster differences in
both level and spread are destroyed, so a cluster-level predictor
cannot be recovered from z; the cluster means and standard
deviations are returned alongside so they can be reintroduced as
level-2 predictors.
A cluster with a single member, or with no variation, has
sd_j = 0 and no defined z-score. Those positions are returned
as NaN, not 0: a unit that cannot be placed relative to its
cluster is not average, it is unmeasured.
References
Raudenbush and Bryk (2002), Hierarchical Linear Models, 2nd ed., Sage, ch. 5; Enders and Tofighi (2007), Psychological Methods 12(2), 121-138, doi:10.1037/1082-989X.12.2.121 . Neither source was in the local corpus; the transformation is arithmetic and is implemented in its standard published form, exactly as printed above.
Examples
V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Mlwz(V, V)
#> $estimate
#> [1] NaN NaN NaN NaN NaN NaN NaN NaN
#>
#> $z
#> [1] NaN NaN NaN NaN NaN NaN NaN NaN
#>
#> $cluster_means
#> [1] 1 2 3 4 5 6 7 8
#>
#> $cluster_sds
#> [1] NaN NaN NaN NaN NaN NaN NaN NaN
#>
#> $cluster_ids
#> [1] "1" "2" "3" "4" "5" "6" "7" "8"
#>
#> $n_undefined
#> [1] 8
#>
#> $n_clusters
#> [1] 8
#>
#> $n
#> [1] 8
#>
#> $method
#> [1] "Within-cluster standardisation (cluster z-score)"
#>
#> attr(,"class")
#> [1] "morie_rich_result" "list"
