Hi! I have the following situation of mixture distributions: The number of eggs, N, laid by a female of certain species of butterfly follows a Poisson(F) distribution, where the fertility F follows an exponential distribution with expectation 1/lambda. Each egg hatches with probability p, and approximately half of the eggs develop into females. Simulate sets of 1000 and 5000 samples for the number eggs hatching, and the corresponding number of females for each group of eggs. Draw histograms for the two variables and use your data for obtaining the mean and variance of the number of eggs hatching and the number of females. Use the following combinations of parameters: lambda p 100 0.4 100 0.2 50 0.4 50 0.8 So far I have F=rexp(1000, 1/100) N=rpois(1000,F) X=rbinom(N, 1000,0.4) hist(X) I've done the same for all the values but I'm not sure Thanks in advance, albina -- View this message in context: http://n4.nabble.com/hierarchical-model-in-R-tp963168p963168.html Sent from the R help mailing list archive at Nabble.com.