(Use R programming language) Let X be a random variable representing claims for a particular insurance policy. The following are 15 observations of X: 13 24 17 101 27 40 18 36 5 9 53 35 13 77 63
(a) Give basic summary statistics for these data and produce a box plot. Briefly comment on center, spread and shape of the distribution.
(b) Assuming a gamma distribution, compute maximum likelihood estimates for the parameters.
(c) Draw a density histogram and superimpose a pdf for a gamma distribution using the estimated parameters.
(d) Draw a QQ plot to compare the data against the fitted gamma distribution. Include a reference line. Comment on the fit of the model to the data.
R Code Outputs
a) Box Plot and Summary Statistics
> X<-c(13,24,17,101,27,40,18,3,5,9,53,35,13,77,63)
> summary(X)
Min. 1st Qu. Median Mean 3rd Qu. Max.
3.0 13.0 24.0 33.2 46.5 101.0
> boxplot(X)
> sd(X)
[1] 28.74817
> library(moments)
> kurtosis(X)
[1] 3.140288 # Leptokurtic
> skewness(X)
[1] 1.060631 # Positively skewed
Boxplot
b)Fitting the Gamma Distribution with ML Estimates
> library(fitdistrplus)
> fitdistr(X,"gamma")
shape rate
1.39547500 0.04203229
(0.46112774) (0.01664591)
c)Density Histogram
> U<-rgamma(n=1000,shape=1.39547500
,rate=0.04203229)
> truehist(X)
> lines(density(U),lwd=2)
Output:
d) QQ Plot and Reference Line
> qqplot(X,U)
> qqline(X,U)
Output:
Since,the points on the QQ plot donot co incide with the reference line at all.It can be said that it is not a satisfactory fit,
Get Answers For Free
Most questions answered within 1 hours.