You are on page 1of 6

Statistics Quiz :3

Sudarshan Kumar

Q1 a. MLE estimate of Beta


Let payments=X and Claims =Y
The regression equation
= X i + ,

(1)

Likelihood function of Y
(,

2)

=
=1

2 2

( )2
22

Maximizing (, 2 ) is equivalent to minimizing -ln((, 2 )) which is equal to

( )2

2)
2)
(, = ln(2 +
2
2 2

(2)

(3)

=1

For maximization

This will gives us estimate of


R code:

( ) 2

=
=0

2 2

(4)

=1

Q1.a Calculate Beta

# 2. Compute beta_hat
Y<-Payment
X<-Claims
beta_h<- (Y)%*%(X)/ ((X)%*%(X))
beta_h
## [1,] 5016.056
#estimate of Beta

=1
=1 2

(5)

Q1.B Standard error of Beta


From equation 5

Putting = X i + in this equation

=
=

=1
=1 2

=1 (X i + )
=1 2

(6)

=1
=1 2 =1
+
=

+
=1 2
=1 2
=1 2
We can see it clearly =1 = 0 , (it is nothing but
representation of equation 4
=

2
= =

(=1 )2

Q1.C: MLE estimation of

(8)

2
=1 2

( =1( )2 + =1 =1( )( ))

(7)

(9)

2
=1 2

=1 2

=1 2

(10)

=1 2

Using equation 3 :

(,

2)

( )2

= ln(2 2 ) +
2 2
2
=1

For maximization, Differentiating wrt 2 and equating it to the zero

( )2

=0
2 2 2
2 4
=1

(11)

(12)

1
1
=> = ( )2 = 2

=1
=1
(Estimating by replacing )
2

=1

=1

1
1
2
2 = = 2 2 + 2 2

=1

=1

=1

(14)

1
= ( 2 2 + 2 2 )

This yield

=1
(=1 )2
1
= ( 2 2

+
2 )

2 2

=1 2
=1 =1
=1
=1
2 =

1
(

=1 2

Its biased as we will see it formally in Q d

Q1.d unbiased estimation of

=1
2

=1

(17)

= X i +

(18)

= ()X i +

This implies

(19)

= ()X i + 2 ()Xi
=1

=1

=1

=1

(20)

=1

=1

=1

=1

2
= 2 + 2 2 ( ) X i
2

(15)

(16)

= X i +

Using equation 16 and 17 :

(13)

(21)

Using equation 10 and 7

=
=1

2
=1 2
=1

=1
+ 2
X i = 2 + 2 2 2
=1 2
2

(22)

=1

Which will give

(23)

2 = ( 1) 2
=1

hence unbiased estimation of sigma


=1 2
1
This also answer the last part Q 1 c that MLE of sigma :-

(24)
2

=1

is biased

R code for b, c, d
Q1.b C and D standard error of regression and coefficient
e<- Y- beta_h * X
ESS<- t(e)%*%e #error sum of squares
ESS
##
[,1]
## [1,] 2.073899e+13
sigma2_hat<- ESS/(2182-1) #standard error of regression
sigma2_hat
##
[,1]
## [1,] 9508935471
SE_hat = sqrt(sigma2_hat)
# SD for beta hat
SD_beta_hat<- sqrt(sigma2_hat/(t(X)%*%(X)))
SD_beta_hat
##
[,1]
## [1,] 10.02538
MLEsigma2_hat=ESS/(2182)
MLEsigma2_hat
#MLE estimate of standard error of regression
##
[,1]
## [1,] 9504577572

Q1 E : 95% confidence interval of beta

= ,

(25)

=1
2

= (
)
=1 2
=1 2

Rcode
Q1.E 95 % confidence interval of Beta
LB=beta_h-1.96*SD_beta_hat
UB=beta_h+1.96*SD_beta_hat
LB

#confidence interval Of betahat

##
[,1]
## [1,] 4996.406
UB
##
[,1]
## [1,] 5035.705

Q1.F: formulation of modified model:


Since,
=

=> =

Hence if we create a new variable distance *claim then its a normal linear regression model
R code for model formulation

(26)

newdata=Claims*Kilometres
X=newdata
reg=lm(Y~X+0)
summary(reg)
##
##
##
##
##
##
##
##
##
##
##
##
##
##
##
##
##

Call:
lm(formula = Y ~ X + 0)
Residuals:
Min
1Q
-4854422
-19780

Median
0

3Q
10879

Max
9436080

Coefficients:
Estimate Std. Error t value Pr(>|t|)
X 2109.22
20.55
102.6
<2e-16 ***
--Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 434600 on 2181 degrees of freedom
Multiple R-squared: 0.8285, Adjusted R-squared: 0.8284
F-statistic: 1.053e+04 on 1 and 2181 DF, p-value: < 2.2e-16

Confidence interval of average severity for distance category 2


a= confint(reg,"X",level=0.95)
Dist2interval = a*2
Dist2interval
##
2.5 %
97.5 %
## X 4137.835 4299.044