Nothing
Consider the following probability density function (pdf) over the support $(0,1)$:
\begin{equation} f(x) = \begin{cases} 4x^3 & \text{if } 0 < x < 1 \ 0 & \text{otherwise} \end{cases} \end{equation}
rf <- function(n) { U <- runif(n) X <- U^(1/4) X }
Write a function called rf
, that generates i.i.d observations from this pdf.
It should take in exactly one argument, $n$, that determines how many random
variates to return. For instance:
set.seed(33) rf(n = 5)
Now generate 10,000 random variates from this pdf and store them in a vector
named X
.
Your script must generate a function named rf
and a vector named X
.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.