Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Just to continue working with R, I would like you to complete four very simple tasks. The first three are using expectation and the
Just to continue working with R, I would like you to complete four very simple tasks. The first three are using expectation and the random number generation in R for the binomial, hypergeometric, and exponential distributions. The third task is to plot multiple densities on a graph to see how the parameter changes the density form for the exponential. 1) Using the function rbinom in R, generate 1000 random deviates from a B(20,.4) distribution, compute the sample mean and compare with the theoretical expectation. 2) Using the function rhyper in R, generate 1000 random deviates from a hypergeometric distribution with 4 white balls, 8 black balls, and 3 balls drawn without replacement. Compute the sample mean and compare with the theoretical expectation. 3) Using the function rexp in R, generate 1000 random deviates from an exponential with lambda=3. Compute the sample mean and compare with the theoretical expectation, which is 1/lambda. 4) Using the curve function in R, generate different exponential densities: > curve(4*exp(-4*x),.01,10) > curve (2*exp(-2*x),.01,10,col="red",add=T) > curve (1*exp(-1*x),.01,10,col="blue",add=T) > curve (0.5*exp(-.5*x),.01,10,col="green",add=T)
Step by Step Solution
★★★★★
3.43 Rating (159 Votes )
There are 3 Steps involved in it
Step: 1
Answer J...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started