[R] Help with simulation of unbalanced clustered data
jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Wed Dec 16 14:50:40 CET 2020
This is R-help, not R-do-my-work-for-me. It is also not a homework help line. The Posting Guide is required reading. Assuming this is not homework, since each step in your problem definition can be mapped to a fairly basic operation in R (the sample function and indexing being key tools), you should be showing your work with a reproducible example that illustrates where you are stuck or why the result you are getting does not exhibit the desired properties.
On December 15, 2020 6:48:12 PM PST, Chao Liu <psychaoliu using gmail.com> wrote:
>Dear R experts,
>I want to simulate some unbalanced clustered data. The number of
>is 20 and the average number of observations is 30. However, I would
>to create an unbalanced clustered data per cluster where there are 10%
>observations than specified (i.e., 33 rather than 30). I then want to
>randomly exclude an appropriate number of observations (i.e., 60) to
>at the specified average number of observations per cluster (i.e., 30).
>probability of excluding an observation within each cluster was not
>(i.e., some clusters had no cases removed and others had more
>Therefore in the end I still have 600 observations in total. How to
>that in R? Thank you for your help!
> [[alternative HTML version deleted]]
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.
Sent from my phone. Please excuse my brevity.
More information about the R-help