(1) Using a generator for a binomial distribution, we will test the results of Example 3.8.2. Using software generate 500 random deviates for X from a B(10, 0.3) distribution and 500 random deviates for Y from a B(5, 0.3) distribution. Add corresponding random deviates from each distribution to form an empirical W=X+Y. Then use the theoretical result of Example 3.8.2 and directly generate another 500 random deviates for W from a B(15, 0.3). Order the result of the sum of X+Y and of W. As an empirical test of the equivalence of the distributions create a scatterplot of the random deviates of W on the random deviates of X+Y. (2) Take the same approach for Example 3.8.4, first simulating W=Y/X and then simulating from the distribution representing the theoretical result of the ratio of Y and X. You need a little more guidance here. By Example 3.8.4 any exponential with rate lambda will suffice for Y and X, just use the same lambda, say lambda =1. The ratio will give random values for W. To establish random values of W directly from the density found for Example 3.8.4; that is, 1/(1+w)^2, you need a little help. And here it is. A random deviate for w can be delivered by {1/(1-r)}-1. I would generate a couple thousand random deviates for W=Y/X and for Wdev={1/(1-r)}-1. Next sort both random number sets from smallest to largest. Next, trim maybe the top 5%. That is, eliminate them. The reason is that if you don’t, the Y/X is going to occasionally give you some huge values, which when plotted the way I am recommending will change the scale substantially. So just be satisfied with the lower 95%. Last plot the lower 95% ordered Y/X with the lower 95% Wdev to assess agreement. You should see values on a line with slope 1. Where did {1/(1-r)}-1 come from? For continuous distributions, the distribution function F(w) is distributed as a U(0,1) random variable. We use this fact to establish random deviates. So we equate a uniform random number r with the distribution function F(w). You can verify this, by getting F(w) for yourself, but it works out to be r=1-1/(1+w). Solving for w gives the relationship above. That is how most random number generators are established for specific distributions! (3) Simulate the probability result that is the solution to Problem 3.10.7
The textbook is Introduction to Mathematical Statistics and Its Applications 5th edition by Larsen, Richard J, marx, Morris L
Chegg has the textbook solutions
1) We know that if then . The R code for generating 500 random variates from the 3 distributions and plotting the the sum against is given below.
m <- 500
n1 <- 10
n2 <- 5
p <- 0.3
X <- rbinom(m,n1,p)
Y <- rbinom(m,n2,p)
W <- rbinom(m,n1+n2,p)
sumXY <- array(dim = m)
for ( i in 1:m)
{
sumXY[i] <- X[i]+Y[i]
}
oW <- sort(W)
osumXY <- sort(sumXY)
plot(osumXY,oW,xlab = "X+Y",ylab = "W", col="blue")
The scatterplot is given below.
The variates lie on a straight line.
2) For this question the distributions are not specified.
Get Answers For Free
Most questions answered within 1 hours.