MATH 377 Financial and Actuarial Modelling in R MOCK MIDTERM EXAM - IIHaskell

Java Python 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& MATH 377 Financial and Actuarial Modelling in R MOCK MIDTERM EXAM - IIHaskell nbsp;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         

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值