Question: Before answering this question, construct the function, rpareto, in R using the following code: rpareto = function , alpha, l ambda ) 1 r p
Before answering this question, construct the function, rpareto, in using the following code:
rpareto function alpha, ambda
ambda runif
rp
The rpareto function generates a random sample of size from a twoparameter Pareto distribution with parameters and
i Generate, using rpareto, a random sample of size from the twoparameter Pareto distribution with parameters and assigning the simulated values to a vector called Avec. You should set a random number generator seed of NNN
before generating Avec, where NNN is the last three digits of your student ID Use the function, head to display the first five values of Avec in your answer script.
ii Construct an function, called Aexceedu with two arguments, A and that returns only the nonzero entries of a vector, where vector is of length with entries defined as:
max
Use the function, head to display in your answer script the first five values of Aexceedu when and
iii Construct another R function, called with one argument, Agreaterthanu that returns a vector of length containing the probabilities:
where
for values of from to inclusive, at intervals of
Use the function, head to display in your answer script the first five values of when with arguments and
iv Plot, on a single graph, four line graphs of the values of against for the values of specified in part iii when Agreaterthanu Aexceedu and Y and You should use separate colours to identify each line graph and you should clearly specify which value of is represented by each of the four line graphs.
v Comment on the graph produced in part iv
Hint: You are given that if then the threshold exceedance is distributed as Pareto
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
