Re: [R] Generate missing data patterns

2009-12-02 Thread Coen van Hasselt
Hi Andreas, > ## does not exactly what i want, because i get rows > ## of missinges pattern which are not in R > X[rbinom(100,1,p[1])==1,R[1,]==1] <- NA > X[rbinom(100,1,p[2])==1,R[2,]==1] <- NA > X[rbinom(100,1,p[3])==1,R[3,]==1] <- NA > X[rbinom(100,1,p[4])==1,R[4,]==1] <- NA If you run these l

[R] Generate missing data patterns

2009-12-02 Thread Andreas Wittmann
Dear R-users, i try to generate missing values in a matrix X according to a given missingnes pattern R with the probabilities p per row. X<-matrix(rnorm(3*100),ncol=3) ## indicator matrix for missingnes (1 observed, 0 missing) R<-matrix(c(1,1,1, 0,0,1, 1,1,0,