Skip to contents

Formula: W_ij = 1/n_j if i in cluster j else 0; rows sum to 1

Usage

Ccmem(y, cluster1, cluster2 = NULL, weights = NULL)

Arguments

y

Response, length n.

cluster1

First classification label per unit.

cluster2

Second classification, or NULL.

weights

Membership weight per classification, or NULL.

Value

List with estimate, W, row_sums, levels1, levels2, n_units, n_levels, method.

Details

A unit belonging to several higher-level units at once – pupils in both a school and a neighbourhood – contributes to each through a membership weight, and those weights must sum to one per unit or the random-effect variance is rescaled without anyone noticing. With two classifications and no explicit weights each contributes 1/2.

References

Goldstein (1994), Sociological Methods & Research 22(3):364-375; Browne, Goldstein & Rasbash (2001), Statistical Modelling 1(2):103-124.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Ccmem(V, V)
#> $estimate
#> [1] 1
#> 
#> $W
#>      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
#> [1,]    1    0    0    0    0    0    0    0
#> [2,]    0    1    0    0    0    0    0    0
#> [3,]    0    0    1    0    0    0    0    0
#> [4,]    0    0    0    1    0    0    0    0
#> [5,]    0    0    0    0    1    0    0    0
#> [6,]    0    0    0    0    0    1    0    0
#> [7,]    0    0    0    0    0    0    1    0
#> [8,]    0    0    0    0    0    0    0    1
#> 
#> $row_sums
#> [1] 1 1 1 1 1 1 1 1
#> 
#> $levels1
#> [1] 8
#> 
#> $levels2
#> [1] 0
#> 
#> $n_units
#> [1] 8
#> 
#> $n_levels
#> [1] 8
#> 
#> $method
#> [1] "cross-classified membership weight matrix"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"