Question: (a) Write a function with input n (an integer) and output n IID random numbers with density function f(x): = cos x, 0 x

 (a) Write a function with input n (an integer) and output n IID random numbers with density function f(x): = 

(a) Write a function with input n (an integer) and output n IID random numbers with density function f(x): = cos x, 0 x 7. (Hint: find CDF first. Search 'Trigonometric Functions in R' for related functions if necessary.) (b) Draw 1,000 random numbers using (a) and compare the histogram with the density f(x). (c) Plot the empirical CDF of 1,000 random numbers in (b), and compare it with the true CDF.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

use R to generate random numbers with the given density ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!