MATH377: Financial and Actuarial Modelling in R Tutorial 6
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
MATH377: Financial and Actuarial Modelling in R
Tutorial 6
Exercise 1. Use the following code to simulate a bivariate data set of size 5000
n <- 5000 set.seed(1) y <- matrix(runif(2 * n), v <- rgamma(n, 1 / 2 , 1) u <- (1 - log(y) / v)ˆ(-1 |
ncol = 2) / 2) |
The objective of this exercise is to fit a multivariate model to the above data. We will perform two-stage estimation:
a) For the first margin (i.e., x[, 1]), fit the following distributions: Gumbel, lognormal, exponential.
c) Repeat a) for the second margin (x[, 2]).
e) First, we need to transform the data into the [0, 1]2. Using your selected models in b) and d), construct a sample on [0, 1]2 via the transformation (F1 (xi1; 1), F2 (xi2; 1)), i = 1, . . . , 5000.
g) Compute Kendall’s tau for the sample in e).
i) Fit the following copulas to the data in e): Clayton, Gumbel, Gaussian. Hint: You can use your copula models in h) as inputs.
j) Based on the log-likelihoods, which copula seems to describe better the data?
l) Compute the log-likelihood for your fitted model in k).
Exercise 2. Consider the cars data set in R.
a) Compute the correlation between speed and dist, and create a scatter plot to compare speed vs dist. Do you see any relationship?
b) Fit a linear regression model to explain distance in terms of speed.
d) Predict dist for values of speed of 28 and 30.
2022-03-19