0% found this document useful (0 votes)
14 views9 pages

CS1 Actuarial Statistics May 2023 Solutions

Uploaded by

myselfsp05
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views9 pages

CS1 Actuarial Statistics May 2023 Solutions

Uploaded by

myselfsp05
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Institute of Actuaries of India

Subject CS1-Actuarial Statistics (Paper B)

May 2023 Examination

INDICATIVE SOLUTION

Introduction
The indicative solution has been written by the Examiners with the aim of helping candidates. The solutions
given are only indicative. It is realized that there could be other points as valid answers and examiner have given
credit for any alternative approach or interpretation which they consider to be reasonable.

Page 1 of 9
IAI CS1B-0523
Solution 1:
i) [Link](052023)
i (1)
u<-runif(150)
.
round(mean(u),2) (1)
[1] 0.52

This shows sample mean ~0.52. [2]

ii) chi<-qchisq(u,2)
i [2]

iii) gam<-qgamma(u,1,1/2)
i (1)
i
sum(chi-gam)
i (0.5)
[1]
. 0
We know the property that if X ~ Gamma(α,ʎ) then 2ʎX has χ2 distribution with 2α degrees of (1)
freedom.

We have X ~ χ2 with 2 degrees of freedom.


Above can be written as (2ʎX/2ʎ) ~ χ2 with 2α degrees of freedom where α=1,ʎ =1/2 (0.5)
Thus,
X ~ Gamma(α,ʎ) with α=1,ʎ =1/2
X ~ Gamma(1,1/2) (0.5)

This is why both samples are same.


[Max 3]

iv) .
a) hist(chi,
a main ="Histogram of chi square distribution sample") (1)
(1)

#Histogram shows positive skewed distribution (1)


[3]

b) >bsummary(chi) (1)
. Min. 1st Qu. Median Mean 3rd Qu. Max.
0.006184 0.603187 1.534968 2.217946 2.983161 12.350562

Alternate:
mean(chi) (0.5)
median(chi) (0.5)
#mean = 2.218
#median = 1.535

#Mean is greater than median since it is positively skewed distribution (1)


[2]
Page 2 of 9
IAI CS1B-0523

v) [Link](052023)
v (0.5)
y = rep(0,1000) (1)
for(i in 1:1000){ (1)
y[i] = sum(rchisq(150,2)) (2)
}
[Max 4]

vi) hist(y,
. main ="Histogram of Samples Sum") (0.5)
(1)

#The distribution of sample sums is roughly symmetrical. (1)


#This displays Central Limit Theorem property. As the sample size (1)
#gets large , distribution move towards normality. (1)
[Max 3]
[19 Marks]

Solution 2:
i) Sales<-[Link](<>)
i (1)
.
> mean(Sales$Value) (1)
[1] 1307.167
[2]

ii) i
a) cor(Sales$Value,Sales$City,method
a = "kendall") [1]
[1]
. -0.2130327

b) r<-cor(Sales$Value,Sales$Age)
b (1)
>. r*sd(Sales$Value)*sd(Sales$Age) (1)
[1] -278.5169
Alternate:
cov(sales$Value,sales$Age) (1.5)
[1] -278.5169 (0.5)
Credit is given if Kendall covariance is computed.
[2]
iii) i
a) plot(Sales$Value,Sales$Age)
a (1)
.

Page 3 of 9
IAI CS1B-0523

(1)

# No trend (showing linear relationship) is visible from the scatter plot. (1)
# Most likely it indicates that correlation is zero.
[3]

b) >[Link](Sales$Value,Sales$Age) (1)
.
Pearson's product-moment correlation
data: Sales$Value and Sales$Age
t = -0.95277, df = 58, p-value = 0.3447
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
-0.3665088 0.1340120 (1)
sample estimates: for CI
cor
-0.1241369
Confidence Interval is ( -0.367,0.134)
Since 0 lies in the confidence interval, we cannot reject the hypothesis that correlation coefficient (1)
= 0.
[3]

iv)
a) Since
a correlation between Value and Age is (close to) 0, age can be excluded. (2)

b) >bmodel1<-lm(data = Sales,Value~Device+City+Age) (1)


>. summary(model1) (1)

Call:
lm(formula = Value ~ Device + City + Age, data = Sales)

Residuals:
Min 1Q Median 3Q Max
-768.21 -239.97 -19.05 236.74 959.32

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2887.26 378.29 7.632 3.12e-10 ***
DeviceMobile -1022.97 110.18 -9.284 6.28e-13 ***
City -135.98 100.03 -1.359 0.1795
Age -26.25 13.41 -1.958 0.0552 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Page 4 of 9
IAI CS1B-0523
Residual standard error: 377 on 56 degrees of freedom
Multiple R-squared: 0.6388, Adjusted R-squared: 0.6195
F-statistic: 33.01 on 3 and 56 DF, p-value: 2.019e-12

Device = 1 for Mobile and 0 for Laptop. Parameter for this variable is significant.
Alternate : Device is significant (0.5)

Age and City are not significant … (1)


…….since p-value > 0.05. (0.5)
Age is expected to insignificant per the earlier analysis. (0.5)
[Max 4]

c) model2<-lm(data
c = Sales,Value~Device) (1)
>.
> anova(model1,model2) (1)
Analysis of Variance Table

Model 1: Value ~ Device + City + Age


Model 2: Value ~ Device
[Link] RSS Df Sum of Sq F Pr(>F)
1 56 7958529
2 58 8716151 -2 -757622 2.6655 0.07838 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

H0: β (City) = β (Age) =0 against H1: atleast one of β (City) or β (Age) is non-zero. (1)
In model 2, there are 2 less parameters thus -2 degrees of freedom in Anova analysis (1)
p-value >0.05 showing we can’t reject H0: β (City) = β (Age) =0. (1)
This indicates neither of the covariates have strong relationship with Order value. (0.5)
[Max 5]

d) summary(model2)
d (1)
.
Call:
lm(formula = Value ~ Device, data = Sales)

Residuals:
Min 1Q Median 3Q Max
-810.9 -240.1 -8.7 271.6 889.1

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2056.47 94.02 21.873 < 2e-16 ***
DeviceMobile -1045.54 111.06 -9.414 2.77e-13 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 387.7 on 58 degrees of freedom


Multiple R-squared: 0.6044, Adjusted R-squared: 0.5976
F-statistic: 88.62 on 1 and 58 DF, p-value: 2.77e-13

> # Value = 2056.47 - 1045.54 X Device, (1.5)


where Device= 1 for Mobile else 0 (0.5)
Alternate:
> # Value = 2056.47 - 1045.54 X Device Mobile (2)

[Max 3]

Page 5 of 9
IAI CS1B-0523

v) .
a) confint(model2,level=.95)
a (1)
. 2.5 % 97.5 %
(Intercept) 1868.268 2244.6737
DeviceMobile -1267.855 -823.2257
> # C.I. (-1267.8,-823.2) (1)
[2]

b) >bresidual<-model2$residuals (1)
>. n<-length(residual) (0.5)
> varhat<-var(residual) (1.5)
> (n-2)*varhat/qchisq(c(0.975,.025),58) (2)
[1] 105867.1 220588.2
> # C.I. (105867,220588) (1)
[Max 5]

vi) .
a) m<-mean(Sales$Order)
a (1)
>. m
[1] 2.383333 (1)
Mu hat = 2.383
[2]

b) table(Sales$Order)
b (1)
.
0 1 2 3 4 5 7
8 13 13 8 12 5 1 (1)
[2]

c) a<-[Link](table(Sales$Order))
c (1)
#using
. above table, combine order 5 and 5+
a[6]=sum(a[6:7]) (1)
a<-a[-7] #to remove 5+ as combine above (0.5)

e<-dpois(c(0:4),m) (1)
sum(e) (0.5)
[1] 0.9062099
e[6]<-1 - sum(e) (1)
sum(e) (1)
[1] 1

[Link](x=a,p=e) (2)
Chi-squared test for given probabilities
data: a
X-squared = 6.0026, df = 5, p-value = 0.306

Since p-value is greater than 0.05 , we can reject the hypothesis that number of order follows (1)
poisson distribution.
[Max 8]

vii) .
a) glm2<-glm(data=Sales,Order~Device,family=poisson(link="log"))
a (2)
>. summary(glm2) (1)

Call:
glm(formula = Order ~ Device, family = poisson(lin = "log"),
Page 6 of 9
IAI CS1B-0523
data = Sales)

Deviance Residuals:
Min 1Q Median 3Q Max
-2.4495 -0.6149 0.0000 0.5491 1.9652

Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.1942 0.2673 -0.726 0.468
DeviceMobile 1.2928 0.2814 4.594 4.34e-06 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for poisson family taken to be 1)

Null deviance: 81.185 on 59 degrees of freedom


Residual deviance: 51.570 on 58 degrees of freedom
AIC: 199.88

Number of Fisher Scoring iterations: 5 [3]

b) Log
b link function is used in above model. (0.5)
.
Log link implied log mu = linear predictor. Inverting to mu leads to mu = exp(linear predictor).
Exponent will make sure mu always remain greater than 0, an essential feature for poisson
distribution with mean mu. (1.5)
[2]

viii) .
a) Customers<-
a [Link](Device =c("Mobile","Mobile"),Age =c(18,28), City = c(1,2)) (1.5)
>. [Link](glm2,newdata = Customers,type= "response") (2)
12
33 (0.5)
[4]

b) Only
b device is used in the model and for both customers, device is same and thus, the predicted
value
. is same for both customers. [2]

ix) Channel <-[Link](Device =c("Mobile","Laptop")) (1.5)


> pred_order <- [Link](glm2,newdata = Channel,type= "response") (1.5)
> pred_value <- predict(model2,newdata = Channel) (1)
>
> totalvalue<-pred_order * pred_value (1.5)
> totalvalue
1 2
3032.791 1693.564 (1)
> #total value for Mobile = 3032.8
> # and for Laptop = 1693.6
[Max 6]
[61 Marks]

Solution 3:
i) #m1x0
i = E[X] and (0.5)
#m2x0=E[x^2]
. and var = E[x^2] - E[x]^2 >> m2x0 = var + E[x]^2 (0.5)

prior_mean=60
prior_sd=5
Page 7 of 9
IAI CS1B-0523

m1x0= prior_mean (0.5)


m2x0 = prior_sd^2 + prior_mean^2 (1)
> m1x0 (0.5)
[1] 60
> m2x0
[1] 3625 (0.5)
[Max 3]

ii) .
a) #a theta follows N(prior mean,prior variance)
#. Random Variable X follows N(theta,variance)
# posterior distribution of theta follows Normal with (0.5)
# post mean = (n*sample mean/variance +prior mean/prior variance)/ (1.5)
# (n/variance + 1/prior variance)
#post variance = 1/(n/variance + 1/prior variance) (1)
Max 2
n<-5
sample_mean<- 340/5
sdev<-20

post_mean = (n*sample_mean/sdev^2 + prior_mean/prior_sd^2)/(n/sdev^2 + 1/prior_sd^2) (2)


post_var= 1/(n/sdev^2 + 1/prior_sd^2) (1)

> post_mean (0.5)


[1] 61.90476
> post_var (0.5)
[1] 19.04762
> sqrt(post_var) (0.5)
[1] 4.364358
[Max 6]

b) sample2_mean<-3400/50
b (0.5)
n2<-50
.
post2_mean = (n2*sample2_mean/sdev^2 + prior_mean/prior_sd^2)/(n2/sdev^2 + 1/prior_sd^2) (1.5)

post2_var= 1/(n2/sdev^2 + 1/prior_sd^2) (0.5)


> post2_mean (0.5)
[1] 66.06061
> post2_var (0.5)
[1] 6.060606
> sqrt(post2_var)
[1] 2.46183
[Max 3]
iii) .
a) x<-60+seq(-3,3,by=0.2)*5
a
y<-dnorm(x,mean=60,sd=5)
.
plot(x,y,ylim=c(0,.2)) [1]

b) px1<-post_mean+seq(-3,3,by=0.2)*sqrt(post_var)
b (0.5)
py1<-dnorm(px1,mean=post_mean,sd=sqrt(post_var))
. (0.5)
lines(px1,py1) (1)
[2]

c) px2<-post2_mean+seq(-3,3,by=0.2)*sqrt(post2_var)
c (0.5)
py2<-dnorm(px2,mean=post2_mean,sd=sqrt(post2_var))
. (0.5)
lines(px2,py2) (1)
Page 8 of 9
IAI CS1B-0523
[2]

d) d
.

(1)

The posterior distribution with sample size =5 is close to prior distribution. There is slight shift to (1)
mean towards sample mean and similar dispersion.
When the sample size increased, the posterior distribution moves towards sample mean and (1)
dispersion.
More weight is given to sample where sample is big. Further, the variation reduced with larger (1)
sample size.
[Max 3]
[20 Marks]

*****************

Page 9 of 9

Common questions

Powered by AI

Model simplification through ANOVA comparison involves comparing nested models to determine if fewer predictors suffice. The approach tests the hypothesis that reduced model coefficients are zero, implying they don't contribute significantly. In the document, an ANOVA comparison between a full model and a reduced model with fewer predictors (Device only) showed a p-value greater than 0.05, suggesting that the additional predictors (City and Age) did not significantly improve the model fit, thus confirming the simplified model's adequacy .

The absence of a visible trend in a scatter plot often indicates that there is no linear relationship between the two variables being analyzed. In the document, when plotting Sales' values against Age, no trend was observed, which suggested that their correlation was likely zero. This absence of linear correlation was further supported by a correlation test, revealing a correlation estimate very close to zero with a confidence interval that included zero .

The Central Limit Theorem can be demonstrated by using the cumulative sum of random variables and analyzing the distribution of these sums. For instance, in the document, a set seed was used and a sum of chi-square distributed variables with 150 samples was repeatedly calculated 1000 times. The histogram of these sums showed a roughly symmetrical distribution, illustrating the Central Limit Theorem's property that as sample size increases, the distribution of sample sums approaches normality .

To identify variables to exclude in a multiple regression model, one assesses the p-values for each coefficient's statistical significance. Variables with p-values greater than the chosen significance level (commonly 0.05) may suggest insignificance. In the described model, after examining coefficients for Device, City, and Age, the p-values indicated that while Device was significant, Age and City were not, as their p-values were greater than 0.05. Additionally, analysis of variance between nested models is often used to confirm the exclusion of non-significant variables .

Model validation is critical in regression analysis to ensure the robustness and generalizability of the model's predictive capabilities. It typically involves evaluating the model's performance on a separate validation dataset not used during the training phase. Validation checks for overfitting, confirming that the model captures underlying patterns rather than noise. Aspects like residual analysis, goodness-of-fit tests, and significance of predictors are assessed to confirm that the model appropriately represents the observed data while maintaining predictive accuracy on unseen data. Proper validation ensures that insights and predictions derived are reliable .

In Bayesian inference, the prior distribution parameters greatly influence the posterior distribution by incorporating pre-existing beliefs into the updating process with new data. The prior mean and variance interact with sample data to shape the posterior mean and variance, affecting the resulting inference. As more data is observed, the posterior distribution tends to fall closer to the likelihood of the observed data. For example, as seen in the document, when sample size increased, the influence of the prior diminished, demonstrated by the posterior shifting closer to the sample mean and reducing variance, highlighting the dominance of data as its quantity increases .

In Poisson regression models, a log link function transforms the linear predictor into the positive, ensuring mean values remain positive, aligning with the Poisson distribution's non-negative mean requirement. Specifically, the log of the expected count is modeled as a linear combination of predictors. This log-transformation ensures the result remains within acceptable distributional assumptions for count data as it prevents mean values from being negative or zero .

A chi-squared test might lead to rejecting a hypothesis that data follows a Poisson distribution if the p-value from the test indicates statistical significance, typically less than 0.05, showing the observed frequencies significantly deviate from the expected Poisson frequencies. However, in the provided document, since the p-value was greater than 0.05, the hypothesis that the number of orders follows a Poisson distribution was not rejected, implying no significant deviation .

A confidence interval in regression analysis provides a range within which the parameter estimate is expected to lie with a certain level of confidence, often 95%. This interval helps assess the precision and reliability of the estimated parameters. A narrower interval suggests more certainty about the estimate, whereas a wider interval indicates less certainty. Decisions based on regression results, such as hypothesis testing or predictor inclusion, can depend heavily on the confidence intervals. In regression analysis, intervals that do not cross zero imply significance, impacting variable inclusion decisions .

The F-statistic in the context of a regression model provides information on the overall significance of the model. It tests the null hypothesis that all regression coefficients are equal to zero, indicating none of the predictors have any effect. A high F-statistic value, coupled with a low p-value, suggests that the model's predictors collectively have a significant impact. In the document, the F-statistic for the regression model indicated that the model was significant overall, evidenced by a very low p-value .

You might also like