Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Homework 5 for Statistics in Applications | STA 5168, Assignments of Statistics

Material Type: Assignment; Professor: Niu; Class: STAT IN APPLCTNS III; Subject: STATISTICS; University: Florida State University; Term: Unknown 1989;

Typology: Assignments

Pre 2010

Uploaded on 08/27/2009

koofers-user-o0p
koofers-user-o0p 🇺🇸

10 documents

1 / 17

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Jaime Frade
STA5168
Dr. Niu: HW5
8.2
a)
Home
President Busing Yes (1) No (2) Don’t Know(3)
Yes Yes 41.945197 63.760672 0.2941318
No 69.087698 159.64184 0.2704591
Don't Know 1.9671055 15.597485 0.4354091
No Yes 1.0548033 5.9451967 2.602E-10
No 4.9123022 42.087698 6.766E-10
Don't Know 0.0328945 0.9671055 2.562E-10
Don’ Know Yes 5.631E-10 3.2941318 0.7058682
No 1.0426E-09 9.2704591 0.7295409
Don't Know 1.427E-11 0.4354091 0.5645909
Estimated conditional odds ratio for BD
52010658.1
)087698.69)(76072.63(
)64184.159)(945197.41(
The odds of favoring of busing of (Negro/Black) and white school children from one school district to
another for those who had anyone in their family brought a friend who was a (Negro/Black) home for dinner
during last few years are estimated to be 1.52 times the odds of favoring of busing for who had not have
anyone dinner with Black at home given that they would vote for Black president.
Estimated conditional odds ratio for BP
82745212.2
)087698.69)(0548033.1(
)9123022.4)(945197.41(
Given that people had anyone in their family brought a friend who was a Black home for dinner, the odds of
favoring of busing of Black and white school children from one school district to another for those who
would vote for Black for President if that person is nominated are estimated to be 2.82 times the odds of
favoring of busing for those who would not vote Black for President.
Estimated conditional odds ratio for BP
70787006.3
)760672.63)(0548033.1(
)92451967.5)(945197.41(
Given that people favor busing of (Negro/Black) and white school children from one school district to
another, the odds of having anyone in your family brought a friend who was a (Negro/Black) home for
dinner for those who would vote for Black President if he were qualified for the job estimated to be 3.71
times the odds of having anyone in your family brought a friend who was a (Negro/Black) home for dinner
for those who would not vote for Black for President if he were qualified for the job.
8.2
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Homework 5 for Statistics in Applications | STA 5168 and more Assignments Statistics in PDF only on Docsity!

STA

Dr. Niu: HW

a)

Home President Busing Yes (1) No (2) Don’t Know(3) Yes Yes 41.945197 63.760672 0. No 69.087698^ 159.64184 0. Don't Know 1.9671055^ 15.597485 0. No Yes 1.0548033 5.9451967 2.602E- No 4.9123022^ 42.087698 6.766E- Don't Know 0.0328945 0.9671055 2.562E- Don’ Know Yes 5.631E-10 3.2941318 0. No 1.0426E-09 9.2704591 0. Don't Know 1.427E-11 0.4354091 0.

Estimated conditional odds ratio for BD

The odds of favoring of busing of (Negro/Black) and white school children from one school district to

another for those who had anyone in their family brought a friend who was a (Negro/Black) home for dinner

during last few years are estimated to be 1.52 times the odds of favoring of busing for who had not have

anyone dinner with Black at home given that they would vote for Black president.

Estimated conditional odds ratio for BP

Given that people had anyone in their family brought a friend who was a Black home for dinner, the odds of

favoring of busing of Black and white school children from one school district to another for those who

would vote for Black for President if that person is nominated are estimated to be 2.82 times the odds of

favoring of busing for those who would not vote Black for President.

Estimated conditional odds ratio for BP

Given that people favor busing of (Negro/Black) and white school children from one school district to

another, the odds of having anyone in your family brought a friend who was a (Negro/Black) home for

dinner for those who would vote for Black President if he were qualified for the job estimated to be 3.

times the odds of having anyone in your family brought a friend who was a (Negro/Black) home for dinner

for those who would not vote for Black for President if he were qualified for the job.

STA

Dr. Niu: HW

b)

Criteria For Assessing Goodness Of Fit

Criterion DF Value Value/DF

Deviance 8 14.8625 1.

Scaled Deviance 8 14.8625 1.

Pearson Chi-Square 8 36.3768 4.

Scaled Pearson X2 8 36.3768 4.

Log Likelihood 1343.

G^2 =14.8625 so

with df=

p-value = 0.0618749 > 0.05, thus model fits data well.

c)

Criteria For Assessing Goodness Of Fit

Criterion DF Value Value/DF

Deviance 12 24.3305 2.

Scaled Deviance 12 24.3305 2.

Pearson Chi-Square 12 24.3278 2.

Scaled Pearson X2 12 24.3278 2.

Log Likelihood 1338.

The test statistics is G^2 [(BD,DP)|(BD,BP,DP)] = 24.3305-14.86 = 9.

G^2 =9.47 so

with df=13-9=

p-value = 0.0504089 > 0.05. So there is not strong evidence that the BP conditional association.

CODE

data prob8_2; input P B D count; datalines; 1 1 1 41 1 1 2 65 1 1 3 0 1 2 1 71 1 2 2 157 1 2 3 1 1 3 1 1 1 3 2 17 1 3 3 0 2 1 1 2 2 1 2 5 2 1 3 0

STA

Dr. Niu: HW

a)

Injury has estimated conditional odds ratios .58 with gender, 2.13 with location, and 0.44 with seat-belt use.

“No” is category 1 of I, and “female” is category 1 of G, so the odds of no injury for females are estimated

to be 0.58 times the odds of no injury for males (controlling for L and S); that is, females are more likely to

be injured.

Similarly, the odds of no injury for urban location are estimated to be 2.13 times the odds for rural location,

so injury is more likely at a rural location, and the odds of no injury for no seatbelt use are estimated to be

0.44 times the odds for seat belt use, so injury is more likely for no seat belt use, other things being fixed.

Since there is no interaction for this model, overall the most likely case for injury is therefore females not

wearing seat belts in rural locations.

b)

Females in urban areas, the odds ratio is

Since there is a GLS three-way interaction, the LS conditional odds ratio can differ between males and

females. For females, we can use either the injury or the non-injury predicted values.

Using the non-injury values, the LS conditional odds ratio is

Using non-injury values for males, the LS conditional odds ratio is

Conditional odds ratios could be computed directly from model parameter estimates.

The estimated conditional IS odds ratio is simply the exponential of the parameter estimate for the IS term

e ^0.^814  0. 44

The estimated conditional LS odds ratio in females is the exponential of the parameter estimate for the LS term:

e^0.^1570  1. 17

In males, we must also add the GLS parameter estimate

e^0.^1570 ^0.^127  1. 03

STA

Dr. Niu: HW

 ij | k  i | k  j | k X, Y conditional independent

 i  k  i  k X, Z marginally independent

a) Show that X is jointly independent of Y and Z

Show ^ ijk  jk  i 

 (^)  jk  i  i | k  j | k  k k k jk k i k       

k jk i jk k i      

b) Show that X, Y are marginally independent

Show ^ ij   i  j 

        i  j 

k k i jk i jk k ij ijk

(From part a)

c) Show that X and Z are conditional (rather than marginally) independent, then X and Y are still marginally

independent.

ik | j  i | j  k | j  (^) ij   i  j

STA

Dr. Niu: HW

a)

Since A and S are explanatory variables, the  AS term should be included in the model

b)

Likelihood Ratio DF G^2 Pr > ChiSq AIC= G^2 - 2(DF)

Model (AGIS): Loglinear 0 M M M

Model (AGI,AIS,AGS,GIS): Loglinear 1 0.36 0.5499 -0.

Model (AG,AI,AS,GI,GS,IS): Loglinear 5 1.72 0.8862 -8.

Model (AS,G,I): Loglinear 10 360.16 <0.0001 340.

Based on the SAS output, AIC= G^2 - 2(DF) is smallest for Model (AG,AI,AS,GI,GS,IS): Loglinear. This

model fits the data best.

Maximum Likelihood Analysis of Variance

Source DF Chi-Square Pr>ChiSq

A 1 74.37 <.

G 1 50.60 <.

A*G 1 2.97 0.

I 1 492.23 <.

A*I 1 6.62 0.

S 1 290.71 <.

A*S 1 17.27 <.

G*I 1 321.48 <.

S*G 1 0.10 0.

S*I 1 2.51 0.

Likelihood Ratio 5 1.72 0.

Highlighted cells are parameter estimates which are not significant. Removed terms to derive the following

model

Maximum Likelihood Analysis of Variance

Source DF Chi-Square Pr>ChiSq

A 1 78.50 <.

I 1 1145.14 <.

A*I 1 10.52 0.

S 1 2238.45 <.

A*S 1 16.70 <.

G 1 80.49 <.

G*I 1 326.34 <.

Likelihood Ratio 8 7.67 0.

Analysis of Maximum Likelihood Estimates

STA

Dr. Niu: HW

Parameter Estimate Standard Chi- Pr > ChiSq

Error Square

A <30 0.4181 0.0472 78.50 <.

I die -1.5860 0.0469 1145.14 <.

A*I <30 die -0.1372 0.0423 10.52 0.

S <5 1.1752 0.0248 2238.45 <.

A*S <30 <5 -0.1015 0.0248 16.70 <.

G <260 -0.4133 0.0461 80.49 <.

G*I <260 die 0.8321 0.0461 326.34 <.

The Likelihood Ratio indicates the model fits well in this case as well. Final model would be (Model

(AI,AS,GI): Loglinear)

STA

Dr. Niu: HW

Analysis of Maximum Likelihood Estimates

Parameter Estimate Standard Chi- Pr > ChiSq

Error Square

A <30 0.4065 0.0471 74.37 <.

S <5 1.0678 0.0626 290.59 <.

A*S <30 <5 -0.1030 0.0249 17.13 <.

G <260 -0.3910 0.0550 50.56 <.

I die -1.5136 0.0682 492.18 <.

G*I <260 die 0.8274 0.0462 321.35 <.

A*I <30 die -0.1160 0.0450 6.64 0.

S*I <5 die -0.1036 0.0654 2.51 0.

A*G <30 <260 -0.0418 0.0240 3.02 0.

S*G <5 <260 -0.0118 0.0373 0.10 0.

So (AS, GI, AI) is selected as final model

Started to fit the pairwise model based on the results from part a. Backward selection also starts from the

full pairwise model (AS GI AI SI AG SG)

Backward selection

Model DF G^2 Prob Model (AS+GI+AI+SI+AG): backward selection 6 1.82 0. Model (AS+GI+AI+SI+SG): backward selection 6 4.7 0. Model (AS+GI+AI+AG+SG): backward selection 6 4.05 0. Model (AS+GI+SI+AG+SG): backward selection 6 8.17 0. Model (AS+AI+SI+AG+SG): backward selection 6 339.33 <.

The G^2 values are all greater than the full model. Based on G^2 values the full model is preferred. Same as

forward selection, non-significant terms needed to be eliminated from the model. The final model would be

(AS GI AI). This is the same from the result of the forward selection.

STA

Dr. Niu: HW

CODE

clear; options linesize= 80 ; options pagesize= 60 ; options missing='M'; title='Homework 9.2'; data prob9_2; input A $ S $ G $ I $ count; datalines; <30 <5 <260 die 50 <30 <5 <260 live 315 <30 <5 >260 die 24 <30 <5 >260 live 4012 <30 >5 <260 die 9 <30 >5 <260 live 40 <30 >5 >260 die 6 <30 >5 >260 live 459

30 <5 <260 die 41 30 <5 <260 live 147 30 <5 >260 die 14 30 <5 >260 live 1594 30 >5 <260 die 4 30 >5 <260 live 11 30 >5 >260 die 1 30 >5 >260 live 124 ; ods html body="STA5168-hw5-prob9.2.xls"; /part a / /AGIS/ proc catmod data=prob9_2; weight count; model ASGI=response/noiter noresponse nodesign; loglin A|S|G|I; title2 'Model (AGIS): Loglinear'; run ; /AGI,AIS,AGS,GIS/ proc catmod data=prob9_2; weight count; model ASGI=response/noiter noresponse nodesign; loglin A|G|I A|I|S A|G|S G|I|S; title2 'Model (AGI,AIS,AGS,GIS): Loglinear'; run ; /AG,AI,AS,GI,GS,IS/ proc catmod data=prob9_2; weight count; model ASGI=response/noiter noresponse nodesign; loglin A|G A|I A|S G|I G|S I|S; title2 'Model (AG,AI,AS,GI,GS,IS): Loglinear'; run ; /rerun model/ /AS,G,I/ proc catmod data=prob9_2; weight count; model ASGI=response/noiter noresponse nodesign; loglin A|S G I; title2 'Model (AS,G,I): Loglinear'; run ;

STA

Dr. Niu: HW

model ASGI=response/noiter noresponse nodesign; loglin A|S G|I A|I; title2 'Model (AS+GI+AI): forward selection'; run ; /AS+GI+SG/ proc catmod data=prob9_2; weight count; model ASGI=response/noiter noresponse nodesign; loglin A|S G|I S|G; title2 'Model (AS+GI+SG): forward selection'; run ; /AS+GI+SI/ proc catmod data=prob9_2; weight count; model ASGI=response/noiter noresponse nodesign; loglin A|S G|I S|I; title2 'Model (AS+GI+SI): forward selection'; run ; /AS+GI+AI+AG/ proc catmod data=prob9_2; weight count; model ASGI=response/noiter noresponse nodesign; loglin A|S G|I A|I A|G; title2 'Model (AS+GI+AI+AG): forward selection'; run ; /AS+GI+AI+SI/ proc catmod data=prob9_2; weight count; model ASGI=response/noiter noresponse nodesign; loglin A|S G|I A|I S|I; title2 'Model (AS+GI+AI+SI): forward selection'; run ; /AS+GI+AI+SI+AG/ proc catmod data=prob9_2; weight count; model ASGI=response/noiter noresponse nodesign; loglin A|S G|I A|I S|I A|G; title2 'Model (AS+GI+AI+SI+AG): forward selection'; run ; /AS+GI+AI+SI+SG/ proc catmod data=prob9_2; weight count; model ASGI=response/noiter noresponse nodesign; loglin A|S G|I A|I S|I S|G; title2 'Model (AS+GI+AI+SI+SG): forward selection'; run ; /AS+GI+AI+SI+AG+SG/ proc catmod data=prob9_2; weight count; model ASGI=response/noiter noresponse nodesign; loglin A|S G|I A|I S|I A|G S|G; title2 'Model (AS+GI+AI+SI+AG+SG): forward selection';

STA

Dr. Niu: HW

run ; /AS+GI+AI+SI+AG/ proc catmod data=prob9_2; weight count; model ASGI=response/noiter noresponse nodesign; loglin A|S G|I A|I S|I A|G; title2 'Model (AS+GI+AI+SI+AG): backward selection'; run ; /AS+GI+AI+SI+SG/ proc catmod data=prob9_2; weight count; model ASGI=response/noiter noresponse nodesign; loglin A|S G|I A|I S|I S|G; title2 'Model (AS+GI+AI+SI+SG): backward selection'; run ; /AS+GI+AI+AG+SG/ proc catmod data=prob9_2; weight count; model ASGI=response/noiter noresponse nodesign; loglin A|S G|I A|I A|G S|G; title2 'Model (AS+GI+AI+AG+SG): backward selection'; run ; /AS+GI+SI+AG+SG/ proc catmod data=prob9_2; weight count; model ASGI=response/noiter noresponse nodesign; loglin A|S G|I S|I A|G S|G; title2 'Model (AS+GI+SI+AG+SG): backward selection'; run ; /AS+AI+SI+AG+SG/ proc catmod data=prob9_2; weight count; model ASG*I=response/noiter noresponse nodesign; loglin A|S A|I S|I A|G S|G; title2 'Model (AS+AI+SI+AG+SG): backward selection'; run ; ODS HTML Close; ODS Listing;

STA

Dr. Niu: HW

c)

From part a, the ratio of death rate decrease as age increase, so there may be interaction between the ratio

and age.

Criteria For Assessing Goodness Of Fit

Criterion DF Value Value/DF

Deviance 3 1.5464 0.

Scaled Deviance 3 1.5464 0.

Pearson Chi-Square 3 1.4388 0.

Scaled Pearson X2 3 1.4388 0.

Log Likelihood 2727.

Analysis Of Parameter Estimates

Parameter DF Estimate Standard

Error

Wald 95% Confidence

Limits

Chi-Square Pr > ChiSq

Intercept 1 -0.866 0.9468 -2.7217 0.9898 0.84 0.

age 35-44 1 -5.9659 0.7465 -7.429 -4.5029 63.88 <.

age 45-54 1 -3.9226 0.5526 -5.0058 -2.8395 50.38 <.

age 55-64 1 -2.2001 0.3686 -2.9226 -1.4776 35.62 <.

age 64-74 1 -0.8977 0.2021 -1.2938 -0.5016 19.74 <.

age 75-84 0 0 0 0 0 M M

smoke Nonsmoke 1 -1.445 0.3729 -2.1758 -0.7141 15.02 0.

smoke Smokers 0 0 0 0 0 M M

score 1 -0.3087 0.0973 -0.4994 -0.1181 10.08 0.

Scale 0 1 0 1 1

LR Statistics For Type 3 Analysis

Source DF Chi-Square Pr > ChiSq

age 4 133.18 <.

smoke 1 17.29 <.

score 1 10.59 0.

For age scores (1,2,3,4,5), G^2 = 1.5464, df = 3. The interaction term = -.3087, with std. error = .0973; the

estimated ratio of rates is multiplied by e ^0.^387 = 0.7344 for each successive increase of one age category,

then the log ratio of coronary death rates changes linearly with age.

Smokers have a higher death rate than non-smokers but the difference gets less with age (and actually seems

to reverse at the highest age group. This could be that all but the most coronary resistant smokers have died

off by the time they get to 80 years of age.

STA

Dr. Niu: HW

CODE

clear; options linesize= 80 ; options pagesize= 60 ; options missing='M'; title 'Homework 9.21'; data prob9_21; input age $ smoke $ death person u v; score=u*v; rate=death/person; logpeep=log(person); datalines; 35-44 Nonsmokers 2 18793 1 1 35-44 Smokers 32 52407 1 2 45-54 Nonsmokers 12 10673 2 1 45-54 Smokers 104 43248 2 2 55-64 Nonsmokers 28 5710 3 1 55-64 Smokers 206 28612 3 2 64-74 Nonsmokers 28 2585 4 1 64-74 Smokers 186 12663 4 2 75-84 Nonsmokers 31 1462 5 1 75-84 Smokers 102 5317 5 2 ; ods html body="STA5168-hw5-prob9.21.xls"; proc genmod data=prob9_21; class age smoke; model death = age smoke/dist=poi link=log type3 offset=logpeep; title2 'Each Age and Smoking'; run ; proc genmod data=prob9_21; class age smoke; model death = age smoke score/dist=poi link=log type3 offset=logpeep; title2 'Log Ratio of Coronary daeth rates changes linearly with age'; run ; ODS HTML Close; ODS Listing;