[R] Help with simulation of unbalanced clustered data

Chao Liu p@ych@o||u @end|ng |rom gm@||@com
Wed Dec 16 03:48:12 CET 2020


Dear R experts,

I want to simulate some unbalanced clustered data. The number of clusters
is 20 and the average number of observations is 30. However, I would like
to create an unbalanced clustered data per cluster where there are 10% more
observations than specified (i.e., 33 rather than 30). I then want to
randomly exclude an appropriate number of observations (i.e., 60) to arrive
at the specified average number of observations per cluster (i.e., 30). The
probability of excluding an observation within each cluster was not uniform
(i.e., some clusters had no cases removed and others had more excluded).
Therefore in the end I still have 600 observations in total. How to realize
that in R? Thank you for your help!

Best,

Liu

	[[alternative HTML version deleted]]



More information about the R-help mailing list