Dear Statalist,
I am trying to simulate clustered data with a specific intra-class correlation. One approach I came up with is:
This creates j = 2 observations per i = 100 clusters which have an ICC of 0.5. Is there an approach that allows me to vary the number of observations j per cluster in a random fashion?
Thanks so much for your consideration
KS
I am trying to simulate clustered data with a specific intra-class correlation. One approach I came up with is:
Code:
clear set seed 1 matrix C = (1, 0.5 \ 0.5 , 1) drawnorm y1 y2, n(100) corr(C) gen i = _n reshape long y, i(i) j(j) qui mixed y || i: estat icc
Thanks so much for your consideration
KS
Comment