Twoway classification - PowerPoint PPT Presentation

1 / 36
About This Presentation
Title:

Twoway classification

Description:

Example: Tiger beetles. 2. 55.7. n = 671. 297. 374. Totals. 72.5 ... ESUM BR 8 2.811516 21.7377 3.459946 -13.7377. ESUM NBR 31 5.437629 17.2623 2.784941 13.7377 ... – PowerPoint PPT presentation

Number of Views:58
Avg rating:3.0/5.0
Slides: 37
Provided by: GnaC6
Category:

less

Transcript and Presenter's Notes

Title: Twoway classification


1
Two-way classification
Example Tiger beetles
Two color morphs BR Bright red NBR Not
bright red
Four seasons ESpring Early spring LSpring
Late spring ESum Early summer LSum Late summer
2
Observed distribution of color morphs
H0 The distribution of color morphs is
independent of season
H1 The distribution of color morphs is not
independent of season
a 0.05
Test ?2-test, G-test or logistic regression
3
G-test
Predicted distribution of color morphs assuming
independence between factors
4
The log-linear model
5
The saturated model
6
The saturated model
7
  • The saturated model has as many parameters as
    there are cells in the table.
  • The saturated model perfectly fits the observed
    data.
  • Consequently, its log likelihood function is 0

8
The reduced model
9
G -2(ln Lsaturated ln Lreduced) 2 ln
Lreduced 28.596
with 3 df
P lt 0.0001
Conclusion color morphs do not occur
independently of season
10
How to do it with SAS
11
/ Example from Sokal and Rohlf 1995 p
738/ /Log linear model/ Title
'Cicindila' data LOGLIN infile
'H\Forsøgsplanlægning\2005\Log linear
models\two-way table.prn' firstobs 2 input
Season Color Obs proc catmod weight
Obs model SeasonColor_response_ /
noresponse predfreq prob / the noresponse
option is used because log linear models do not
distinguish between response and non-response
variables / loglin Season Color /
SeasonColor is omitted from the saturated model
/ run
12
Maximum Likelihood Analysis of
Variance
Source DF Chi-Square Pr gt
ChiSq
________________________________________________
_____ Season
3 499.18 lt.0001
Color 1
8.80 0.0030

Likelihood
Ratio 3 28.60 lt.0001



Analysis of Maximum Likelihood Estimates

Standard Chi-
Effect
Parameter Estimate Error Square
Pr gt ChiSq
__________________________________________________
__________ Season
1 -0.8972 0.1276 49.42
lt.0001
2 -0.9225 0.1289 51.24
lt.0001
3 1.5538 0.0698 496.19
lt.0001 Color 4
0.1153 0.0389 8.80 0.0030

13
Maximum Likelihood Predicted Values for
Frequencies


-------Observed------
------Predicted------

Standard Standard
Season Color Frequency
Error Frequency Error Residual
____________________________________
_________________________ ESPRING
BR 29 5.267509 22.29508
3.50348 6.704918 ESPRING NBR
11 3.289327 17.70492
2.820956 -6.70492 ESUM
BR 8 2.811516 21.7377
3.459946 -13.7377 ESUM
NBR 31 5.437629 17.2623
2.784941 13.7377 LSPRING BR
273 12.72511 258.623
11.11879 14.37705 LSPRING NBR
191 11.68896 205.377
10.35382 -14.377 LSUM
BR 64 7.608921 71.34426
6.180843 -7.34426 LSUM
NBR 64 7.608921 56.65574
5.129978 7.344262
14
Since the response variable (color morphs) has
two levels, an alternative to log-linear analysis
is logistic regression
15
SAS program
Title 'Cicindela' data Logistic infile
'H\Forsøgsplanlægning\2005\Log linear
models\two-way table logistic).prn' firstobs
2 input Season BR NBR Total BRNBR /
Total is sum of Bright red and non-bright red
individuals / proc genmod class season model
BR/Total Season / link logit dist binomial
type3 obstats run
16
Criteria For Assessing Goodness Of Fit
Criterion DF
Value Value/DF
Deviance 0
0.0000 . Scaled
Deviance 0 0.0000
. Pearson Chi-Square 0
0.0000 .
Scaled Pearson X2 0 0.0000
. Log Likelihood
-446.3758 Algorithm
converged.
Analysis Of Parameter Estimates
Standard Wald 95
Confidence Chi- Parameter
DF Estimate Error Limits
Square Pr gt ChiSq Intercept
1 0.0000 0.1768 -0.3465
0.3465 0.00 1.0000 Season
ESPRING 1 0.9694 0.3958 0.1937
1.7451 6.00 0.0143 Season ESUM
1 -1.3545 0.4342 -2.2055
-0.5036 9.73 0.0018 Season
LSPRING 1 0.3572 0.2004 -0.0355
0.7499 3.18 0.0746 Season LSUM
0 0.0000 0.0000 0.0000
0.0000 . . Scale
0 1.0000 0.0000 1.0000
1.0000 NOTE The scale parameter was held
fixed. LR Statistics For Type 3 Analysis
Chi-
Source DF Square Pr
gt ChiSq Season 3
28.60 lt.0001

17
Three-way classification
Example Carcasses of wildebeests (gnus)
Two mortality causes P Predation NP
Non-predation
Two sexes F Female M Male
Three marrow types SWF Solid White Fat OG
Opaque Gelatinous TG Translucent Gelatineous
18
Observed distribution of carcasses
19
The saturated log-linear model
20
(No Transcript)
21
/ Example from Quinn and Keough p 395/ /Data
from Sinclair and Arcese 1995/ /Log linear
model/ Title 'Data from Sinclair and Arcese
1995' data LOGLIN infile 'H\Forsøgsplanlægning\
2005\Log linear models\Sinclair data.prn'
firstobs 2 input Death Sex Marrow
Obs / Death mortality factor (P predation,
NP non-predation) / / Sex (M male, F
female) / Marrow Marrow type (SWF solid
white fatty, OG opaque gelatinous or TG
translucent gelatinous / proc catmod weight
Obs model DeathSexMarrow_response_ /
noresponse predfreq prob loglin Death Sex
Marrow DeathSex DeathMarrow SexMarrow
title2 'Model with no three-way
interactions' run
22
No three-way interaction terms
Maximum Likelihood Analysis of Variance Source
DF Chi-Square Pr gt
ChiSq ____________________________________________
______ Death 1 4.22
0.0400 Sex 1
0.11 0.7439 Marrow 2
28.38 lt.0001 DeathSex
1 1.26 0.2610 DeathMarrow 2
27.44 lt.0001 SexMarrow 2
5.79 0.0554 Likelihood Ratio
2 7.19 0.0275
H0 The model fits the data (i.e. deviation is
due to random noise)
A low P-value indicates a poor fit
Goodness-of-fit test
23
Maximum Likelihood Predicted
Values for Frequencies
-------Observed------ ------Predicted------

Standard Standard Death Sex
Marrow Frequency Error Frequency Error
residual ________________________________________
_______________ NP F OG
26 4.796754 21.59476 4.08837
4.40524 NP F SWF 6
2.416756 8.614391 2.546923 -2.61439 NP
F TG 16 3.855808
17.79085 3.771567 -1.79085 NP M
OG 12 3.370880 16.40524
3.52073 -4.40524 NP M SWF 7
2.604455 4.385611 1.581861
2.61439 NP M TG 26
4.796754 24.20915 4.410191 1.79085 P
F OG 32 5.241090
36.40524 5.265174 -4.40524 P F
SWF 26 4.796754 23.38561
4.378406 2.61439 P F TG
8 2.777915 6.209150 1.967663
1.79085 P M OG 43
5.900727 38.59476 5.402358 4.40524 P
M SWF 14 3.623913 16.61439
3.687038 -2.61439 P M TG
10 3.091524 11.79085 3.001563
-1.79085
24
(No Transcript)
25
(No Transcript)
26
(No Transcript)
27
The reduced model
is found to be the best one
Conclusion Marrow type affects predation
risk, but differently for males and females
28
What marrow type has the highest predation risk
given an individual is a female?
29
Odds for a female with SWF marrow being predated
is
Odds for a female with OG marrow being predated is
Odds for a female with TG marrow being predated is
30
To compare the risk of predation of SWF females
with OG females we use the odds ratio
31
Odds ratio for females with SWF versus OG marrow
32
Odds ratio for males with SWF versus OG marrow
33
Asymptotic confidence limits for an odds ratio
For instance, if a 0.05, then za 1.96
34
Confidence limits for the odds ratio for
predation of females with SWF marrow versus OG
marrow
35
Confidence limits for females
SWF vs OG
Conclusion Females with SWF marrow have a
significantly higher risk of predation than
females with OG or TG marrow, whereas there is no
difference between females with OG and TG marrow
36
Confidence limits for males
SWF vs OG
Conclusion Males with TG marrow have a
significantly lower risk of predation than males
with SWF and OG marrow, whereas there is no
difference between males with SWF and OG marrow
Write a Comment
User Comments (0)
About PowerShow.com