, , , , , , , ,

[SOLVED] Quantitative risk management using copulas, fmsn65/masm33 computer assignment 2

$25

File Name: Quantitative_risk_management_using_copulas__fmsn65_masm33_computer_assignment_2.zip
File Size: 744.18 KB

5/5 - (1 vote)

Answer the following questions:
1. What are the properties of Archimedean copulas and their generators?
2. Write the bivariate ditribution functions for Frank, Clayton, Gumbel and AMH copulas.3. Find Laplace transform of a random variable which is distribute as Gamma(a,b) (the
density is given in (71) in collection of formulas). Set shape parameter a = 1/θ and rate
parameter b = 1. Explain how this result is related to Archimedean copulas and nd the
corresponding copula in the bivariate case.4. Suppose X is a d-dimensional random vector. Explain how multivariate normal and multivariate t distributions are dened.5. Explain how the dependency measures Pearson’s correlation ρ, Kendall’s τ and Spearman’s
ρS are dened. What is the relationship between Pearson’s correlation and two other
dependency measures?Getting started with the computational part:
If you plan to carry out the assignment on your own computer, you need to download and install
R from http://www.r-project.org.If you want to carry out the assignment in the computer room MH:230, you just need to start
one of the PCs rst. Then choose the latest version of R from the Start menu.In this assignment you need to use package copula. It is strongly recommended that you download the corresponding PDF le of the manual (copula.pdf) from cran.r-project.org to use as a
reference in the assignment. Type library(copula) to load the package to your R-session. The
package is also installed in all computers in the computer room MH:230. If you use your own
laptop you need to install package yourself; see the help page for install.packages for more
information.In exercises 2, 4 and 5 below you will generate observations from dierent distributions. As
you will be using the simulated values in other parts of this assignment you should save each
simulated dataset in an object for later use.In all the exercises below you will plot several datasets. Note that you can use mfrow to collect
any number of the plots in one single gure.
In each part you need to estimate dierent measures of dependence and compare them by their
theoretical values. Note that for elliptical copulas τ =
2
π
arcsin(ρ) and ρS =
6
π
arcsin(ρ/2). Moreover, for Archimedean copulas the relationship between the parameter of copula and Kendall’s
τ can be found in the attached table. Finally note that Spearman’s ρS can be calculated as the
correlation between the ranks of the observations.1. Generate 500 observations from a 3-dimensional normal copula with an exchangeable
covariance matrix with variance 1 and correlation 0.4. Plot the scatter plot of the simulated
observations.For each pair of the simulated sample calculate the empirical values of Pearson’s correlation
ρ, Kendall’s τ and Spearman’s ρS. Do the estimates agree with the theoretical values? In
addition, calculate the ranks of the observations and verify that the Spearman’s ρS can
be calculated as the correlation between the ranks of the observations.2. Generate 500 observations from a bivariate t copula with 8 degrees of freedom, an exchangeable characteristic matrix with diagonal 1 and o-diagonal values θ = −0.4, 0, 0.4
(use one value of θ in each simulation). Plot the scatter plot for each dataset and comment
on dependence between observations and parameter θ.For the simulated sample calculate the empirical values of Pearson’s correlation ρ, Kendall’s τ and Spearman’s ρS. Do the estimates agree with the theoretical values?3. Generate 500 observations from a 3-dimensional Frank copula with parameter 3. For each
pair of the simulated sample calculate the empirical values of Pearson’s correlation ρ,
Kendall’s τ and Spearman’s ρS. Do the estimates of Kendall’s τ agree with its theoretical
value?4. Use your results in Exercise 1 part 3 above and write a function which generates random
observations from the corresponding copula. The function should be able to generate any
number of observations in an arbitrary dimension for a given θ. In addition, it should not
contain any for(), while() or similar commands for one by one iteration. Include your
function in your report. Generate 500 observations from this copula in 3-dimensional case
with parameters θ = 0.5, 1, 5, 50.5. Suppose X is random variable uniformly distributed in the interval [−1, 1]. Let Y =
T(X) = arctanh(X) and Z = −T(X) = − arctanh(X).
ˆ Is function T(x) increasing? Why?ˆ Generate 1000 observations from X and plot the corresponding functions for Y and
Z.
ˆ Calculate Spearman’s ρ, Kendall’s τ and Pearson’s correlation for the simulated pairs
(xi
, yi) and (xi
, zi). Compare the results and comment on whether all three dependence measures produce reasonable results.For two simulated dataset from bivariate t in part 2 of Exercise 2 above plot the simulated
values and the corresponding pdf and cdf of each copula. Comment on the plots. Note that you
can use mfrow to collect all of the plots in one single gure.In this exercise we will compare four dierent copulas. Simulate 2000 observations from four
bivariate copulas as the following: the Gaussian copula with parameter ρ = 0.7; the Gumbel
copula with parameter θ = 2; the Clayton copula with parameter θ = 2.2; the t copula with
parameters df = 4 and ρ = 0.71. You will need to use the simulated samples in the second
part of this exercise so make sure you to save all the samples in R. Use par(mfrow=c(2,2)) and
plot all the simulated samples in one single plot. Comment on any dierences you see between
copulas.Use quantile transformation and transform all the simulated samples to bivariate distributions
with standard normal margins. Make a similar plot as above for the simulated bivariate observations. Note that the parameters of the copulas have been chosen so that all of these distributions
have a linear correlation that is roughly 70%. Do you see any dierences in the dependence
structure of the simulated observations despite the fact that all the simulated samples have the
same margins with the same linear correlations? Comment on the results.In each of the following parts calculate both the linear and Spearman’s correlation for each
dataset. Theoretically rank correlation should not be aected by change of the margins. At least
in one case below calculate both linear and rank correlation for the copula and corresponding
bivariate distribution with arbitrary margins and show that the rank correlation does not depend
on the marginal distribution.1. Generate 500 observations from a 2-dimensional distribution with normal copula (parameter 0.75) and N(0, 2) and exp(2) margins.
2. Generate 500 observations from a 2-dimensional distribution with Gumbel copula (parameter 2) and exp(4) and exp(2) margins.For each simulated dataset above plot the simulated values. Plot also contour plots of pdf of
the corresponding distributions. Note that you can use mfrow to collect all of the plots in one
single gure.A collection of measurements were taken from a representative sample of new cars in 1993.
Because some of the variables are measured at an ordinal scale, Spearman’s ρ is more appropriate
than Correlation for measuring monotonic association.The dataset cardata.txt can be downloaded from the following locations
ˆ The page Datasets in R under the Pages in the homepage of the course in Canvas,
ˆ http://www.maths.lth.se/matstat/kurser/fmsn15masm23/datasetsR.html.
1. Read the data to R (use read.csv() function) and plot a scatterplot matrix of the data
by uding pairs function in R.2. calculate Spearman’s ρ corresponding to the scatterplot matrix.
3. Does your results suggest that
ˆ vehicles with higher horsepower are more costly?
ˆ higher fuel economy (MPGcity) meant lower prices in 1993?4. Can you suggest a formal test to answer the same quesions above?
Hint: You can use help.search or RSiteSearch to search the help system for key words
or phrases.Consider a portfolio of 2 risks X1 and X2. Let the risks represent potential losses in dependent
lines of business for an insurance company and let u1 and u2 be some thresholds. Suppose the
insurer seeks reinsurance for the situation that both losses exceed their thresholds. In this case
these losses will be paid in full by the re-insurer. In the following we will analyze the problem
from the re-insurer’s point of view so their loss is when both thresholds are exceeded.Based on historical data we can assume that Xi ∼ Lognormal(0, 1), i = 1, 2. Further we assume
that τ (X1, X2) = 0.5 and we take both thresholds ui
, i = 1, 2 equal to 0.95-quantile of each
marginal distribution. Answer the following questions based on each of the following assumptions
for the joint distribution:
ˆ Gaussian copula
ˆ t-copula with 2 degrees of freedom
ˆ Gumbel copula.1. Calculate probability that both losses exceed their thresholds.
Computer Assignment 2, FMSN65/MASM33 5
2. Calculate the ratio of the payout probabilities for the reinsurance company for each pair
of copulas.3. How do the ratios change if we increase the threshold to the 0.99-quantile of each margin?
4. Use simulation to estimate expected value of loss for the reinsurance company corresponding to the both choices of thresholds above.
5. Compare also the upper tail dependence for the copulas and comment on the practical
consequences of your results.In this exercise we will use copulas to analyze an insurance dataset on indemnity claims. Figure 1
shows observations on 1500 liability claims for an insurance company. The indemnity payment
(Loss) and the allocated loss adjustment expense (ALAE) are recorded in USD for each claim.Here, ALAE are types of insurance company expenses that are specically attributable to the
settlement of individual claims such as lawyers’ fees and claims investigation expenses.
The dataset insuranceData.txt can be downloaded from the following locations
ˆ The page Datasets in R under the Pages in the homepage of the course in Canvas,
ˆ http://www.maths.lth.se/matstat/kurser/fmsn15masm23/datasetsR.html.Loss
ALAE
10 100 1000 10000 1e+05 1e+06 1e+07
10 100 1000 10000 1e+05 1e+06
1e−04 0.001 0.01 0.1 1 10 100
1e−04 0.001 0.01 0.1 1 10
Figur 1: Scatterplot of ALAE verses Loss: The bottom and left axes represent the original data
(log-scale). In the analysis we scale the data so that one unit corresponds to 100 000 USD. The
corresponding rescaled axes are in the top and right side of the gure.1. Read the data to R (use read.table(“insuranceData.txt”,header=T) function) and
plot a gure similar to Figure 1.
6 Computer Assignment 2, FMSN65/MASM33
2. Calculate the correlation between Loss and ALAE.3. Fit a bivariate distribution to the dataset by using copulas. For general optimization you
can use the function optim() in R. Note that you need to pass the dataset as a matrix
to optim() otherwise it will not produce any results (see the function as.matrix())).
In addition, the package fitdistrplus can be used to estimate parameters for several
univariate distributions.Note that you need to provide the details of your calculations here. Specically, you have to
present the details of the univariate distributions you have tried for each margin and justify
your nal choice of the marginal distributions by providing suitable checks or goodness of
ts plots. The same applies to the choice of copula. You should also use dierent estimation
methods (FML, IFM and CML) in tting the models.Suppose a reinsurer considers selling reinsurance to this company. As a simple model assume
they agree on a policy with limit L for the reinsurer and retention R for the insurance company.To formulate this policy in mathematical terms let X1 and X2 denote the Loss and ALAE,
respectively. Assuming a proportional sharing of expenses, the above policy means that the
reinsurer’s payment, RP(X1, X2), can be expressed as the following:
RP(X1, X2) =



0 if X1 < R
X1 − R +
X1−R
X1
X2 if R ≤ X1 < L
L − R +
L−R
L X2 if X1 ≥ LSuppose the reinsurer wants to estimate E[RP(X1, X2)] using simulations.
1. Use the tted distribution above and estimate E[RP(X1, X2)] for all combinations of
L = 10 000, 500 000, 1 000 000 and R/L = 0, 0.25, 0.75, 0.95.2. Suppose one makes an unrealistic assumption that Loss and ALAE are independent. Calculate the corresponding values of E[RP(X1, X2)] for the same combinations of L and R
as in the previous part. In which cases the reinsurance premium is under- or overvalued?Finishing O:
When you’ve nished, close down R by typing q(). Choose `Save’ when prompted as to whether
you want to retain your workspace.
Tail Dependence 3-30
Copula τ λU λL
Gauss 2
π
arcsinρ 0 for ρ < 1 0 for ρ < 1
−1 ≤ τ ≤ 1 1 for ρ = 1 1 for ρ = 1

2
π
arcsinρ 2tν+1 q(ν+1)(1−ρ)
1+ρ

λU
−1 ≤ τ ≤ 1 −1 ≤ ρS ≤ 1
Gumbel 1 −
1
θ
2 − 2
1
θ 0
0 ≤ τ ≤ 1
Clayton θ
θ+2 0 2− 1
θ
0 ≤ τ ≤ 1
Frank 1 −
4
θ
{1 − D1(θ)} 0 0
Dk (x) = k
x
k
Rx
0
t
k
e
t−1
dt
−1 ≤ τ ≤ 1
Table 5: Kendall’s τ and TDCs for various selected copulae.
MSR

Shopping Cart
[SOLVED] Quantitative risk management using copulas, fmsn65/masm33 computer assignment 2[SOLVED] Quantitative risk management using copulas, fmsn65/masm33 computer assignment 2
$25