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 lines directly after each other,  the same rows can
be selected multiple times and result in combined missingness
patterns. At least the propabilities for missingness you defined will
be different, because for instance 111 can also be created by a
combination of two other patterns.

> Another question is what to to if want the missing pattern R and simulate a
> certain amount of missingnes mybe about 10 %?

Maybe have a look at sample()?

Coen

______________________________________________
R-help@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.

Reply via email to