Professional Documents
Culture Documents
Question A
1. Draw 200 random samples each of size 80 from a normal distribution with
mean 3 and variance 9.
Solution
Samples generated. Refer to sheet # 1 of excel file
1
2. Write down the distribution of the sample mean. Test using the data
obtained above, if the sample means follow that distribution.
Solution:
Sample mean shows approximately Normal distribution.
Chi-square goodness of fit test for normal distribution (sheet #5 green shaded) :
Ho: Sample mean does not follow normal distribution
H1: Sample mean follow normal distribution
Chi-square test results
Err. (fo-fe)2/fe
Bin Frequency freq(rel) freq(expec)
1.73 0 0 7.64202E-05 7.64202E-05
1.95 5 0.025 0.000796139 0.735834773
2.17 11 0.055 0.005797052 0.41761397
2.39 19 0.095 0.027811389 0.162318733
2.61 38 0.19 0.087983388 0.118288114
2.83 51 0.255 0.183668427 0.027703147
3.05 39 0.195 0.253118458 0.013344563
3.27 28 0.14 0.230334406 0.035428076
3.49 5 0.025 0.138392568 0.092908706
3.71 4 0.02 0.054883808 0.022171932
chi. sq. error 1.625688433
dof 8
chi sq cr.val.
5% 15.50731306
2
Chi-square summation of error is much less than the critical value of chi. Square
error for 95% confidence interval. Thus, we can say that this sample mean
distribution follows normal distribution.
3. Draw 200 random samples each of size 90 from a normal distribution with
mean 6 and variance 9.
Solution
Samples generated. Refer to sheet # 2
Sample means follow normal distribution (refer sheet # 5 ) chi square goodness
of fit test (refer blue shaded cells)
4. Test using the data obtained above in 1) and 3), if the difference in sample
means follow normal distribution.
Solution:
3
µ2-µ1 calculated using data from question 1 and 3. Refer to sheet # 3
Ho: difference of two Sample means does not follow normal distribution
H1: difference of two Sample mean follow normal distribution
Hypothesis testing
Chi. Square goodness of fit test results
Bin Frequency freq(rel) freq(exp.) Err . (fo-fe)2/fe
2.07 0 0 0.024962142 0.024962142
2.28 7 0.035 0.039558511 0.000525298
2.49 8 0.04 0.076627674 0.017507859
2.7 17 0.085 0.122396302 0.011425863
2.91 39 0.195 0.161213118 0.007081021
3.12 30 0.15 0.175101275 0.00359834
3.33 33 0.165 0.156832956 0.000425297
3.54 25 0.125 0.115835441 0.000725073
3.75 21 0.105 0.070549433 0.016822836
3.96 14 0.07 0.035430751 0.033728693
4.17 5 0.025 0.01467182 0.007270489
4.38 1 0.005 0.005009356 1.74748E-08
Total chi. Sq.
err. 0.12407293
dof 9
Chi.sq.cr.val.5% 16.9189776
Chi-square summation of error is much less than the critical value of chi. Square
error for 95% confidence interval. Thus, we can reject Ho and say that this
difference of sample mean distribution follows normal distribution.
5. Compute 95% confidence interval for the difference of means from each
of the 200 samples. Draw a graph to show all 200 confidence intervals and
comment.
All 200 C.I. computed. Refer to sheet # 4
4
Question B
Collect weekly price of any stock of your choice from the Indian stock market
for last three years, and the NIFTY INDEX vales for the corresponding weeks to
answer the following questions:
a. First, compute the weekly changes in the price (PC ) of the selected
stock as well as in the nifty index values (IC).
Solution:
Refer sheet # 6
Historical data of weekly closing price of BPCL and Nifty 50 taken from yahoo
finance.
5
b. Classify each of PC and IC in three suitable ranges (calling them Low,
Medium and High) and then construct a two-way table.
Solution:
I divided the range of PC into three equal parts after ignoring two outliers on each
side of the extremes. Following is the criteria for division of the PC and IC into
three categories.
Solution:
Refer sheet #6
# times IC is high = 15
#times IC is high and PC is low = 10
P(A|B)= P(AUB)/P(B)
P(PC low given IC is high )= 10/15 = 2/3=0.6666= 66.66%
Ho: PC is dependent on IC
H1: PC and IC are independent
Chi square test of independence
Chi Square Test
Expected(IC) Observed(PC) error
LOW 93 115 5.204301075
MEDIUM 49 38 2.469387755
HIGH 15 4 8.066666667
6
Chi square sum of errors comes out to be 0.00038. The probability that a value of
the χ2 statistic at least as high as the value calculated by the chi square test
formula could have happened by chance under the assumption of independence
is very less. Sum of errors is more than critical value. Thus, we can reject Ho.
IC and PC are not dependent.
Qn B [e] % Weekly PC
mean 0.2058
std. dev 0.312895353
t (for 0.5%) 0.940238885
Probability of % PC > 0.5% 0.174274328
Solution:
Ho: 90% of average weekly IC is not more than 0.5%.
H1: 90% of average weekly IC is more than 0.5%.
%weekly IC
mean 0.2487 t(for 0.5%) 1.818807
std. dev 0.138164515
Probability(x>0.5%) 0.035429364
P value for average weekly IC more than 0.5% is 0.0354 thus, 90% of average
weekly IC is not more than 0.5%. We accept the null hypothesis.
7
g. Test if the variation in weekly IC is at most 1%.
Solution:
Assuming population to be normal, the variance of samples will follow a chi
square distribution
Refer Sheet #7
Ho: PC averages across high and low IC are equal. (µ1-µ2)=0
H1: PC averages across high and low IC are not equal. (µ1-µ2) is not =0
sample stats:
(µ1-µ2)
Std. Deviation 4.899828778
Mean 3.728909776
Our t stat for 95% confidence level lies within critical value. Thus, we could reject
null hypothesis.
Thus, PC averages across high and low IC are not equal within 95% confidence
level.
8
i. Is the variation of weekly PC when IC is low same as that of IC
when it is high?
Solution:
Refer Sheet #7
Ho: Variance of weekly PC when IC is low not same as that of IC when it is high
H1: Variance of weekly PC when IC is low same as that of IC when it is high
F= S1^2/S2^2
F|obser. 1.092707952
F|critical 1.799557846
F|alpha/2 0.625088459
Ho not
rejected
For 95% confidence level, the critical value of F comes out to be equal to 1.7995
F observed from the sample data = 1.0927. Thus, we can’t reject null hypothesis.
Ho: P1=P2
H1: P1 not = P2
PC>0.5%
IC Frequency Proportion
Low 52 0.590909091
Medium 28 0.318181818
9
P1-P2 (mean) 0.272727273
P bar (variance) 0.495454545
z 2.327084782
probab, P1=P2,
PC>0.5% 0.999983114
P value for P1=P2 given PC>0.5% is 0.999. Required confidence level is 0.95
P value is > confidence level required. Thus, We cannot reject null hypothesis.
P1=P2 within 95% confidence level.
Anova: Single
Factor
SUMMARY
Groups Count Sum Average Variance
IC high 15 46.73203 3.115468 336.2199
IC Medium 49 74.96802 1.52996 207.7722
IC low 93 -57.05 -0.61344 290.3028
ANOVA
Source of Variation SS df MS F P-value F crit
Between Groups 268.6652 2 134.3326 0.499836 0.607611 3.054771
Within Groups 41388 154 268.7533
10
l. Find the correlation between PC and IC for the whole sample and
also separately for each combination of PC and IC classification.
What can you say about the relation?
Refer Sheet # 9
PC IC IC(high) IC(medium) IC(low) PC(high) PC(medium) PC(low)
PC 1
IC 0.413826645 1
IC(high) 0.380025038 -0.30362 1
IC(medium) 0.054630424 -0.04208 0.140309 1
IC(low) 0.078873263 0.048677 0.048675 -0.099237621 1
PC(high) -0.784946194 0.799776 -0.97006 0.495069775 0.61876 1
PC(medium) -0.010381521 0.167915 -0.3288 -0.115452793 0.18095 0.61833735 1
- -
PC(low) -0.010146361 0.10828 -0.32441 -0.040986951 0.13837 0.492289254 0.086333269 1
PC high and IC high has a strong negative co-relation. Thus we may interpret that
when there is a high change in nifty, the chances of high change in BPCL stock
is less likely.
% Weekly PC
mean 0.2058
std. dev 0.312895353
t (for 0.5%) 0.940238885
Probability 0.174274328
Confidence 95% CI 95% CI
interval for lower upper
95% level limit limit
0.618058282 -0.4123 0.8239
11
n. Find a 95% confidence interval for proportion of weeks with more
than 0.5% PC.
Refer Sheet #8
PC>0.5%
IC Frequency Proportion
Low 52 0.590909091
Medium 28 0.318181818
P1-P2 0.272727273
P bar 0.495454545
z 2.327084782
probab, P1=P2,
PC>0.5% 0.999983114
Confidence
intervals:
sample
proportion of
weeks with
>0.5% 0.560509554
sample std.dev 0.035095484
t|alpha/2 1.654679996
95% CI(UL,LL) 0.618581349 0.502437759
12
Question C
Refer Sheet # 10
Refer Sheet # 10
13
d) Fit a normal distribution with an appropriate mean and
variance on the sample averages. Test the goodness of fit.
Refer Sheet # 11
Chi-square goodness of fit test
Normalised expected
observed frequency(normal
Bin Frequency frequency dist.) error
2.21800 0.00000 0.00000 0.00000 0.00000
4.48400 6.00000 0.01200 0.00937 0.00074
4.58000 8.00000 0.01600 0.01875 0.00040
4.67600 24.00000 0.04800 0.04297 0.00059
4.77200 50.00000 0.10000 0.08129 0.00431
4.86800 46.00000 0.09200 0.12695 0.00962
4.96400 87.00000 0.17400 0.16366 0.00065
5.06000 86.00000 0.17200 0.17418 0.00003
5.15600 72.00000 0.14400 0.15303 0.00053
5.25200 67.00000 0.13400 0.11099 0.00477
5.34800 32.00000 0.06400 0.06645 0.00009
5.44400 13.00000 0.02600 0.03284 0.00143
5.54000 5.00000 0.01000 0.01340 0.00086
5.63600 2.00000 0.00400 0.00451 0.00006
5684.00000 2.00000 0.00400 0.00161 0.00357
Total chi sq error 0.02765
DOF 11
P value 1
14
a) Sketch the distribution of the sample average age.
Refer Sheet # 12
Refer sheet # 13
Chi square goodness of fit test for normal :
F(exp.
Bin Frequency F(obs) Norm.) error
34.593 0 0 0.006994783 0.006994783
34.843 6 0.015 0.016657231 0.000164878
35.093 18 0.045 0.041920154 0.000226274
35.343 35 0.0875 0.084612576 9.8534E-05
35.593 66 0.165 0.136982941 0.005730317
35.843 76 0.19 0.177883991 0.000825244
36.093 61 0.1525 0.185291995 0.005803353
36.343 52 0.13 0.154820165 0.003979072
36.593 47 0.1175 0.103762913 0.001818642
36.843 24 0.06 0.055780762 0.000319142
37.093 11 0.0275 0.024050817 0.000494655
37.343 2 0.005 0.008316602 0.001322637
37.593 2 0.005 0.00230618 0.003146619
Total chi sq
err 0.03092415
DOF 10
P value 1
P value ~1 thus we can say that the sample mean approximately follows a
normal distribution.
15