联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Matlab编程Matlab编程

日期:2024-07-09 11:07

MATH 377

MOCK MIDTERM EXAM - II

Financial and Actuarial Modelling in R

1.

(a)  Consider the vector made of length 8 generated by the following code: sample(0 : 9 ,   8 ,   replace  = T)

(i)  Write an R program that counts the number of unique entries of this vector.        [2 marks]

(ii)  Write an R program to obtain the entries that are strictly below the mean of the vector and even. Then, compute the median of the sub- tracted data. Note: return 0 if a vector of length 0 is obtained.  [3 marks]

(b)  Consider the  ToothGrowth  (The  Efect  of Vitamin  C on Tooth  Growth in Guinea Pigs) data set in R:

(i)  Create a boxplot for len for the records with supp equal to VC and dose equal to 1.0.   [2 marks]

(ii)  Find the sample mean of len per dose for the records with supp equal to OJ.                [2 marks]

(c)  Use a while loop to find the minimum integer value of n such that

(1.05)n  ≥ 100 .                               [4 marks]

2. Let Y be exponentially distributed with a mean of 0.5.  Consider X defined as

X = 0.5(exp(Y) − 1) .

(a)  Write an R function to compute the density function of X .  Evaluate your function at x = 1.5.        [4 marks]

(b)  Simulate a sample of size 1000 from X .                             [2 marks]

(c)  Using the maximum likelihood estimation method, fit the following distribu- tions to the simulated data set:

(i)  Gamma.                                                                                              [2 marks]

(ii)  Pareto.                                                                                                 [2 marks]

(iii)  Weibull.                                                                                            [2 marks]

(d)  Create QQ plots to assess the quality of the fits above visually.  Which fitted distribution seems to describe the data better?  Justify your answer. [3 marks]

(e)  Confirm your choice using an information criteria.  Justify your answer.    [2 marks]




版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp