Title | Classwork 2 sol - Yaxing Yang |
---|---|
Course | Data Analysis |
Institution | 香港科技大學 |
Pages | 4 |
File Size | 126.7 KB |
File Type | |
Total Downloads | 87 |
Total Views | 178 |
Yaxing Yang...
Solution to the Classwork2 (Assignment 7) a)i)
Analysis of Maximum Likelihood Estimates Paramete r
D F
Estimat e
Standar d Error
Wald ChiSquare
Pr > ChiS q
Intercept
1
0.1276
0.7313
0.0305
0.8615
vision
1
1
1.6692
0.8815
3.5858
0.0583
vision
2
1
0.1645
0.7784
0.0447
0.8326
drive
1
1
-0.8852
0.6681
1.7552
0.1852
Log(p/1-p) = 0.1276 + 1.6692* I{vision=1}+0.1645*I{vision=2}– 0.8852 *I{drive=1} Where p = Pr ( accident = 1).
Deviance and Pearson Goodness-of-Fit Statistics Criterion Value DF Value/DF Pr > ChiSq Deviance 2.6498 2 1.3249 0.2658 Pearson 2.6166 2 1.3083 0.2703 H0: The model is fitted well H1: The model is not fitted well Deviance Statistic= 1.3249 and its p-value is 0.2658. Pearson Statistic= 1.3083 and its p-value is 0.2703. Sine both p-value >0.05, the model is fitted well.
ii)
Odds Ratio Estimates Effect
Point Estimate
90% Wald Confidence Limits
vision 1 vs 3
5.308
1.245
22.627
vision 2 vs 3
1.179
0.328
4.241
drive 1 vs 0
0.413
0.137
1.238
Estimation of Odd Ratio for a smoker verse a non-smoke is 0.413, Confidence Interval= (0.137,1.238) iii)
Contrast Estimation and Testing Results by Row Contrast
Type
Ro w
Estimat e
Standar d Error
bad vision vs EXP norm vision
1
4.5029
3.7138
Alph a
Confidence Limits
0.05 0.8942 22.6744
Wald ChiSquare
Pr > ChiS q
3.3285
0.0681
Estimation of Odd Ratio= 4.5029 H0: Odd ratio is equal to 1 H1: Odd ratio is not equal to 1 Test Statistic= 3.3285, P-value= 0.0681>0.05. We conclude that the odd ratio is equal to 1. iv) Contrast Estimation and Testing Results by Row Contrast
Type
Ro w
Estimat e
Standar d Error
Alph a
Confidence Limits
Wald ChiSquare
Pr > ChiS q
drive=1 & vision=1
PRO B
1
0.7133
0.1488
0.05
0.3741
0.9120
1.5690
0.2104
drive=1 & vision=2
PRO B
1
0.3559
0.1414
0.05
0.1416
0.6493
0.9241
0.3364
drive=1 & vision=3
PRO B
1
0.3192
0.1356
0.05
0.1212
0.6144
1.4730
0.2249
Prob. (having an accident for vision=1 & drive=1)= 0.7133 Prob. (having an accident for vision=2 & drive=1)= 0.3559 Prob. (having an accident for vision=3 & drive=1)= 0.3192 The worse the vision , the higher the probability of having accident. b)i) Analysis of Maximum Likelihood Estimates Parameter
D F
Estimat e
Standar d Error
Wald ChiSquare
Pr > ChiS q
Intercept
1
1.0986
1.1547
0.9052
0.3414
vision
1
1
0.9808
1.5679
0.3913
0.5316
vision
2
1
-1.3218
1.3354
0.9796
0.3223
drive
1
1
-2.3514
1.4058
2.7978
0.0944
drive*visio n
1 1
1
0.9651
1.9624
0.2418
0.6229
Analysis of Maximum Likelihood Estimates Parameter
drive*visio n
1 2
D F
Estimat e
Standar d Error
Wald ChiSquare
Pr > ChiS q
1
2.5745
1.7106
2.2651
0.1323
Log(p/1-p) = 1.0986 + 0.9808*I{ vision=1}– 1.3218 *I{ vision=1} – 2.3514I{ drive=1} + 0.9651 *I{drive=1,vision=1}+ 2.5745 *I{drive=1,vision=1} Where p = Pr(accident=1) ii) Contrast Estimation and Testing Results by Row Contrast
Type
Ro w
Estimat e
Standar d Error
Alph a
bad vs good
EXP
1
2.6667
4.1811
0.01
Confidence Limits 0.0470
151.3
Wald ChiSquare
Pr > ChiS q
0.3913
0.5316
Estimation of odd ratio= 2.6667 H0: Odd ratio is equal to 1 H1: Odd ratio is not equal to 1 Test Statistic= 0.3913, p-value= 0.5316 So, we cannot rejeect H0 and we conclude that odd ratio is equal to 1. (Here we assume drive=1, the answer for assuming drive=0 is also right). c)
Analysis of Maximum Likelihood Estimates Paramete r
D F
Estimat e
Standar d Error
Wald ChiSquare
Pr > ChiS q
Intercept
1
0.8747
1.0644
0.6753
0.4112
1
-2.6399
1.7296
2.3296
0.1269
1 -0.00261
0.0222
0.0138
0.9063
1
0.0347
0.9588
0.3275
drive
1
age age*drive
1
0.0340
Contrast Estimation and Testing Results by Row Wald ChiSquare
Pr > ChiS q
0.6102
1.0914
0.2962
0.0546
0.6400
1.6948
0.1930
0.3700
0.8982
1.4164
0.2340
Contrast
Type
Ro w
Estimat e
Standar d Error
Alph a
Confidence Limits
40 & drive=1
PRO B
1
0.3749
0.1147
0.05
0.1869
20 & drive=1
PRO B
1
0.2426
0.1607
0.05
20 & drive=0
PRO B
1
0.6948
0.1466
0.05
(3)>(1)>(2).
Since the coefficient of drive is negtive and the coefficient of age*drive is positive, we conclude from the model that the subject receiving drive education has a lower possibility for having an accident than those without receiving drive education. Older driver with drive education has higher possibility for having an accident than young ones with drive education....