Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4. [15 marks] Consider the following density function f(r; k, A) = . KAK I( k+1) for = > >, (4) with shape parameter k
4. [15 marks] Consider the following density function f(r; k, A) = . KAK I( k+1) for = > >, (4) with shape parameter k > 2 and scale parameter > > 0. a) Give an explicit formula for the cumulative distribution function F(.) of a random variable X having density function f(r; k, A). b) Give an explicit formula for the inverse function F-1(.). c) Suppose you can only generate observations from a uniform random variable U on [0, 1] (using the R function runif ()). What is the name of the method seen in the lectures that enables you to simulate an observation x according to the distribution F from an observation u of U. d) Write an R function simf () that can generate randomly n i.i.d. observations from f(x; k, >). This function should have three arguments: n (for the sample size n), k and lambda. The last argument should be optional and have 1 as a default value. Your function should first check that input values for the arguments are correct, or return an error message. e) Write an R function denf () that can be used to evaluate the density in (4) at all values of an R vector x. This function should have three arguments: x, k and lambda. The last argument should be optional and have 1 as a default value. How would you use R to check that the function written in Part (d) works properly? Give an R code for that. f) Suggest an algorithm to approximate E ex] using Monte Carlo integration. You do not need to write the R code but make sure you derive the expressions that you need to use to execute the algorithm
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