Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using R Studio [ R programming language], Estimate the value of 7 (pi) using Monte Carlo simulations. The statistical idea is as follows: suppose a
Using R Studio [ R programming language],
Estimate the value of 7 (pi) using Monte Carlo simulations. The statistical idea is as follows: suppose a circle of radius 1 is inscribed inside a square with sides of length 2 (see picture). Then from basic geometry, we know that the area of the circle is T. (by the formula Area = ir- ) and the area of the square is 4 (by the formula area = side). So the ratio of the area of the circle to the area of the square will be t/4. In other words, = 4 area of the circle area of the square Using this fact, if we can estimate the ratio of the areas, we can simply estimate T to be four times that ratio. Now: how can we estimate the ratio of the areas? If you randomly choose a point inside the square, the probability of that point being inside the circle is given by the ratio of the areas! So, if we randomly choose N points inside the square, and M of these points fall inside the circle, then the proportion M/N is therefore a reasonable estimate of the ratio of areas, and using the above equation we can estimate tas 4M/N. Using R, compute estimate of it and plot the estimated values for N = 1, 2, ..., 10000. Report R code and output Hint 1: watch this video for more https://www.youtube.com/watch?v=VJTFflqO4TU Hint 2: to generate a random number between 0 and 1, use runif(n=1, min=0, max=1)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