MATH 377 Financial and Actuarial Modelling in R MARCH 2022 MOCK MIDTERM EXAM
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
MATH 377
MARCH 2022 MOCK MIDTERM EXAM
Financial and Actuarial Modelling in R
1.
(a) Use the following code to generate a vector of length 5 with entries integer
numbers between 0 and 9:
sample( 0 : 9 , 5 , replace = T)
(i) Write an R program that returns TRUE if the elements of the vector are in increasing order. [3 marks]
(ii) Write an R program to compute the average of those entries that are
above 2. Note: return 0 if non of the entries is above 2. [3 marks]
(b) Consider a vector of student grades with values 70, 80, 55, 67, 90, 92, 83, 74,
100, 87, 49, and a vector with the month of birth of the students with values ”Jan” , ”Nov” , ”Dec” , ”Feb” , ”Feb” , ”Nov” , ”Jun” , ”May” , ”Apr” , ”Jan” , ”Jul” .
(i) Create a data frame with the above data. [2 marks] (ii) Find the average grade for those students born in Febraury. [3 marks]
(c) We know that for |x| < 1
log(1 − x) = − ! n .
Use the series representation above, up to a finite number of terms N = 100,
to compute log(0.3). [3 marks]
2. Let Y be Gamma distributed with shape parameter 2 and scale parameter 1, that is, the density function of Y is given by
fY (y) = y2 − 1e−y , y > 0 .
Now, consider
X = 1/Y .
(a) Write an R function to compute the distribution function of X .
(b) Simulate a sample of size 2500 from X .
(c) Approximate E[(1/Y2)] using your simulated sample in (b).
[4 marks]
[3 marks]
[3 marks]
3. Let X be Lognormal distributed distributed with parameters µ = 2 and σ = 2. Recall that the density function of a lognormal distribution with param- eters µ ∈ R and σ > 0 is give by
f(x) = xσ2π exp " − # , x > 0 .
(a) Simulate a sample of size 1000 from X . [2 marks]
(b) With your simulated sample in (a), plot the log-likelihood function for pa-
rameter values µ between -3 and -1, and σ between 1 and 3. [3 marks]
(c) Using the maximum likelihood estimation method, fit the following distribu- tions to the simulated data set:
(i) Lognormal. (ii) Weibull.
(d) Which fitted distribution answer.
[3 marks]
[3 marks]
seems to describe the data better? Justify your
[3 marks]
4.
(a) Evaluate the joint density function of a Gaussian copula with Kendall’s tau
equal to −0.5 at (0.7, 0.5). [4 marks]
(b) Consider a multivariate model with first margin X1 ∼ N(0, 4), second margin
X2 exponentially distributed with mean 4, and copula the Gaussian copula in (a). Plot a 3D surface of the joint density of this multivariate model. [3 marks]
(c) Simulate 5000 observations from the multivariate model in (b). [3 marks]
(d) Using QQ plots, visually assess that your simulated sample has the margins specified in (b). [2 marks]
5. Consider the data set EuStockMarkets in R representing the ”Daily Closing Prices of Major European Stock Indices, 1991-1998” .
(a) Fit a linear regression model to explain the dependent variable ”DAX” in
terms of the independent (explanatory) variable ”SMI” . [3 marks]
2022-03-19