Log Linear Model. . Web Page: 2. (estimating parameter) ก (main effect) interaction effect

Like dokumenter
Notasjoner, gjennomsnitt og kvadratsummer. Enveis ANOVA, modell. Flere enn to grupper. Enveis variansanalyse (One-way ANOVA, fixed effects model)

SOS3003 Anvendt statistisk dataanalyse i samfunnsvitenskap Forelesingsnotat 07. Erling Berge Institutt for sosiologi og statsvitenskap NTNU

Eksamensoppgave i SOS3003 Anvendt statistisk dataanalyse i samfunnsvitenskap

SOS 301 og SOS31/ SOS311 MULTIVARIAT ANALYSE

Kapittel 7; Appendix til rapport i prosjekt Tap av Laksefisk i Sjø; «TALFS»

Kap 15: Spørreundersøkelser

Eksamensoppgave i PSY3100 Forskningsmetode - Kvantitativ

SKOLEEKSAMEN I SOS KVANTITATIV METODE. 27. februar 2017 (4 timer)

Eksamensoppgave i SOS3003 Anvendt statistisk dataanalyse i samfunnsvitenskap

Regresjonsmodeller. HEL 8020 Analyse av registerdata i forskning. Tom Wilsgaard

Forelesning 7 STK3100/4100

UTSATT SKOLEEKSAMEN I SOS KVANTITATIV METODE. 29. Mars 2017 (4 timer)

Medisinsk statistikk, del II, vår 2008 KLMED Lineær regresjon, Rosner Regresjon?

Medisinsk statistikk, del II, vår 2009 KLMED 8005

Eksamensoppgave i SOS3003 Anvendt statistisk dataanalyse i samfunnsvitenskap Examination paper for SOS3003 Applied Social Statistics

Forelesning 9 STK3100/4100

Anvendt medisinsk statistikk, vår Repeterte målinger, del II

UNIVERSITETET I OSLO

7. november 2011 Geir Storvik

EKSAMENSOPPGAVE. «Tabeller og formler i statistikk» av Kvaløy og Tjelmeland. To A4-ark (4 sider) med egne notater. Godkjent kalkulator.

Forelesning 8 STK3100/4100

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

Forelesning 7 STK3100/4100

ECON240 VÅR / 2016 BOKMÅL

Forelesning 6 STK3100

Eksamensoppgave i SOS3003 Anvendt statistisk dataanalyse i samfunnsvitenskap

Eksamensoppgave i PSY3100 Forskningsmetode - Kvantitativ

Logistisk regresjon 1

Løsningsforsalg til andre sett med obligatoriske oppgaver i STK1110 høsten 2015

STK juni 2016

Generaliserte Lineære Modeller

Generelle lineære modeller i praksis

UNIVERSITETET I OSLO

Bakgrunn. KLMED 8006 Anvendt medisinsk statistikk - Vår 2008 Repeterte målinger. Overvekt: løp for livet

EKSAMEN I TMA4255 ANVENDT STATISTIKK

EXAMINATION PAPER. Exam in: STA-3300 Applied statistics 2 Date: Wednesday, November 25th 2015 Time: Kl 09:00 13:00 Place: Teorifagb.

Forelesning 9 STK3100/4100

KLMED 8006 Anvendt medisinsk statistikk - Vår 2009 Repeterte målinger

Generaliserte Lineære Modeller

EKSAMENSOPPGAVE. B154 «Tabeller og formler i statistikk» av Kvaløy og Tjelmeland. To A4-ark (4 sider) med egne notater. Godkjent kalkulator.

Passasjerer med psykiske lidelser Hvem kan fly? Grunnprinsipper ved behandling av flyfobi

Løsningsforslag STK1110-h11: Andre obligatoriske oppgave.

Eksamensoppgave i PSY3100 Forskningsmetode - Kvantitativ

ST0202 Statistikk for samfunnsvitere Kapittel 11: Anvendelser av kjikvadratfordelingen Kapittel 12: Variansanalyse (ANOVA)

STK1000 Innføring i anvendt statistikk Eksamensdag: Tirsdag 12. desember 2017

Sensorveiledning til eksamensoppgave i SOS3003 Anvendt statistisk dataanalyse i samfunnsvitenskap

Graphs similar to strongly regular graphs

EKSAMEN I FAG TMA4315 GENERALISERTE LINEÆRE MODELLER Torsdag 14. desember 2006 Tid: 09:0013:00

Introduksjon til Generaliserte Lineære Modeller (GLM) og blandede modeller

Forelesning 11 STK3100/4100

Eksamensoppgave i TMA4267 Lineære statistiske modeller

Universitetet i Bergen Det matematisk-naturvitenskapelige fakultet Eksamen i emnet Mat131 - Differensiallikningar I Onsdag 25. mai 2016, kl.

Eksamensoppgave i TMA4275 Levetidsanalyse

Qi-Wu-Zhang model. 2D Chern insulator. León Martin. 19. November 2015

SOS3003 Anvendt statistisk dataanalyse i samfunnsvitenskap Forelesingsnotat 11. Erling Berge Institutt for sosiologi og statsvitenskap NTNU

Note: Please use the actual date you accessed this material in your citation.

Kategoriske data, del I: Kategoriske data - del 2 (Rosner, ) Kategoriske data, del II: 2x2 tabell, parede data (Mc Nemar s test)

Fra boka: 10.32, 10.33, 10.34, 10.35, 10.3 og (alle er basert på samme datasett).

EKSAMEN I TMA4315 GENERALISERTE LINEÆRE MODELLAR

X ijk = µ+α i +β j +γ ij +ǫ ijk ; k = 1,2; j = 1,2,3; i = 1,2,3; i=1 γ ij = 3. i=1 α i = 3. j=1 β j = 3. j=1 γ ij = 0.

UNIVERSITETET I OSLO

EKSAMEN I TMA4315 GENERALISERTE LINEÆRE MODELLER

MA2501 Numeriske metoder

Forelesning 5 STK3100/4100

Eksamen i: STA-1002 Statistikk og sannsynlighet 2 Dato: Fredag 31. mai 2013 Tid: Kl 09:00 13:00 Sted: Administrasjonsbygget

UNIVERSITETET I OSLO

Eksamensoppgave i ST2304 Statistisk modellering for biologer og bioteknologer

Forelesning 6 STK3100/4100

ST0202 Statistikk for samfunnsvitere Kapittel 13: Lineær regresjon og korrelasjon

!" # $ %& &'!"#$%&'! "# $ %!$ &' "# (%! "#!"#$%&' $!() *+,-. / '789:,; $, /0 FGHIJKL PQR S>TU$ /0VW,XY Y Z[\ ]^UN_$!(`YVWabc

Bioberegninger, ST1301 Onsdag 1. juni 2005 Løsningsforslag

ST1201 Statistiske metoder

UNIVERSITETET I OSLO

Eksamensoppgave i TMA4267 Lineære statistiske modeller

Logistisk regresjon 2

Prøveeksamen i STK3100/4100 høsten 2011.

Emnenavn: Eksamenstid: Faglærer: Bjørnar Karlsen Kivedal

Bioberegninger, ST november 2006 Kl. 913 Hjelpemidler: Alle trykte og skrevne hjelpemidler, lommeregner.

MASTER I IDRETTSVITENSKAP 2018/2020. Individuell skriftlig eksamen. STA 400- Statistikk. Mandag 18. mars 2019 kl

Beholdningsestimering ved slakting av store laksemerder - Exactusprosjektet

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

UNIVERSITETET I OSLO

Eksamensoppgave i PSY3100 Forskningsmetode - Kvantitativ

Forelesning 10 STK3100

Sammenlikninger av gjennomsnitt. SOS1120 Kvantitativ metode. Kan besvare to spørsmål: Sammenlikning av to gjennomsnitt

Oppgave 2. Benytt informasjonen i vedlagte Tabell 1 og 2 (Appendix) og besvar følgende:

Lineære modeller i praksis

(a) For regresjon brukes vanligvis kvadratisk tap: L(y, ŷ) = (y ŷ) 2. Den optimale prediktor basert på input variable x er da Ŷ = E[Y x].

UNIVERSITETET I OSLO

A Nonparametric Test of Serial Independence for Time Series and Residuals

EKSAMENSOPPGAVE I SØK1004 STATISTIKK FOR ØKONOMER STATISTICS FOR ECONOMISTS

Eksponensielle klasser

! " # $ % & ^Pv`!$ x âîv7ç È'Ç È b j k Æ' z{3 b jkæ b ÇÈÉÊ&( )! c q r É. xy+ - Êlm l D E ` &! D E â î #" ' #$ '#! v( D/Ev A B x y&?

Forelesning 13 Analyser av gjennomsnittsverdier. Er inntektsfordelingen for kvinner og menn i EU-undersøkelsen lik?

Solutions #12 ( M. y 3 + cos(x) ) dx + ( sin(y) + z 2) dy + xdz = 3π 4. The surface M is parametrized by σ : [0, 1] [0, 2π] R 3 with.

Du skal besvare åtte av de ti spørsmålene som er gitt nedenfor. a) Gi en kort beskrivelse av konjunkturutviklingen i Norge det siste året.

UNIVERSITETET I OSLO

TMA4245 Statistikk Eksamen 9. desember 2013

Testobservator for kjikvadrattester

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

Transkript:

Log Lnear Model. ก ก Emal: nkom@kku.ac.th Web Page: http://home.kku.ac.th/nkom. ก (fttng models) ก 2. (estmatng parameter) ก ก ก (man effect) nteracton effect

Log Lnear Model dfference from logt model -do not dstngush between response varable (dependent) and explanatory varable (ndependent) -relaton among ndependent varable Ex. ก ก ก (Log Lnear Model) Log lnear model for 2-way table ( 2) ( ) 2 n n2 n. 2 n2 n22 n2. n. n.2 n 2

Independent model x y ln( µ ) = λ+ λ + λ j ก ก ก ก Fatal Non Fatal () () () 6 62527 () 5 42368 ln( belt µ ) λ+ λ + = λ nj j (Saturated Model) -Log Lnear Model ก ก (man effect) (nteracton effect) ln( x y µ ) λ+ λ + λ j + = λ xy 3

ln( x y µ ) λ+ λ + λ j + = λ xy u = = ntercept = ก λ j = ก 2 = λ x λ y xy λ ก ก Log Lnear model x y xy ln( µ ) = λ+ λ + λ + λ () x y xy 2 ln( µ ) = λ+ λ + λ2 + λ2 (2) 2 x y xy 3 ln( µ ) = λ+ λ2+ λ + λ2 2 (3) x y xy 4 ln( µ ) = λ+ λ2+ λ2 + λ22 (4) 22 4

ก x y xy ก λ, λ, λj, λ ก ก ก ()-(4) ก x y xy xy xy λ2 =, λ2 =, λ2 =, λ2=, λ22 = ก ก x y xy ln( µ ) = λ+ λ (5) + λ + λ x 2 ln( µ ) = λ+ λ 2 (6) y 3 ln( µ ) = λ+ λ (7) 2 4 ln( µ ) =λ (8) 22 x y xy กก ก ก (5)-(8) λ, λ, λ, λ j λ= log( µ 22 ) µ x λ = = 2 ln( µ ) ln( µ ) ln 2 22 µ 22 µ x λ = = 2 ln( µ ) ln( µ ) ln 2 22 µ 22 λ xy µ µ = ln( µ ) ln( µ ) - (ln( µ ) ln( µ ) = ln 22 2 2 22 µ µ 2 2 5

ก ก ก ก Fatal Non Fatal () () () 6 62527 () 5 42368 x y xy ก λ, λ, λj, λ λ = ln(42368) = 2.9297 x 62527 λ = ln(62527) ln(42368) = ln = 42368 y 5 λ = ln(5) ln(42368) = ln = 42568 λ xy = ln(6) ln(62527)- (ln(5) ln(42368)) (6)(42368) = ln = 2.75 (62527)(5).93 6.6953 ก ก Fatal () Non Fatal () () 6 62527 () 5 42368 6

. gen bj=b*j. posson freq b j bj Iteraton : log lkelhood = -23529.833 Iteraton : log lkelhood = -235.35 Iteraton 2: log lkelhood = -53.7572 Iteraton 3: log lkelhood = -24.675529 Iteraton 4: log lkelhood = -22.947737 Iteraton 5: log lkelhood = -22.94653 Iteraton 6: log lkelhood = -22.94653 Posson regresson Number of obs = 4 LR ch2(3) = 884872.49 Prob > ch2 =. Log lkelhood = -22.94653 Pseudo R2 =.9999 freq Coef. Std. Err. z P> z [95% Conf. Interval] b -.9372.29288-37.9. -.936823 -.925337 j -6.69526.4438-5.. -6.7823-6.6849 bj 2.7545.593 4.74..975222 2.74868 _cons 2.92967.5572 832.9. 2.92662 2.93272. glm freq b j bj, f(po) l(log) ef Iteraton : log lkelhood = -47246.359 Iteraton : log lkelhood = -557.445 Iteraton 2: log lkelhood = -527.6439 Iteraton 3: log lkelhood = -4.9677 Iteraton 4: log lkelhood = -22.98676 Iteraton 5: log lkelhood = -22.94653 Iteraton 6: log lkelhood = -22.94653 Generalzed lnear models No. of obs = 4 Optmzaton : ML Resdual df = Scale parameter = Devance =.44e- (/df) Devance =. Pearson = 5.49837e-24 (/df) Pearson =. Varance functon: V(u) = u Lnk functon : g(u) = ln(u) [Posson] [Log] AIC = 3.47325 Log lkelhood = -22.9465294 BIC =.44e- OIM freq IRR Std. Err. z P> z [95% Conf. Interval] b.3943.543-37.9..39875.3963999 j.2368.548-5...339.349 bj 7.96495.4566 4.74. 7.2822 8.824 7

. logln count qbelt njury,ft( qbelt, njury, qbelt njury) Varable qbelt = A Varable njury = B Margns ft: qbelt, njury, qbelt njury Note: Regresson-lke constrants are assumed. The frst level of each varable (and all teractons wth t) wll be dropped from estmaton. Iteraton : log lkelhood = -23529.833 Iteraton : log lkelhood = -235.35 Iteraton 2: log lkelhood = -53.7572 Iteraton 3: log lkelhood = -24.675529 Iteraton 4: log lkelhood = -22.947737 Iteraton 5: log lkelhood = -22.94653 Iteraton 6: log lkelhood = -22.94653 Posson regresson Number of obs = 4 LR ch2(3) = 884872.49 Prob > ch2 =. Log lkelhood = -22.94653 Pseudo R2 =.9999 ---------------------------------------------------------------------------- count Coef. Std. Err. z P> z [95% Conf. Interval] A2 -.9372.29288-37.9. -.936823 -.925337 AB22 2.7545.593 4.74..975222 2.74868 B2-6.69526.4438-5.. -6.7823-6.6849 _cons 2.92967.5572 832.9. 2.92662 2.93272 ก ก selt belt ก ก. posson freq b j bj,rr Iteraton : log lkelhood = -23529.833 Iteraton : log lkelhood = -235.35 Iteraton 2: log lkelhood = -53.7572 Iteraton 3: log lkelhood = -24.675529 Iteraton 4: log lkelhood = -22.947737 Iteraton 5: log lkelhood = -22.94653 Iteraton 6: log lkelhood = -22.94653 Posson regresson Number of obs = 4 LR ch2(3) = 884872.49 Prob > ch2 =. Log lkelhood = -22.94653 Pseudo R2 =.9999 freq IRR Std. Err. z P> z [95% Conf. Interval] b.3943.543-37.9..39875.3963999 j.2368.548-5...339.349 bj 7.96497.4566 4.74. 7.28222 8.826 xy λ. lst +---------------------+ b j freq bj ---------------------. 6 2. 62527 3. 5 4. 42368 +---------------------+. d (6*42368)/(62527*5) 7.964949 8

ก ก odds rato. posson freq b j bj,rr Iteraton : log lkelhood = -23529.833 Iteraton : log lkelhood = -235.35 Iteraton 2: log lkelhood = -53.7572 Iteraton 3: log lkelhood = -24.675529 Iteraton 4: log lkelhood = -22.947737 Iteraton 5: log lkelhood = -22.94653 Iteraton 6: log lkelhood = -22.94653 Posson regresson Number of obs = 4 LR ch2(3) = 884872.49 Prob > ch2 =. Log lkelhood = -22.94653 Pseudo R2 =.9999 freq IRR Std. Err. z P> z [95% Conf. Interval] b.3943.543-37.9..39875.3963999 j.2368.548-5...339.349 bj 7.96497.4566 4.74. 7.28222 8.826 ก ก ก Selt Belt ก 7.96 7.2-8.8 Log lnear model for 3-way tables ก (cgarette) ก (alcohol) ก (maruana) ------------------------------------------ m a and c ----------+------------------------------- 279(279.668) 2(.3837) 43(42.3837) 3(3.6683) ----------+------------------------------- 456(455.3832) 44(44.6683) 538(538.668) 9(3.3832) ------------------------------------------ ln a c m ac am cm acm ( µ ) = λ+ λ + λ + λ + λ + λk + λ + λ j k jk k 9

Log lnear model for 3-way tables -Homogeneous assocaton model All Parwse Assocaton Present-No ndependent xyz ( = ) λ k ln x y z xy xz yz ( µ ) = λ+ λ + λ + λ + λ + λk + λ -Condtonal ndependence model x y z xz yz ( µ ) = λ+ λ + λ + λ + λk + λ j k jk λ xy = xyz λ ln j k jk k x y z xy yz ln( µ ) = λ+ λ + λ + λ + λ + λ λ xz j k jk k λk x y z xy xz ln( µ ) = λ+ λ + λ + λ + λ + λ j k k λ yz jk λk = xyz = xyz = = = -jont ndependent (Partal Independence Model ) xy λ xz = λ = λ k k x y z xy ln( µ ) = λ+ λ + λ + λ + λ j k x y z xz ln( µ ) = λ+ λ + λ + λ + λ j k k x y z yz ln( µ ) = λ+ λ + λ + λ + λ j k jk xy xz xz xyz λ, λ = λ = λ = -Complete Independence Model k k k xyz = ln x y z ( µ ) = λ+ λ + λ + λ j k

Model df. symbol Homogeneous assocaton model (All Parwse Asoocaton) xyz. λ k = l XY,XZ YZ Condtonal Independence xy 2. λ = xyz λk = (r-) XZ, YZ 3. xz λ = xyz k λ (c-) XY, YZ k = 4. yz λ = xyz jk λ (l-) XY, XZ k = jont ndependent(partal Independence) xz yz xyz 5. λ = λ = λ = (r-)(c-) Z, XY jk k xy yz xyz 6. λ = λ = λ = (r-)(l-) Y, XZ jk k 7. xy xz xyz λ = λ = λ = (c-)(l-) X, YZ k k Complete Independence (mutual ndependent model ) xy xz xz xyz 8. λ, λ = = = (r-)(c-)(l-) X,Y,Z k λ λ k k Three-factor nteracton model XYZ

Inference for Loglnear Model ก ft Model [3 Way] ก. goodness of ft 2. resduals 3. tests about partal assocaton 4. Odds rato & CI goodness of ft -Lkelhood rato Ch-square -Pearson Statstcs 2

ก ก ก a = alcohol, c=cgarette, m=maruama +------------------+ a c m freq ------------------. 9 2. 538 3. 44 4. 456 5. 3 ------------------ 6. 43 7. 2 8. 279 +------------------+ ก ft Model & Selected Model. pf [fw=freq],ft(a+c+m+a*c+a*m+c*m+a*c*m) exp... N.B. structural/samplng zeroes may lead to an ncorrect df Resdual degrees of freedom = Number of parameters = 8 Number of cells = 8 Loglkelhood = 2.799373393 Loglkelhood = 2.799373393 Goodness of Ft Tests --------------------- df = Lkelhood Rato Statstc G² =. p-value =. Pearson Statstc X² =. p-value =. +---------------------------------------+ a c m Efreq Ofreq prob --------------------------------------- 279 279.2258348 2 2.87873 43 43.889279 3 3.38 456 456.23549 --------------------------------------- 44 44.93326 538 538.2363796 9 9.426362 +---------------------------------------+ 3

. posson freq a c m ac am cm acm Iteraton : log lkelhood = -77.36794 Iteraton : log lkelhood = -28.763936 Iteraton 2: log lkelhood = -24.727 Iteraton 3: log lkelhood = -24.522464 Iteraton 4: log lkelhood = -24.5274 Iteraton 5: log lkelhood = -24.5274 Posson regresson Number of obs = 8 LR ch2(7) = 285.46 Prob > ch2 =. Log lkelhood = -24.5274 Pseudo R2 =.983 freq Coef. Std. Err. z P> z [95% Conf. Interval] a.4928.768 6.46..34238.642539 c -.872.638293 -.4. -2.9 -.54892 m -4.93865.796367-6.96. -6.328927-3.54722 ac 2.35377.75765.58..69893 2.379862 am 2.59976.726983 3.58..749 4.24622 cm 2.275477.9274553 2.45.4.4576977 4.93256 acm.58957.942364.63.532 -.257489 2.4365 _cons 5.6322.598684 94.6. 5.53872 5.748552. posgof Goodness-of-ft ch2 = -.4935 Prob > ch2() =.. posgof,pearson Goodness-of-ft ch2 = Prob > ch2() =.. predct u,n. lst freq u +------------+ freq u ------------. 9 9 2. 538 538 3. 44 44 4. 456 456 5. 3 3 6. 43 43 7. 2 2 8. 279 279 +------------+ 4

. glm freq a c m ac am cm acm, f(po) l(log) Iteraton : log lkelhood = -36.2367 Iteraton : log lkelhood = -36.84776 Iteraton 2: log lkelhood = -25.5539 Iteraton 3: log lkelhood = -24.53486 Iteraton 4: log lkelhood = -24.52735 Iteraton 5: log lkelhood = -24.5274 Iteraton 6: log lkelhood = -24.5274 Generalzed lnear models No. of obs = 8 Optmzaton : ML: Newton-Raphson Resdual df = Scale parameter = Devance = 2.23377e-3 (/df) Devance =. Pearson = 5.6386e-2 (/df) Pearson =. Varance functon: V(u) = u [Posson] Lnk functon : g(u) = ln(u) [Log] Standard errors : OIM Log lkelhood = -24.52748 AIC = 8.3429 BIC = 2.23377e-3 freq Coef. Std. Err. z P> z [95% Conf. Interval] a.4928.768 6.46..34238.642539 c -.872.638293 -.4. -2.9 -.54892 m -4.93865.796367-6.96. -6.328927-3.54722 ac 2.35377.75765.58..69893 2.379862 am 2.59976.726983 3.58..749 4.24622 cm 2.275477.9274553 2.45.4.4576977 4.93256 acm.58957.942364.63.532 -.257489 2.4365 _cons 5.6322.598684 94.6. 5.53872 5.748552. pf [fw=freq],ft(a+c+m+a*c+a*m+c*m) exp N.B. structural/samplng zeroes may lead to an ncorrect df Resdual degrees of freedom = Number of parameters = 7 Number of cells = 8 Loglkelhood = 977.97672553 Loglkelhood = 2.6238968 Goodness of Ft Tests --------------------- df = Lkelhood Rato Statstc G² =.374 p-value =.54 Pearson Statstc X² =.4 p-value =.527 a c m Efreq Ofreq prob 279.6669 279.2285443.3837 2.6772 42.38386 43.86279 3.668357 3.5892 455.3833 456.2854 44.6683 44.9638 538.668 538.2366562 9.3836 9.3999926 5

. pf [fw=freq],ft(a+c+m+a*c+a*m) exp Loglkelhood = 762.47355346 Loglkelhood = 762.47355346 Goodness of Ft Tests --------------------- df = 2 Lkelhood Rato Statstc G² = 497.3693 p-value =. Pearson Statstc X² = 443.76 p-value =.. a c m Efreq Ofreq prob 276.7336 279.25744 4.296636 2.8878 45.296636 43.9986.733639 3.394 255.257 456.23979 244.99743 44.764386 738.99743 538.3246932 7.257 9.39592. pf [fw=freq],ft(a+c+m+a*c+c*m) exp Loglkelhood = 964.79928228 Loglkelhood = 964.79928228 Goodness of Ft Tests --------------------- df = 2 Lkelhood Rato Statstc G² = 92.84 p-value =. Pearson Statstc X² = 8.848 p-value =. a c m Efreq Ofreq prob 264.44942 279.6943 6.55576 2.72778 7.876923 43.785454 28.2377 3.235636 47.5558 456.2674454 29.449424 44.2939 563.238 538.2474787 885.87692 9.38922536 6

. pf [fw=freq],ft(a+c+m+a*m+c*m) exp Deletng all matrces... N.B. structural/samplng zeroes may lead to an ncorrect df Resdual degrees of freedom = 2 Number of parameters = 6 Number of cells = 8 Loglkelhood = 96.9222267878 Loglkelhood = 96.9222267878 Goodness of Ft Tests --------------------- df = 2 Lkelhood Rato Statstc G² = 87.7543 p-value =. Pearson Statstc X² = 77.649 p-value =. a c m Efreq Ofreq prob 79.8443 279.796.23958333 2.527 42.5957 43.624627 4.76467 3.2957 555.5957 456.2439897 45.7647 44.2563 438.8443 538.92824 99.23958 9.399495. pf [fw=freq],ft(a+c+m+a*c) exp Loglkelhood = 588.88652996 Loglkelhood = 588.88652996 Goodness of Ft Tests --------------------- df = 3 Lkelhood Rato Statstc G² = 843.8266 p-value =. Pearson Statstc X² = 74.97 p-value =. a c m Efreq Ofreq prob 62.47627 279.738676 8.52373 2.527545 26.59754 43.6869 9.4246 3.85248 289.369 456.27227 2.8963 44.926694 837.8225 538.36882 6.775 9.2685342 7

. pf [fw=freq],ft(a+c+m+a*m) exp Loglkelhood = 54.885565 Loglkelhood = 54.885565 Goodness of Ft Tests --------------------- df = 3 Lkelhood Rato Statstc G² = 939.5626 p-value =. Pearson Statstc X² = 824.63 p-value =. a c m Efreq Ofreq prob.49297 279.48547.757293 2.75384 2.573 43.9292927 3.284277 3.443 34.8699 456.4986248 327.743 44.4398256 652.93 538.28686863 627.29569 9.2756322. pf [fw=freq],ft(a+c+m+c*m) exp Loglkelhood = 743.69353744323 Loglkelhood = 743.69353744323 Goodness of Ft Tests --------------------- df = 3 Lkelhood Rato Statstc G² = 534.27 p-value =. Pearson Statstc X² = 55.5977 p-value =. a c m Efreq Ofreq prob 5.59974 279.463977 6.68963 2.29376 83.47477 43.3667578 3.3722 3.576965 629.426 456.2765379 39.3937 44.7373 497.52592 538.2859663 782.68278 9.34388523 8

. pf [fw=freq],ft(a+c+m) exp Resdual degrees of freedom = 4 Number of parameters = 4 Number of cells = 8 Loglkelhood = 367.78939592 Loglkelhood = 367.78939592 Goodness of Ft Tests --------------------- df = 4 Lkelhood Rato Statstc G² =.3e+3 p-value =. Pearson Statstc X² =.4e+3 p-value =. a c m Efreq Ofreq prob 64.879898 279.2856 47.3288 2.279473 24.9392 43.5456675 9.597385 3.398553 386.77 456.699337 282.923 44.239467 74.2262 538.325236 539.98258 9.2372569 Model G 2 X 2 df. P-value Homogeneous assocaton model (All Parwse Asoocaton) xyz. λ k =.37.4.54,.53 Condtonal Independence 2. xy λ = xyz λ 87.75 77.6.,. k = xz 3. λ = xyz k λ 92.2 8.8.,. k = 4. yz λ = xyz jk λ 497.37 443.76.,. k = jont ndependent (Partal Independence) xz yz xyz 5. λ = λ = λ = 843.83 74.9.,. jk k xy yz xyz 6. λ = λ = λ = 893.52 824.6.,. jk k 7. xy xz xyz λ = λ = λ = 534.2 53.6.,. k k Complete Independence (Mutual ndependent model) xy xz xz xyz 8. λ, λ = = = 286.2 4.39.,. k λ λ k k Three-factor nteracton model 9

(Dssmlarty Index) (Gn,94 Agrest,22, Kula & Frth,25) ก ก ก กก ftted ก = ˆ n ˆ µ / 2n= p ˆ π / 2 - - ก ก ก ก กก ftted ก - = ก ftted - ก.2.3 กก log( µ ) = λ+ λ + λ + λ + λ + λ + λ + λ + λ + λ + λ hk w h x y j z k wx h wy hj wz hk xy xz k yz jk ˆ = n ˆ / 2n= 29.25 / 2(68694) = µ.829 2

w x y z n 7287 996 587 759 3246 973 634 757 38 82 969 38 623 84 6693 53 68694 u 766.369 993.69 748.3 72.355 3353.829 988.7848 5985.493 78.8928 47.5 845.87 837.83 387.5588 645.36 38.8 68.372 58.2429 d = n - u 2.633 2.98393 6.386 37.69446 7.8293 5.78479 48.568 24.89276 9.4952 33.87 3.729 7.558838 77.69385 45.924 8.376 5.242859 29.25. gen wx =w*x. gen wy =w*y. gen wz =w*z. gen xy =x*y. gen xz =x*z. gen yz =y*z. qu posson n w x y z wx wy wz xy xz yz. gn n Gn Dssmlarty Index =.822 2

Tests about Partal Assocaton - ก AC, AM, CM ก AM, CM ก H : λ = Lkelhood rato Statstc -2(L -L ) G 2 (AM, CM)-G 2 (AC, AM, CM) ac. pf [fw=freq], ft(a*c+a*m+c*m) exp Deletng all matrces... Goodness of Ft Tests --------------------- df = Lkelhood Rato Statstc G^2 =.374 p-value =.54 Pearson Statstc X^2 =.4 p-value =.527 a c m Efreq Ofreq prob 279.6673 279.2285445.38376 2.6772 42.3837 43.86278 3.668352 3.5892 455.38327 456.2852 44.66829 44.9638 538.6683 538.2366563 9.3836 9.3999926 22

. pf [fw=freq], ft(a*m+c*m) exp Deletng all matrces... Goodness of Ft Tests --------------------- df = 2 Lkelhood Rato Statstc G^2 = 87.7543 p-value =. Pearson Statstc X^2 = 77.649 p-value =. a m c Efreq Ofreq prob 79.8443 279.796 42.5957 43.624627.23958333 2.527 4.76467 3.2957 555.5957 456.2439897 438.8443 538.92824 45.7647 44.2563 99.23958 9.399495 G 2 (AM, CM)-G 2 (AC, AM, CM) 87.7543-.374 = 87.383 (df=2) (df=) = df=2- =. dsp chprob(,87.383).86e-42 Strong Evdence Ho -> Strong evdence A-C Partal assocaton AC Model 23

Odds rato & Confdence Interval mˆ / k = n n ( k ) + ( k ) n n jj ( k ) j+ ( k ) ------------------------------------------ m a and c ----------+------------------------------- 279(279.668) 2(.3837) 43(42.3837) 3(3.6683) ----------+------------------------------- 456(455.3832) 44(44.6683) 538(538.668) 9(3.3832) ------------------------------------------ mˆ ac = n n n n. lst a c m freq u +-----------------------------+ a c m freq u -----------------------------. 9 9.3832 2. 538 538.668 3. 44 44.6683 4. 456 455.3832 5. 3 3.6683 ----------------------------- 6. 43 42.3837 7. 2.3837 8. 279 279.668 +-----------------------------+ ˆ m ac = 9.38(.38) 44.62(3.62) = 7.778 24

+-----------------------------+ a c m freq u -----------------------------. 9 9.3832 2. 538 538.668 3. 44 44.6683 4. 456 455.3832 5. 3 3.6683 ----------------------------- 6. 43 42.3837 7. 2.3837 8. 279 279.668 +-----------------------------+ n mˆ ac = n ˆ m ac = n n 9.38(.38) 44.62(3.62) = 7.778 ก odds rato ก ก ก ก ก ก odds rato = 7.8; 95%CI ก (7.8±.96*.36) ก (5.55-.98) ก Wald (Z) ก.8 p-value <.. posson freq a c m ac am cm, rr Iteraton : log lkelhood = -79.4767 Iteraton : log lkelhood = -29.24533 Iteraton 2: log lkelhood = -24.94826 Iteraton 3: log lkelhood = -24.7894 Iteraton 4: log lkelhood = -24.7877 Iteraton 5: log lkelhood = -24.7877 Posson regresson Number of obs = 8 LR ch2(6) = 285.9 Prob > ch2 =. Log lkelhood = -24.7877 Pseudo R2 =.983 freq IRR Std. Err. z P> z [95% Conf. Interval] a.628597.233943 6.44..43849.889326 c.55759.24669 -.6..9.28558 m.49467.2356 -.7..949.25545 ac 7.832.358259.8. 5.547649.9758 am 9.8658 9.23684 6.43. 7.966636 49.24297 cm 7.2533 2.826447 7.38. 2.532 23.78389 25

Strateges n model selecton ก ก. sw posson freq a c m ac am cm acm,pr(.5) begn wth full model p =.536 >=.5 removng acm Posson regresson Number of obs = 8 LR ch2(6) = 285.9 Prob > ch2 =. Log lkelhood = -24.7877 Pseudo R2 =.983 freq Coef. Std. Err. z P> z [95% Conf. Interval] a.48779.757672 6.44..33928.63622 c -.886669.62697 -.6. -2.25549 -.567789 m -5.3942.47597 -.7. -6.244-4.377673 ac 2.54534.74643.8..73374 2.395694 am 2.9864.464678 6.43. 2.75262 3.896767 cm 2.847889.638394 7.38. 2.52677 3.699 _cons 5.63342.5978 94.36. 5.5649 5.75432. posson freq f v Iteraton : log lkelhood = -3.95393 Iteraton : log lkelhood = -3.95387 Iteraton 2: log lkelhood = -3.95387 Posson regresson Number of obs = 4 LR ch2(2) = 72.24 Prob > ch2 =. Log lkelhood = -3.95387 Pseudo R2 =.5385 freq Coef. Std. Err. z P> z [95% Conf. Interval] f -.223473.5799 -.2.833 -.2295349.84843 v.9477894.77963 8.5..76929.78666 _cons 3.92334.28342 34.77. 3.7983 4.44285. posgof Goodness-of-ft ch2 = 37.3534 Prob > ch2() =. 26

. loglnk count f v,ft(f,v) Varable f = A Varable v = B Margns ft: f,v Note: Regresson-lke constrants are assumed. The frst level of each varable (and all teractons wth t) wll be dropped from estmaton. Iteraton : Log Lkelhood = -32.4625 Iteraton : Log Lkelhood = -3.9634 Iteraton 2: Log Lkelhood = -3.953735 Possok regresson Number of obs = 4 Goodness-of-ft ch2() = 37.35 Model ch2(2) = 72.238 Prob > ch2 =. Prob > ch2 =. Log Lkelhood = -3.954 Pseudo R2 =.5385 count Coef. Std. Err. z P> z [95% Conf. Interval] A2.223473.5799.2.833 -.84843.2295349 B2 -.9477896.77963-8.5. -.78666 -.7693 _cons 4.848577.825 59.9. 4.687759 5.9394. posson freq Iteraton : log lkelhood = -67.7269 Iteraton : log lkelhood = -67.7269 Posson regresson Number of obs = 4 LR ch2() =. Prob > ch2 =. Log lkelhood = -67.7269 Pseudo R2 =. freq Coef. Std. Err. z P> z [95% Conf. Interval] _cons 4.494239.52856 85.3. 4.3965 4.597826. posgof Goodness-of-ft ch2 = 9.589 Prob > ch2(3) =. 27

. loglnk count f v,ft() Note: Only the grand mean wll be ft (one possok parameter for all cells). Varable f = A Varable v = B Margns ft: Grand mean only Note: Regresson-lke constrants are assumed. The frst level of each varable (and all teractons wth t) wll be dropped from estmaton. Iteraton : Log Lkelhood = -7.76665 Iteraton : Log Lkelhood = -67.9746 Iteraton 2: Log Lkelhood = -67.725 Iteraton 3: Log Lkelhood = -67.72632 Possok regresson Number of obs = 4 Goodness-of-ft ch2(3) = 9.589 Model ch2() =. Prob > ch2 =. Prob > ch2 =. Log Lkelhood = -67.73 Pseudo R2 =. count Coef. Std. Err. z P> z [95% Conf. Interval] _cons 4.494239.52856 85.3. 4.3965 4.597826. posson freq v Iteraton : log lkelhood = -3.976278 Iteraton : log lkelhood = -3.97627 Iteraton 2: log lkelhood = -3.97627 Posson regresson Number of obs = 4 LR ch2() = 72.9 Prob > ch2 =. Log lkelhood = -3.97627 Pseudo R2 =.5382 freq Coef. Std. Err. z P> z [95% Conf. Interval] v.9477894.77963 8.5..76929.78666 _cons 3.9223. 39.2. 3.7627 4.89. posgof Goodness-of-ft ch2 = 37.3964 Prob > ch2(2) =. 28

. loglnk count v,ft(v) Varable v = A Margns ft: v Note: Regresson-lke constrants are assumed. The frst level of each varable (and all teractons wth t) wll be dropped from estmaton. Iteraton : Log Lkelhood = -32.22637 Iteraton : Log Lkelhood = -3.9882 Iteraton 2: Log Lkelhood = -3.97674 Possok regresson Number of obs = 4 Goodness-of-ft ch2(2) = 37.396 Model ch2() = 72.93 Prob > ch2 =. Prob > ch2 =. Log Lkelhood = -3.976 Pseudo R2 =.5382 count Coef. Std. Err. z P> z [95% Conf. Interval] A2 -.9477894.77963-8.5. -.78666 -.76929 _cons 4.85982.622573 78.6. 4.73779 4.98835. posson freq f Iteraton : log lkelhood = -67.5344 Iteraton : log lkelhood = -67.5344 Posson regresson Number of obs = 4 LR ch2() =.4 Prob > ch2 =.8326 Log lkelhood = -67.5344 Pseudo R2 =.3 freq Coef. Std. Err. z P> z [95% Conf. Interval] f -.223473.5799 -.2.833 -.2295349.84843 _cons 4.5535.743294 6.6. 4.359667 4.6533. posgof Goodness-of-ft ch2 = 9.5443 Prob > ch2(2) =. 29

loglnk count f,ft(f) Varable f = A Margns ft: f Note: Regresson-lke constrants are assumed. The frst level of each varable (and all teractons wth t) wll be dropped from estmaton. Iteraton : Log Lkelhood = -75.789795 Iteraton : Log Lkelhood = -67.9667 Iteraton 2: Log Lkelhood = -67.5293 Iteraton 3: Log Lkelhood = -67.57 Possok regresson Number of obs = 4 Goodness-of-ft ch2(2) = 9.544 Model ch2() =.45 Prob > ch2 =. Prob > ch2 =.832 Log Lkelhood = -67.5 Pseudo R2 =.3 count Coef. Std. Err. z P> z [95% Conf. Interval] A2.223472.5799.2.833 -.84843.2295348 _cons 4.4833.75646 59.64. 4.335683 4.63323 ก ก log t[ P( y = x=, z = k)] =α logµ = λ+ λ + λ + λ + λ k x y j z k xz k log t[ P( y = x=, z = k)] =α + β logµ = λ+ λ + λ + λ + λ + λ + λ k x y j z k xy xz k x yz jk 3

log t[ P( y= x=, z = k)] =α + β logµ = λ+ λ + λ + λ + λ + λ k x y j z k xz k z k yz jk log t[ P( y= x=, z = k)] = α + β + β logµ = λ+ λ + λ + λ + λ + λ k x y j z k xy x xz k z k ก ก ก ก (death penalty: y) (vctm s race: z) (dependant s race :x). lst x y z count +-------------------+ x y z count -------------------. 9 2. 32 3. 4. 9 5. ------------------- 6. 52 7. 6 8. 97 +-------------------+ 3

. logt y [fw=count] Iteraton : log lkelhood = -3.2564 Logt estmates Number of obs = 326 LR ch2() = -. Prob > ch2 =. Log lkelhood = -3.2564 Pseudo R2 = -. y Coef. Std. Err. z P> z [95% Conf. Interval] _cons -2.86362.7679 -.8. -2.43275 -.749. posson count x y z xz Iteraton : log lkelhood = -23.24349 Iteraton : log lkelhood = -2.9698 Iteraton 2: log lkelhood = -2.966 Iteraton 3: log lkelhood = -2.96596 Iteraton 4: log lkelhood = -2.96596 Posson regresson Number of obs = 8 LR ch2(4) = 387.78 Prob > ch2 =. Log lkelhood = -2.96596 Pseudo R2 =.8985 count Coef. Std. Err. z P> z [95% Conf. Interval] x -.495943.59943-3.7.2 -.85767 -.788 y -2.86362.7679 -.8. -2.43275 -.749 z -2.43754.347595-7.. -3.877 -.756238 xz 3.365.378572 8.75. 2.569666 4.53633 _cons 4.5773.4466 44.98. 4.3284 4.74584. logt y x [fw=count], nolog Logt estmates Number of obs = 326 LR ch2() = 6.25 Prob > ch2 =.24 Log lkelhood = -.354 Pseudo R2 =.276 y Coef. Std. Err. z P> z [95% Conf. Interval] x.5794.4635394 2.28.22.49428.966462 _cons -2.8768.496435-6.84. -3.69466-2.4994. posson count x y z xy xz Iteraton : log lkelhood = -2.83449 Posson regresson Number of obs = 8 LR ch2(5) = 394.3 Prob > ch2 =. Log lkelhood = -8.78739 Pseudo R2 =.93 count Coef. Std. Err. z P> z [95% Conf. Interval] x -.5875747.638567-3.59. -.98728 -.266424 y -2.8768.496435-6.84. -3.69466-2.4994 z -2.43754.347595-7.. -3.877 -.756238 xy.5794.4635394 2.28.22.49428.966462 xz 3.365.378572 8.75. 2.569666 4.53633 _cons 4.579669.65 45.3. 4.38586 4.777753 32

. logt y z [fw=count], nolog Logt estmates Number of obs = 326 LR ch2() =.22 Prob > ch2 =.6379 Log lkelhood = -3.4567 Pseudo R2 =. y Coef. Std. Err. z P> z [95% Conf. Interval] z.6642.353987.47.638 -.5272558.86799 _cons -2.7733.2559976-8.48. -2.672479 -.668987. posson count x y z yz xz Iteraton : log lkelhood = -23.53495 Posson regresson Number of obs = 8 LR ch2(5) = 388. Prob > ch2 =. Log lkelhood = -2.79587 Pseudo R2 =.899 count Coef. Std. Err. z P> z [95% Conf. Interval] x -.495943.59943-3.7.2 -.85767 -.788 y -2.7733.2559979-8.48. -2.67248 -.668986 z -2.455877.3497847-7.2. -3.4442 -.773 yz.6642.35399.47.638 -.5272566.8687 xz 3.365.378572 8.75. 2.569666 4.53633 _cons 4.526688.96 44.4. 4.326848 4.726527. logt y x z [fw=count] Iteraton : log lkelhood = -3.2564 Logt estmates Number of obs = 326 LR ch2(2) = 7.43 Prob > ch2 =.243 Log lkelhood = -9.5496 Pseudo R2 =.328 y Coef. Std. Err. z P> z [95% Conf. Interval] x.32423.593463 2.55..36328 2.3423 z -.442222.48893 -..272 -.22595.345564 _cons -2.8425.423379-6.76. -3.665952-2.8258. posson count x y z xz xy yz Iteraton : log lkelhood = -2.7228 Posson regresson Number of obs = 8 LR ch2(6) = 395.2 Prob > ch2 =. Log lkelhood = -8.96 Pseudo R2 =.957 count Coef. Std. Err. z P> z [95% Conf. Interval] x -.6338.7427-3.69. -.96944 -.297577 y -2.8425.423379-6.76. -3.665952-2.8258 z -2.4769.34823-6.95. -3.99763 -.73569 xz 3.357995.38973 8.79. 2.69345 4.6645 xy.32423.593463 2.55..36328 2.3423 yz -.442222.48893 -..272 -.22595.345564 _cons 4.57862.275 45.23. 4.37968 4.776445 33

ก odds rato. logt y x z [fw=count],or Logt estmates Number of obs = 326 LR ch2(2) = 7.43 Prob > ch2 =.243 Log lkelhood = -9.5496 Pseudo R2 =.328 y Odds Rato Std. Err. z P> z [95% Conf. Interval] x 3.759225.95234 2.55..35847.439 z.6438933.2583 -..272.2934785.4275. posson count x y z xz xy yz,rr Posson regresson Number of obs = 8 LR ch2(6) = 395.2 Prob > ch2 =. Log lkelhood = -8.96 Pseudo R2 =.957 count IRR Std. Err. z P> z [95% Conf. Interval] x.539429.95-3.69..3794456.7429269 y.58328.24569-6.76..255798.328867 z.89272.365-6.95..45599.7629 xz 28.7354.97462 8.79. 3.595 6.7426 xy 3.759225.95234 2.55..35847.439 yz.6438933.2583 -..272.2934785.4275 34