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): = 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
use R to generate random numbers with the given density ... View full answer
Get step-by-step solutions from verified subject matter experts
