# [R] Fw: simulating binary random numbers using 'mvtnorm'

From: Subramanian Swaminathan <ssubra_at_yahoo.com>
Date: Sun, 20 Jun 2010 21:42:14 -0700 (PDT)

Hi R-users,

I just started learning R. I have a project on lot quality assurance sampling (LQAS). In this project I have to develop LQAS plans to make decision on stopping / continuing a programme. The LQAS plans is based on cluster sampling: selection of k clusters (villages) of m children each for a total sample of n. In this connection I would like to estimate the classification errors ( alpha and beta) that would be expected as a consequence of sampling clusters (villages / households) instead of usual SRS under traditional LQAS. In order to estimate the classification errors I would like to simulate correlated binary outcomes for a given level of prevalence and intracluster correlation (rho).

Specifically I would like simulate an LQAS plan (33 clusters of 6 children each, n =198 children) to generate clusters with specific intercluster (0.05) and intracluster correlation (0.1) subject to the constraint that the intercluster correlation is less than or equal to intracluster correlation for a given level of prevalence (upper threshold =1% and lower threshold=0.1%). For this purpose I have used the following command (which is under mvtBinaryEP in mvtnorm library in R):

ep0 = ep(mu=0.1, rho=0.05, n=6, nRep=33, seed=NULL) apply(ep0\$y, c(1,2), mean); cor(ep0\$y)

The above commands produce 198 binary outcomes (33 clusters with cluster size of 6 each) and a matrix (6x6) of bivariate correlations. Since the input among others requires values either for 'rho' along with 'mu' or an 'R' matrix and a column vector of 'mu', I wonder whether the binary outcomes meets my specification about inter-cluster correlation. I would be very much grateful to R-community, if someone helps me out.

thanking you in advance and I am looking forward to R-community

subramanian

Dr S.Subramanian
Assistant Director
Vector Control Research Centre
Indira Nagar
Pondicherry - 605 006
INDIA
```
[[alternative HTML version deleted]]

______________________________________________
```
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 21 Jun 2010 - 04:46:39 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 21 Jun 2010 - 06:00:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.