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 R using the following code:
rpareto = function , alpha, l ambda)1
rp=1 ambda ***((1-runif(n))???(-1)-1)
rp)
The rpareto function generates a random sample of size n from a two-parameter Pareto distribution with parameters and .
(i) Generate, using rpareto, a random sample of size 25,000 from the two-parameter Pareto distribution with parameters =3 and =1, assigning the simulated values to a vector called A_vec. You should set a random number generator seed of NNN
1
before generating A-vec, where NNN is the last three digits of your student ID. Use the R function, head(), to display the first five values of A_vec in your answer script. [20]
(ii) Construct an R function, called A_exceed_u, with two arguments, A and u, that returns only the non-zero entries of a vector, E, where vector E is of length 25,000, with entries defined as:
Ei=max{Ai-u,0}
Use the R function, head(), to display in your answer script the first five values of A_exceed_u when A=Avec and u=1.
(iii) Construct another R function, called F-u, with one argument, A_greater-than_u, that returns a vector of length 101, containing the probabilities:
P(Ai-ux|Ai>u), where x0,
for values of x from 0 to 10 inclusive, at intervals of 0.1.
Use the R function, head(), to display in your answer script the first five values of Fu when Agreaterthanu=Aexceedu with arguments A=Avec and u=1.[20]
(iv) Plot, on a single graph, four line graphs of the values of F-u against x for the values of x specified in part (iii) when A_greater_than_u u A_exceed_u,A=Avec and u=1,2, Y and 4. You should use separate colours to identify each line graph and you should clearly specify which value of u is represented by each of the four line graphs.
[20]
(v) Comment on the graph produced in part (iv).
Hint: You are given that if xPareto(,), then the threshold exceedance x-u|x||>u is distributed as Pareto (,+u).
[20]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!