hello,
I want to simulate 200 times the mean of a joint probability (y1) and 200
times the mean of another joint distribution (y2),
that is I'm expecting to get 200 means of y1 and 200 means of y2.
y1 and y2 are probabilities that I calculate from the marginal prob. (z1 and
z2 respectively) multiple by the conditional prob. (x1 and x2 respectively),
which I generaterd from the binomial distribution.
here are the results for one mean of y1 and one mean of y2:

 > y1 <- 0
> for (i in 1:200){
+ z1[i] <- rbinom(1, 1, .6)
+ x1[i] <- rbinom(1, 1, .95)
+ y1[i] <- z1[i]*x1[i]
+ }
> mean(y1)
[1] 0.605
> y2 <- 0
> for (j in 1:200){
+ z2[j] <- rbinom(1, 1, .6)
+ x2[j] <- rbinom(1, 1, .8)
+ y2[j] <- z2[j]*x2[j]
+ }
> mean(y2)
[1] 0.515
>
and this I want to simulate 200 time, in order to see the distribution of y1
and the distribution of y2.
How can I repeat it and see all the results? (all the 200 means of y1 and
y2)
Thank you,
Sigalit.

        [[alternative HTML version deleted]]

______________________________________________
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