Question
Problem 3 As we have seen for other probability calculations, we can simulate from a N(70, 13) distribution to estimate the probabilities computed above in
Problem 3
As we have seen for other probability calculations, we can simulate from a N(70, 13) distribution to estimate
the probabilities computed above in Problem 2.
The rnorm(n,,) function in R will simulate n draws from a normal distribution with mean, and standard
deviation, .
a) Include a code chunk here that simulates 10,000 draws from the N(70, 13) distribution and use that
simulated data to estimate the probability computed in Q2c. As in previous code for estimating
probabilities through simulation, you will need to count the number of simulated draws that meet the
criterion associated with the event defined in Q2c to be able to estimate this probability.
Another Way to Simulate Random Draws from N(70, 13) Randomly drawing from X N(70, 13)
using rnorm(n,70,13) is equivalent to:
1) Drawing randomly from a N(0,1) distribution
2) Multiplying (1) by the standard deviation of X
3) Adding the mean of X to (2)
So, instead of using rnorm(n,70,13) to draw from X ~N(70, 13), you can also use 13 rnorm(n) + 70 to
draw from N(70, 13).
b) Include a code chunk here that estimates the probability of Q2c through simulating 10,000 draws from
the standard normal distribution and using the criterion for counting events associated with Q2c
determined in (i).
Here we will take a look at how an entire probability density function can be approximated by simulation.
a) In a code chunk here simulate 10,000 draws from a N(2, 3) distribution. Call these simulated values,
Sim_N23.
b) In another code chunk, show a probability histogram of Sim_N23 using hist(). Set breaks = 75
and main= '10,000 Simulated Draws from N(2,3)' using Rcode.
c) The R function lines(x,y) will add a line to an existing plot. The arguments, x and y, are vectors of x
and y coordinates that together define all the points the line must run through. In the code chunk you
used to show the histogram above, we will now add code to overlay the histogram with the probability
density function for the N(2, 3) distribution. You can show in three lines of code:
(i) Define the x coordinates as xvalues=seq(-10, 15, length=150). This will define xvalues as a vector
of an evenly spaced grid of x coordinates between -10 and 15.
(ii) Assign the output of dnorm(xvalues, 2, 3) to a vector named yvalues.
(iii) Use the lines() function to overlay the histogram created in part (b) with the probability density
function for N(2, 3). In particular lines(xvalues, yvalues) should do the trick.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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