Subramanian Swaminathan
2010-Jun-18 11:31 UTC
[R] simulating binary random numbers using 'mvtnorm'
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]]