log linear model - @@ home - kku web hosting file2 log linear model difference from logitmodel-do...
TRANSCRIPT
1
Log Linear Model
��. ���� ���� ���������� ���������������������
������������������ � ���!���"�����#�Email: [email protected]
Web Page: http://home.kku.ac.th/nikom
�"���������1. �:;<��;�=��>�! <� ����� (fitting models) A������>������"�:"����� �#���"����
2. �:;<�������#�:��������� (estimating parameter)����C>D������������#�:������������"���� �"� (main effect) ����"���� interaction effect
2
Log Linear Model
difference from logit model
-do not distinguish between response variable
(dependent) and explanatory variable
(independent)-relation among independent variable
Ex. �����"�:"��� ����ECC� � < ���>;<����� ��� ���A�D����:��>���"���#�
=��>��F�������D� (Log Linear Model)
��� ����� ( �������� 2)
( �������� 1) 1 2 ��
1 n11 n12 n1.
2 n21 n22 n2.
�� n.1 n.2 n
Log linear model for 2-way table
3
Independent modely
j
x λλλµ ++=i
)ij
ln(
��������������������
����� Fatal
(1)
Non Fatal (0)
����� (1) 1601 162527
�� (0) 510 412368
�"��#�� �����>��F��">����"�������C�>�GFC
inj
j
belt λλλµ ++=i
)ij
ln(
=��>��CC��CE��� (Saturated Model)-Log Linear Model G�����C>D���#��F��������� ��GH�����D�E�A���#���I��� ���"���� �"� (main effect) ����"�����#�� (interaction effect)
xy
ij
y
j
x λλλλµ +++=i
)ij
ln(
4
uij = GH�����D�E�A���#���I���= �#� intercept !"K� �>= �!��:����"���� �"��"����! < 1= �!��:����"���� �"��"����! < 2= �!��:����"�����#��
xy
ij
y
j
x λλλλµ +++=i
)ij
ln(
x
iλ
y
jλ
λ
xy
ijλ
�����D��=��>��H� �"C���������� � Log Linear model �H� �"C�I���! < 1 …(1)�H� �"C�I���! < 2 …(2)�H� �"C�I���! < 3 …(3)�H� �"C�I���! < 4 …(4)
xyyx
1111)11
ln( λλλλµ +++=
xyyx
1221)12
ln( λλλλµ +++=
xyyx
2112)21
ln( λλλλµ +++=
xyyx
2222)22
ln( λλλλµ +++=
5
���&� '(��
A�����H�����#� A>Q !H�R>D=>������D����� (1)-(4)=>��H� �>A D ��;<�!��#�A������!H�A DR>D�����A �#>"�� K
�H� �"C�I���! < 1 T(5)�H� �"C�I���! < 2 T(6)�H� �"C�I���! < 3 T(7)�H� �"C�I���! < 4 T(8)
xy
ij
x
i λλλλ ,,, y
j
0,0,0,0,0 222112
y
22 ===== xyxyxyx λλλλλ
xyyx
1111)11
ln( λλλλµ +++=x
1)12
ln( λλµ +=
y
1)21
ln( λλµ +=
λµ =)22
ln(
G�������D����� (5)-(8) ������H���� R>D>"�� K
=−=
22
12ln)22
ln()12
ln(x
1 µ
µµµλ
=−=
22
21ln)22
ln()21
ln(x
1 µ
µµµλ
=−−=
2112
2211ln)22
ln()21
(ln(-)12
ln()11
ln(11 µµ
µµµµµµλxy
xy
ij
x
i λλλλ ,,, y
j
)log( 22µλ =
6
��������������������
����� Fatal
(1)
Non Fatal (0)
����� (1) 1601 162527
�� (0) 510 412368
�������� ��� �!"#$%#�!&'�(��)*+���,�!"-$,
>"��"K�G���"��#���H�����#� R>D>"�� K
12.9297ln(412368) ==λ
0.9311412368
162527lnln(412368)ln(162527)x
1 −=
=−=λ
6.6953412568
510lnln(412368)ln(510)y
1 −=
=−=λ
2.075010)(162527)(5
368)(1601)(412ln
)ln(412368)(ln(510)-ln(162527)ln(1601)xy
11
=
=
−−=λ
��������������������
����� Fatal (1) Non Fatal (0)
����� (1) 1601 162527
�� (0) 510 412368
xy
ij
x
i λλλλ ,,, y
j
7
. gen bj=b*j
. poisson freq b j bj
Iteration 0: log likelihood = -23529.833
Iteration 1: log likelihood = -2035.315
Iteration 2: log likelihood = -153.7572
Iteration 3: log likelihood = -24.675529
Iteration 4: log likelihood = -22.947737
Iteration 5: log likelihood = -22.946503
Iteration 6: log likelihood = -22.946503
Poisson regression Number of obs = 4
LR chi2(3) = 884872.49
Prob > chi2 = 0.0000
Log likelihood = -22.946503 Pseudo R2 = 0.9999
------------------------------------------------------------------------------
freq | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
b | -.931072 .0029288 -317.90 0.000 -.9368123 -.9253317
j | -6.695261 .0443081 -151.11 0.000 -6.782103 -6.608419
bj | 2.075045 .0509311 40.74 0.000 1.975222 2.174868
_cons | 12.92967 .0015572 8302.90 0.000 12.92662 12.93272
------------------------------------------------------------------------------
. glm freq b j bj, f(po) l(log) ef
Iteration 0: log likelihood = -47246.359
Iteration 1: log likelihood = -5057.4045
Iteration 2: log likelihood = -527.64391
Iteration 3: log likelihood = -40.960771
Iteration 4: log likelihood = -22.981676
Iteration 5: log likelihood = -22.946503
Iteration 6: log likelihood = -22.946503
Generalized linear models No. of obs = 4
Optimization : ML Residual df = 0
Scale parameter = 1
Deviance = 1.44111e-11 (1/df) Deviance = .
Pearson = 5.49837e-24 (1/df) Pearson = .
Variance function: V(u) = u [Poisson]
Link function : g(u) = ln(u) [Log]
AIC = 13.47325
Log likelihood = -22.94650294 BIC = 1.44e-11
------------------------------------------------------------------------------
| OIM
freq | IRR Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
b | .394131 .0011543 -317.90 0.000 .391875 .3963999
j | .0012368 .0000548 -151.11 0.000 .0011339 .001349
bj | 7.964905 .405661 40.74 0.000 7.20822 8.801024
------------------------------------------------------------------------------
8
. loglin count qbelt injury ,fit( qbelt, injury, qbelt injury)
Variable qbelt = A
Variable injury = B
Margins fit: qbelt, injury, qbelt injury
Note: Regression-like constraints are assumed. The first level of each
variable (and all iteractions with it) will be dropped from estimation.
Iteration 0: log likelihood = -23529.833
Iteration 1: log likelihood = -2035.315
Iteration 2: log likelihood = -153.7572
Iteration 3: log likelihood = -24.675529
Iteration 4: log likelihood = -22.947737
Iteration 5: log likelihood = -22.946503
Iteration 6: log likelihood = -22.946503
Poisson regression Number of obs = 4
LR chi2(3) = 884872.49
Prob > chi2 = 0.0000
Log likelihood = -22.946503 Pseudo R2 = 0.9999
----------------------------------------------------------------------------
count | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
A2 | -.931072 .0029288 -317.90 0.000 -.9368123 -.9253317
AB22 | 2.075045 .0509311 40.74 0.000 1.975222 2.174868
B2 | -6.695261 .0443081 -151.11 0.000 -6.782103 -6.608419
_cons | 12.92967 .0015572 8302.90 0.000 12.92662 12.93272
------------------------------------------------------------------------------
���)*+'��,���
� �����"�:"����� �#�� ���A�D selt belt �"C���C�>�GFC. poisson freq b j bj,irr
Iteration 0: log likelihood = -23529.833
Iteration 1: log likelihood = -2035.315
Iteration 2: log likelihood = -153.7572
Iteration 3: log likelihood = -24.675529
Iteration 4: log likelihood = -22.947737
Iteration 5: log likelihood = -22.946503
Iteration 6: log likelihood = -22.946503
Poisson regression Number of obs = 4
LR chi2(3) = 884872.49
Prob > chi2 = 0.0000
Log likelihood = -22.946503 Pseudo R2 = 0.9999
------------------------------------------------------------------------------
freq | IRR Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
b | .394131 .0011543 -317.90 0.000 .391875 .3963999
j | .0012368 .0000548 -151.11 0.000 .0011339 .001349
bj | 7.964907 .4056611 40.74 0.000 7.208222 8.801026
------------------------------------------------------------------------------
xy
11λ
. list
+---------------------+
| b j freq bj |
|---------------------|
1. | 1 1 1601 1 |
2. | 1 0 162527 0 |
3. | 0 1 510 0 |
4. | 0 0 412368 0 |
+---------------------+
. di (1601*412368)/(162527*510)
7.9649049
9
���)*+-����.)*+/ +��0(1 odds ratio
. poisson freq b j bj,irr
Iteration 0: log likelihood = -23529.833
Iteration 1: log likelihood = -2035.315
Iteration 2: log likelihood = -153.7572
Iteration 3: log likelihood = -24.675529
Iteration 4: log likelihood = -22.947737
Iteration 5: log likelihood = -22.946503
Iteration 6: log likelihood = -22.946503
Poisson regression Number of obs = 4
LR chi2(3) = 884872.49
Prob > chi2 = 0.0000
Log likelihood = -22.946503 Pseudo R2 = 0.9999
------------------------------------------------------------------------------
freq | IRR Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
b | .394131 .0011543 -317.90 0.000 .391875 .3963999
j | .0012368 .0000548 -151.11 0.000 .0011339 .001349
bj | 7.964907 .4056611 40.74 0.000 7.208222 8.801026
------------------------------------------------------------------------------
������>���C�>�GFC���EDR�#��> Selt Belt � �#��!#��"C 7.96�#����;<�"<�� �#��"K���# 7.21 - 8.80
------------------------------------------
| m
a and c | 0 1
----------+-------------------------------
0 |
0 | 279(279.6168) 2(1.38317)
1 | 43(42.38317) 3(3.61683)
----------+-------------------------------
1 |
0 | 456(455.3832) 44(44.61683)
1 | 538(538.6168) 911(310.3832)
------------------------------------------
Log linear model for 3-way tables���� !�"!#$% &�' ())*+',- (cigarette) &�'01-� *'� (alcohol)345 &�'6789�: ";<0 (marijuana) >?@�!9'*A#
acmcmam
ik
acmca
ijkjkijkji)
ij( λλλλλλλλµ +++++++=ln
10
Log linear model for 3-way tables
-Homogeneous association modelAll Pairwise Association Present-No independent
( )
-Conditional independence model
yzxz
ik
xyzyx
jkijkji)
ij( λλλλλλλµ ++++++=ln
0=xyz
ijkλ
0== xyzxy
ijkijλλyzxz
ik
zyx
jkkji)
ij( λλλλλλµ +++++=ln
yzxyzyx
jkijkji)
ij( λλλλλλµ +++++=ln
xz
ik
xyzyx
ijkji)
ij( λλλλλλµ +++++=ln
0== xyzxz
ijkikλλ
0== xyzyz
ijkjkλλ
-joint independent (Partial Independence Model )
-Complete Independence Model
0=== xyzxzxy
ijkikijλλλ
xyzyx
ijkji)
ij( λλλλλµ ++++=ln
xz
ik
zyx
kji)
ij( λλλλλµ ++++=ln
yzzyx
jkkji)
ij( λλλλλµ ++++=ln
0, === xyzxzxz
k
xy
ijkikijλλλλ
zyx
kji)
ij( λλλλµ +++=ln
11
Model df. symbol
Homogeneous association model (All Pairwise Asoociation)
1. l XY,XZ YZ
Conditional Independence
2. (r-1) XZ, YZ
3. (c-1) XY, YZ
4. (l-1) XY, XZ
joint independent (Partial Independence)
5. (r-1)(c-1) Z , XY
6. (r-1)(l-1) Y, XZ
7. (c-1)(l-1) X, YZ
Complete Independence (mutual independent model )
8. (r-1)(c-1)(l-1) X,Y,Z
Three-factor interaction model XYZ
0=xyz
ijkλ
0== xyz
ijk
xy
ij λλ0== xyz
ijk
xz
ik λλ0== xyz
ijk
yz
jk λλ
0=== xyzyzxz
ijkjkijλλλ
0=== xyzyzxy
ijkjkijλλλ
0=== xyzxzxy
ijkikijλλλ
0, === xyzxzxz
k
xy
ijkikijλλλλ
12
Inference for Loglinear Model ��� fit Model [3 Way] :�G����G�� 1. goodness of fit
2. residuals3. tests about partial association4. Odds ratio & CI
goodness of fit
-Likelihood ratio Chi-square-Pearson Statistics
13
�����"�:"��� ����ECC� � < ���>;<����� ��� ���A�D����:��>���"���#� a = alcohol, c=cigarette,m=marijuama
+------------------+
| a c m freq |
|------------------|
1. | 1 1 1 911 |
2. | 1 1 0 538 |
3. | 1 0 1 44 |
4. | 1 0 0 456 |
5. | 0 1 1 3 |
|------------------|
6. | 0 1 0 43 |
7. | 0 0 1 2 |
8. | 0 0 0 279 |
+------------------+
��� fit Model & Selected Model. ipf [fw=freq] ,fit(a+c+m+a*c+a*m+c*m+a*c*m) exp
...
N.B. structural/sampling zeroes may lead to an incorrect df
Residual degrees of freedom = 0
Number of parameters = 8
Number of cells = 8
Loglikelihood = 12010.79937313193
Loglikelihood = 12010.79937313193
Goodness of Fit Tests
---------------------
df = 0
Likelihood Ratio Statistic G² = 0.0000 p-value = .
Pearson Statistic X² = 0.0000 p-value = .
+---------------------------------------+
| a c m Efreq Ofreq prob |
|---------------------------------------|
| 0 0 0 279 279 .12258348 |
| 0 0 1 2 2 .00087873 |
| 0 1 0 43 43 .01889279 |
| 0 1 1 3 3 .0013181 |
| 1 0 0 456 456 .20035149 |
|---------------------------------------|
| 1 0 1 44 44 .01933216 |
| 1 1 0 538 538 .23637961 |
| 1 1 1 911 911 .40026362 |
+---------------------------------------+
14
. poisson freq a c m ac am cm acm
Iteration 0: log likelihood = -77.306794
Iteration 1: log likelihood = -28.763936
Iteration 2: log likelihood = -24.720107
Iteration 3: log likelihood = -24.522464
Iteration 4: log likelihood = -24.521714
Iteration 5: log likelihood = -24.521714
Poisson regression Number of obs = 8
LR chi2(7) = 2851.46
Prob > chi2 = 0.0000
Log likelihood = -24.521714 Pseudo R2 = 0.9831
------------------------------------------------------------------------------
freq | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
a | .491281 .076008 6.46 0.000 .3423081 .6402539
c | -1.870012 .1638293 -11.41 0.000 -2.191111 -1.548912
m | -4.938065 .7096367 -6.96 0.000 -6.328927 -3.547202
ac | 2.035377 .1757605 11.58 0.000 1.690893 2.379862
am | 2.599761 .7269831 3.58 0.000 1.174901 4.024622
cm | 2.275477 .9274553 2.45 0.014 .4576977 4.093256
acm | .5895107 .9423641 0.63 0.532 -1.257489 2.43651
_cons | 5.631212 .0598684 94.06 0.000 5.513872 5.748552
------------------------------------------------------------------------------
. poisgof
Goodness-of-fit chi2 = -.0014935
Prob > chi2(0) = .
. poisgof,pearson
Goodness-of-fit chi2 = 0
Prob > chi2(0) = .
. predict u,n
. list freq u
+------------+
| freq u |
|------------|
1. | 911 911 |
2. | 538 538 |
3. | 44 44 |
4. | 456 456 |
5. | 3 3 |
6. | 43 43 |
7. | 2 2 |
8. | 279 279 |
+------------+
15
. glm freq a c m ac am cm acm, f(po) l(log)
Iteration 0: log likelihood = -136.02367
Iteration 1: log likelihood = -36.84776
Iteration 2: log likelihood = -25.505391
Iteration 3: log likelihood = -24.534861
Iteration 4: log likelihood = -24.521735
Iteration 5: log likelihood = -24.521714
Iteration 6: log likelihood = -24.521714
Generalized linear models No. of obs = 8
Optimization : ML: Newton-Raphson Residual df = 0
Scale parameter = 1
Deviance = 2.23377e-13 (1/df) Deviance = .
Pearson = 5.63860e-21 (1/df) Pearson = .
Variance function: V(u) = u [Poisson]
Link function : g(u) = ln(u) [Log]
Standard errors : OIM
Log likelihood = -24.52171418 AIC = 8.130429
BIC = 2.23377e-13
------------------------------------------------------------------------------
freq | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
a | .491281 .076008 6.46 0.000 .3423081 .6402539
c | -1.870012 .1638293 -11.41 0.000 -2.191111 -1.548912
m | -4.938065 .7096367 -6.96 0.000 -6.328927 -3.547202
ac | 2.035377 .1757605 11.58 0.000 1.690893 2.379862
am | 2.599761 .7269831 3.58 0.000 1.174901 4.024622
cm | 2.275477 .9274553 2.45 0.014 .4576977 4.093256
acm | .5895107 .9423641 0.63 0.532 -1.257489 2.43651
_cons | 5.631212 .0598684 94.06 0.000 5.513872 5.748552
------------------------------------------------------------------------------
. ipf [fw=freq] ,fit(a+c+m+a*c+a*m+c*m) exp
N.B. structural/sampling zeroes may lead to an incorrect df
Residual degrees of freedom = 1
Number of parameters = 7
Number of cells = 8
Loglikelihood = 11977.97067255003
…
Loglikelihood = 12010.6123801968
Goodness of Fit Tests
---------------------
df = 1
Likelihood Ratio Statistic G² = 0.3740 p-value = 0.541
Pearson Statistic X² = 0.4011 p-value = 0.527
+-------------------------------------------+
| a c m Efreq Ofreq prob |
|-------------------------------------------|
| 0 0 0 279.61669 279 .12285443 |
| 0 0 1 1.38317 2 .00060772 |
| 0 1 0 42.383186 43 .01862179 |
| 0 1 1 3.6168357 3 .00158912 |
| 1 0 0 455.38331 456 .20008054 |
|-------------------------------------------|
| 1 0 1 44.61683 44 .01960318 |
| 1 1 0 538.61681 538 .23665062 |
| 1 1 1 910.38316 911 .3999926 |
+-------------------------------------------+
16
. ipf [fw=freq] ,fit(a+c+m+a*c+a*m) exp
…
Loglikelihood = 11762.11473553461
Loglikelihood = 11762.11473553461
Goodness of Fit Tests
---------------------
df = 2
Likelihood Ratio Statistic G² = 497.3693 p-value = 0.000
Pearson Statistic X² = 443.7611 p-value = 0.000
+-------------------------------------------+
| a c m Efreq Ofreq prob |
|-------------------------------------------|
| 0 0 0 276.70336 279 .12157441 |
| 0 0 1 4.2966361 2 .0018878 |
| 0 1 0 45.296636 43 .01990186 |
| 0 1 1 .70336391 3 .00030904 |
| 1 0 0 255.00257 456 .11203979 |
|-------------------------------------------|
| 1 0 1 244.99743 44 .10764386 |
| 1 1 0 738.99743 538 .32469132 |
| 1 1 1 710.00257 911 .31195192 |
+-------------------------------------------+
.
. ipf [fw=freq] ,fit(a+c+m+a*c+c*m) exp
…
Loglikelihood = 11964.79019282218
Loglikelihood = 11964.79019282218
Goodness of Fit Tests
---------------------
df = 2
Likelihood Ratio Statistic G² = 92.0184 p-value = 0.000
Pearson Statistic X² = 80.8148 p-value = 0.000
+-------------------------------------------+
| a c m Efreq Ofreq prob |
|-------------------------------------------|
| 0 0 0 264.44942 279 .11619043 |
| 0 0 1 16.550576 2 .00727178 |
| 0 1 0 17.876923 43 .00785454 |
| 0 1 1 28.123077 3 .01235636 |
| 1 0 0 470.55058 456 .20674454 |
|-------------------------------------------|
| 1 0 1 29.449424 44 .01293911 |
| 1 1 0 563.12308 538 .24741787 |
| 1 1 1 885.87692 911 .38922536 |
+-------------------------------------------+
17
. ipf [fw=freq] ,fit(a+c+m+a*m+c*m) exp
Deleting all matrices......
N.B. structural/sampling zeroes may lead to an incorrect df
Residual degrees of freedom = 2
Number of parameters = 6
Number of cells = 8
Loglikelihood = 11916.92222167878
Loglikelihood = 11916.92222167878
Goodness of Fit Tests
---------------------
df = 2
Likelihood Ratio Statistic G² = 187.7543 p-value = 0.000
Pearson Statistic X² = 177.6149 p-value = 0.000
+-------------------------------------------+
| a c m Efreq Ofreq prob |
|-------------------------------------------|
| 0 0 0 179.84043 279 .079016 |
| 0 0 1 .23958333 2 .00010527 |
| 0 1 0 142.15957 43 .06246027 |
| 0 1 1 4.7604167 3 .00209157 |
| 1 0 0 555.15957 456 .24391897 |
|-------------------------------------------|
| 1 0 1 45.760417 44 .02010563 |
| 1 1 0 438.84043 538 .19281214 |
| 1 1 1 909.23958 911 .39949015 |
+-------------------------------------------+
. ipf [fw=freq] ,fit(a+c+m+a*c) exp
Loglikelihood = 11588.88605129906
Loglikelihood = 11588.88605129906
Goodness of Fit Tests
---------------------
df = 3
Likelihood Ratio Statistic G² = 843.8266 p-value = 0.000
Pearson Statistic X² = 704.9071 p-value = 0.000
+-------------------------------------------+
| a c m Efreq Ofreq prob |
|-------------------------------------------|
| 0 0 0 162.47627 279 .07138676 |
| 0 0 1 118.52373 2 .05207545 |
| 0 1 0 26.59754 43 .01168609 |
| 0 1 1 19.40246 3 .00852481 |
| 1 0 0 289.10369 456 .12702271 |
|-------------------------------------------|
| 1 0 1 210.89631 44 .09266094 |
| 1 1 0 837.8225 538 .36811182 |
| 1 1 1 611.1775 911 .26853142 |
+-------------------------------------------+
18
. ipf [fw=freq] ,fit(a+c+m+a*m) exp
…
Loglikelihood = 11541.01808015565
Loglikelihood = 11541.01808015565
Goodness of Fit Tests
---------------------
df = 3
Likelihood Ratio Statistic G² = 939.5626 p-value = 0.000
Pearson Statistic X² = 824.1630 p-value = 0.000
+-------------------------------------------+
| a c m Efreq Ofreq prob |
|-------------------------------------------|
| 0 0 0 110.49297 279 .048547 |
| 0 0 1 1.7157293 2 .00075384 |
| 0 1 0 211.50703 43 .09292927 |
| 0 1 1 3.2842707 3 .001443 |
| 1 0 0 341.08699 456 .14986248 |
|-------------------------------------------|
| 1 0 1 327.70431 44 .14398256 |
| 1 1 0 652.91301 538 .28686863 |
| 1 1 1 627.29569 911 .27561322 |
+-------------------------------------------+
. ipf [fw=freq] ,fit(a+c+m+c*m) exp
…
Loglikelihood = 11743.69353744323
Loglikelihood = 11743.69353744323
Goodness of Fit Tests
---------------------
df = 3
Likelihood Ratio Statistic G² = 534.2117 p-value = 0.000
Pearson Statistic X² = 505.5977 p-value = 0.000
+-------------------------------------------+
| a c m Efreq Ofreq prob |
|-------------------------------------------|
| 0 0 0 105.59974 279 .04639707 |
| 0 0 1 6.6089631 2 .00290376 |
| 0 1 0 83.474077 43 .03667578 |
| 0 1 1 131.31722 3 .0576965 |
| 1 0 0 629.40026 456 .2765379 |
|-------------------------------------------|
| 1 0 1 39.391037 44 .01730713 |
| 1 1 0 497.52592 538 .21859663 |
| 1 1 1 782.68278 911 .34388523 |
+-------------------------------------------+
19
. ipf [fw=freq] ,fit(a+c+m) exp
Residual degrees of freedom = 4
Number of parameters = 4
Number of cells = 8
Loglikelihood = 11367.7893959201
Loglikelihood = 11367.7893959201
Goodness of Fit Tests
---------------------
df = 4
Likelihood Ratio Statistic G² = 1.3e+03 p-value = 0.000
Pearson Statistic X² = 1.4e+03 p-value = 0.000
+-------------------------------------------+
| a c m Efreq Ofreq prob |
|-------------------------------------------|
| 0 0 0 64.879898 279 .02850611 |
| 0 0 1 47.328801 2 .02079473 |
| 0 1 0 124.19392 43 .05456675 |
| 0 1 1 90.597385 3 .03980553 |
| 1 0 0 386.70007 456 .16990337 |
|-------------------------------------------|
| 1 0 1 282.09123 44 .12394167 |
| 1 1 0 740.22612 538 .32523116 |
| 1 1 1 539.98258 911 .23725069 |
+-------------------------------------------+
Model G2 X2 df. P-value
Homogeneous association model (All Pairwise Asoociation)
1. .37 .40 .54,.53
Conditional Independence
2. 187.75 177.61 .00,.00
3. 92.02 80.81 .00,.00
4. 497.37 443.76 .00,.00
joint independent (Partial Independence)
5. 843.83 704.91 .00, .00
6. 893.52 824.16 .00, .00
7. 534.21 503.60 .00, .00
Complete Independence (Mutual independent model)
8. 1286.02 1411.39 .00, .00
Three-factor interaction model 0 0
0=xyz
ijkλ
0== xyz
ijk
xy
ij λλ0== xyz
ijk
xz
ik λλ0== xyz
ijk
yz
jk λλ
0=== xyzyzxz
ijkjkijλλλ
0=== xyzyzxy
ijkjkijλλλ
0=== xyzxzxy
ijkikijλλλ
0, === xyzxzxz
k
xy
ijkikijλλλλ
20
��U V'�����-W�+XWY (Dissimilarity Index)
>"�� ����R�#�>��D� (Gini,1914 D��g�A� Agresti,2002, Kula & Firth,2005) ��h�>"�� ! <��>�g�����A��D�� ���"���GH�����D�E�A��I������#��"���� ����#���> �"�! <R>DG����� fitted ����� �H����>"�� K
-� �#��E#�� �#�� 0 g� 1-�#���D�A��D 0 GH�����D�E�A��I������#��"����� �#�A��D�� ���"C�#���> �"� ! <R>DG����� fitted ����� ->"�� ����R�#�>��D�= 0 ��>��#������ fitted R>D��CE��� -!���i�C"���#�>"�� ����R�#�>��D����� �#��D���#� .02 �; .03
2/ˆ2/ˆˆ ∑∑ −=−=∆i
ii
i
ii pnn πµ
Z�'W���Y G������������ �=��>��F�������D� ����� ��#�>"�� ����R�#�>��D�>"�� K
yz
jk
xz
ik
xy
ij
wz
hk
wy
hj
wx
hi
z
k
y
j
x
i
w
hhijk λλλλλλλλλλλµ ++++++++++=)log(
008219.)68694(2/205.11292/ˆˆ ==−=∆ ∑ nni
ii µ
21
1129.20568694���
5.242859518.24295131100
118.37166811.37266930100
45.920411038.0810841000
77.693856045.30661230000
7.558838387.55883801110
131.172910837.83109690110
33.11871845.11878121010
90.4951210471.5103810010
24.89276781.89287571101
148.50685985.49361340101
15.78479988.78489731001
107.82933353.82932460001
37.69446721.30557591111
161.308611748.31115870111
2.983093993.01699961011
120.63137166.36972870011
di = ni - uiuinizyxw
. gen wx =w*x
. gen wy =w*y
. gen wz =w*z
. gen xy =x*y
. gen xz =x*z
. gen yz =y*z
. qui poisson ni w x y z wx wy wz xy xz yz
. gini ni
Gini Dissimilarity Index = 0.00822
22
Tests about Partial Association
-��� �C�! �C��������#���� �#��=��>���#���� �C�! �C=��>� AC, AM, CM�"C AM, CM��h����!>�CA�D Likelihood ratio Statistic -2(L0-L1)G2(AM, CM)-G2(AC, AM, CM)
0:0 =acijH λ
. ipf [fw=freq] , fit(a*c+a*m+c*m) exp
Deleting all matrices…
...
Goodness of Fit Tests
---------------------
df = 1
Likelihood Ratio Statistic G^2 = 0.3740 p-value = 0.541
Pearson Statistic X^2 = 0.4011 p-value = 0.527
+-------------------------------------------+
| a c m Efreq Ofreq prob |
|-------------------------------------------|
| 0 0 0 279.61673 279 .12285445 |
| 0 0 1 1.3831706 2 .00060772 |
| 0 1 0 42.383171 43 .01862178 |
| 0 1 1 3.6168352 3 .00158912 |
| 1 0 0 455.38327 456 .20008052 |
|-------------------------------------------|
| 1 0 1 44.616829 44 .01960318 |
| 1 1 0 538.61683 538 .23665063 |
| 1 1 1 910.38316 911 .3999926 |
+-------------------------------------------+
23
. ipf [fw=freq] , fit(a*m+c*m) exp
Deleting all matrices…
...
Goodness of Fit Tests
---------------------
df = 2
Likelihood Ratio Statistic G^2 = 187.7543 p-value = 0.000
Pearson Statistic X^2 = 177.6149 p-value = 0.000
+-------------------------------------------+
| a m c Efreq Ofreq prob |
|-------------------------------------------|
| 0 0 0 179.84043 279 .079016 |
| 0 0 1 142.15957 43 .06246027 |
| 0 1 0 .23958333 2 .00010527 |
| 0 1 1 4.7604167 3 .00209157 |
| 1 0 0 555.15957 456 .24391897 |
|-------------------------------------------|
| 1 0 1 438.84043 538 .19281214 |
| 1 1 0 45.760417 44 .02010563 |
| 1 1 1 909.23958 911 .39949015 |
+-------------------------------------------+
G2(AM, CM)-G2(AC, AM, CM)187.7543-0.3740 = 187.3803(df=2) (df=1) = df=2-1 = 1
. disp chiprob(1,187.3803)
1.186e-42
)-�Y'�� Strong Evidence Ho -> Strong evidenceA-C Partial association >"��"K� AC �D��E#A� Model
24
Odds ratio & Confidence Interval
)()(
)()(
/ˆ
kjki
kjjkii
kijnn
nnm
++
=
------------------------------------------
| m
a and c | 0 1
----------+-------------------------------
0 |
0 | 279(279.6168) 2(1.38317)
1 | 43(42.38317) 3(3.61683)
----------+-------------------------------
1 |
0 | 456(455.3832) 44(44.61683)
1 | 538(538.6168) 911(310.3832)
------------------------------------------
. list a c m freq u
+-----------------------------+
| a c m freq u |
|-----------------------------|
1. | 1 1 1 911 910.3832 |
2. | 1 1 0 538 538.6168 |
3. | 1 0 1 44 44.61683 |
4. | 1 0 0 456 455.3832 |
5. | 0 1 1 3 3.61683 |
|-----------------------------|
6. | 0 1 0 43 42.38317 |
7. | 0 0 1 2 1.38317 |
8. | 0 0 0 279 279.6168 |
+-----------------------------+
0110
0011ˆnn
nnmac =
778.7
)62.3(62.44
)38.1(38.910ˆ
=
=acm
25
���������� ������#� odds ratio ��>��#�� �����"�:"����"��E��� �#�����>;<������������ECC� � < !"K�A����#��EC�"p�����R�#�EC�"p�� odds ratio = 7.8; 95%CI �!#��"C (7.80± 1.96*1.36) �!#��"C (5.55-10.98) Ig<��>��D��"C���� Wald (Z) �!#��"C 11.80 ��� p-value < .001
778.7
)62.3(62.44
)38.1(38.910ˆ
=
=acm
0110
0011ˆnn
nnmac =
+-----------------------------+
| a c m freq u |
|-----------------------------|
1. | 1 1 1 911 910.3832 |
2. | 1 1 0 538 538.6168 |
3. | 1 0 1 44 44.61683 |
4. | 1 0 0 456 455.3832 |
5. | 0 1 1 3 3.61683 |
|-----------------------------|
6. | 0 1 0 43 42.38317 |
7. | 0 0 1 2 1.38317 |
8. | 0 0 0 279 279.6168 |
+-----------------------------+
. poisson freq a c m ac am cm, irr
Iteration 0: log likelihood = -79.476701
Iteration 1: log likelihood = -29.245303
Iteration 2: log likelihood = -24.914826
Iteration 3: log likelihood = -24.708904
Iteration 4: log likelihood = -24.708707
Iteration 5: log likelihood = -24.708707
Poisson regression Number of obs = 8
LR chi2(6) = 2851.09
Prob > chi2 = 0.0000
Log likelihood = -24.708707 Pseudo R2 = 0.9830
------------------------------------------------------------------------------
freq | IRR Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
a | 1.628597 .1233943 6.44 0.000 1.403849 1.889326
c | .1515759 .0246609 -11.60 0.000 .11019 .2085058
m | .0049467 .0023506 -11.17 0.000 .0019491 .0125545
ac | 7.803201 1.358259 11.80 0.000 5.547649 10.97581
am | 19.80658 9.203684 6.43 0.000 7.966636 49.24297
cm | 17.25133 2.826447 17.38 0.000 12.51302 23.78389
------------------------------------------------------------------------------
26
Strategies in model selection
����">��;��#��� �"K���. sw poisson freq a c m ac am cm acm,pr(.15)
begin with full model
p = 0.5316 >= 0.1500 removing acm
Poisson regression Number of obs = 8
LR chi2(6) = 2851.09
Prob > chi2 = 0.0000
Log likelihood = -24.708707 Pseudo R2 = 0.9830
------------------------------------------------------------------------------
freq | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
a | .487719 .0757672 6.44 0.000 .339218 .63622
c | -1.886669 .162697 -11.60 0.000 -2.205549 -1.567789
m | -5.309042 .475197 -11.17 0.000 -6.240411 -4.377673
ac | 2.054534 .1740643 11.80 0.000 1.713374 2.395694
am | 2.986014 .464678 6.43 0.000 2.075262 3.896767
cm | 2.847889 .1638394 17.38 0.000 2.52677 3.169009
_cons | 5.63342 .0597008 94.36 0.000 5.516409 5.750432
------------------------------------------------------------------------------
. poisson freq f v
Iteration 0: log likelihood = -30.953931
Iteration 1: log likelihood = -30.95387
Iteration 2: log likelihood = -30.95387
Poisson regression Number of obs = 4
LR chi2(2) = 72.24
Prob > chi2 = 0.0000
Log likelihood = -30.95387 Pseudo R2 = 0.5385
------------------------------------------------------------------------------
freq | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
f | -.0223473 .1057099 -0.21 0.833 -.2295349 .1848403
v | .9477894 .1177963 8.05 0.000 .7169129 1.178666
_cons | 3.923134 .1128342 34.77 0.000 3.701983 4.144285
------------------------------------------------------------------------------
. poisgof
Goodness-of-fit chi2 = 37.35134
Prob > chi2(1) = 0.0000
27
. loglink count f v,fit(f,v)
Variable f = A
Variable v = B
Margins fit: f,v
Note: Regression-like constraints are assumed. The first level of each
variable (and all iteractions with it) will be dropped from estimation.
Iteration 0: Log Likelihood = -32.40625
Iteration 1: Log Likelihood = -30.961304
Iteration 2: Log Likelihood = -30.953735
Poissok regression Number of obs = 4
Goodness-of-fit chi2(1) = 37.351 Model chi2(2) = 72.238
Prob > chi2 = 0.0000 Prob > chi2 = 0.0000
Log Likelihood = -30.954 Pseudo R2 = 0.5385
------------------------------------------------------------------------------
count | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
A2 | .0223473 .1057099 0.21 0.833 -.1848403 .2295349
B2 | -.9477896 .1177963 -8.05 0.000 -1.178666 -.7169131
_cons | 4.848577 .0820511 59.09 0.000 4.687759 5.009394
------------------------------------------------------------------------------
. poisson freq
Iteration 0: log likelihood = -67.07269
Iteration 1: log likelihood = -67.07269
Poisson regression Number of obs = 4
LR chi2(0) = 0.00
Prob > chi2 = .
Log likelihood = -67.07269 Pseudo R2 = 0.0000
------------------------------------------------------------------------------
freq | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_cons | 4.494239 .0528516 85.03 0.000 4.390651 4.597826
------------------------------------------------------------------------------
. poisgof
Goodness-of-fit chi2 = 109.589
Prob > chi2(3) = 0.0000
28
. loglink count f v,fit()
Note: Only the grand mean will be fit (one poissok parameter
for all cells).
Variable f = A
Variable v = B
Margins fit: Grand mean only
Note: Regression-like constraints are assumed. The first level of each
variable (and all iteractions with it) will be dropped from estimation.
Iteration 0: Log Likelihood = -71.706665
Iteration 1: Log Likelihood = -67.097046
Iteration 2: Log Likelihood = -67.07251
Iteration 3: Log Likelihood = -67.072632
Poissok regression Number of obs = 4
Goodness-of-fit chi2(3) = 109.589 Model chi2(0) = 0.000
Prob > chi2 = 0.0000 Prob > chi2 = .
Log Likelihood = -67.073 Pseudo R2 = 0.0000
------------------------------------------------------------------------------
count | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_cons | 4.494239 .0528516 85.03 0.000 4.390651 4.597826
------------------------------------------------------------------------------
. poisson freq v
Iteration 0: log likelihood = -30.976278
Iteration 1: log likelihood = -30.976217
Iteration 2: log likelihood = -30.976217
Poisson regression Number of obs = 4
LR chi2(1) = 72.19
Prob > chi2 = 0.0000
Log likelihood = -30.976217 Pseudo R2 = 0.5382
------------------------------------------------------------------------------
freq | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
v | .9477894 .1177963 8.05 0.000 .7169129 1.178666
_cons | 3.912023 .1 39.12 0.000 3.716027 4.108019
------------------------------------------------------------------------------
. poisgof
Goodness-of-fit chi2 = 37.39604
Prob > chi2(2) = 0.0000
29
. loglink count v,fit(v)
Variable v = A
Margins fit: v
Note: Regression-like constraints are assumed. The first level of each
variable (and all iteractions with it) will be dropped from estimation.
Iteration 0: Log Likelihood = -32.202637
Iteration 1: Log Likelihood = -30.981812
Iteration 2: Log Likelihood = -30.976074
Poissok regression Number of obs = 4
Goodness-of-fit chi2(2) = 37.396 Model chi2(1) = 72.193
Prob > chi2 = 0.0000 Prob > chi2 = 0.0000
Log Likelihood = -30.976 Pseudo R2 = 0.5382
------------------------------------------------------------------------------
count | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
A2 | -.9477894 .1177963 -8.05 0.000 -1.178666 -.7169129
_cons | 4.859812 .0622573 78.06 0.000 4.73779 4.981835
------------------------------------------------------------------------------
. poisson freq f
Iteration 0: log likelihood = -67.050344
Iteration 1: log likelihood = -67.050344
Poisson regression Number of obs = 4
LR chi2(1) = 0.04
Prob > chi2 = 0.8326
Log likelihood = -67.050344 Pseudo R2 = 0.0003
------------------------------------------------------------------------------
freq | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
f | -.0223473 .1057099 -0.21 0.833 -.2295349 .1848403
_cons | 4.50535 .0743294 60.61 0.000 4.359667 4.651033
------------------------------------------------------------------------------
. poisgof
Goodness-of-fit chi2 = 109.5443
Prob > chi2(2) = 0.0000
30
loglink count f,fit(f)
Variable f = A
Margins fit: f
Note: Regression-like constraints are assumed. The first level of each
variable (and all iteractions with it) will be dropped from estimation.
Iteration 0: Log Likelihood = -75.789795
Iteration 1: Log Likelihood = -67.196167
Iteration 2: Log Likelihood = -67.050293
Iteration 3: Log Likelihood = -67.050171
Poissok regression Number of obs = 4
Goodness-of-fit chi2(2) = 109.544 Model chi2(1) = 0.045
Prob > chi2 = 0.0000 Prob > chi2 = 0.8321
Log Likelihood = -67.050 Pseudo R2 = 0.0003
------------------------------------------------------------------------------
count | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
A2 | .0223472 .1057099 0.21 0.833 -.1848403 .2295348
_cons | 4.483003 .0751646 59.64 0.000 4.335683 4.630323
------------------------------------------------------------------------------
����"�:"����� �#��=��>��CC�F�������D���������>��G�����
α==== )],|1([log kzixyPit
xz
ik
z
k
y
j
x
iijk λλλλλµ ++++=log
x
ikzixyPit βα +==== )],|1([logyz
jk
xz
ik
xy
ij
z
k
y
j
x
iijk λλλλλλλµ ++++++=log
31
z
kkzixyPit βα +==== )],|1([log
yz
jk
xz
ik
z
k
y
j
x
iijk λλλλλλµ +++++=log
z
k
x
ikzixyPit ββα ++==== )],|1([log
xz
ik
xy
ij
z
k
y
j
x
iijk λλλλλλµ +++++=log
. list x y z count
+-------------------+
| x y z count |
|-------------------|
1. | 1 1 1 19 |
2. | 1 0 1 132 |
3. | 0 1 1 0 |
4. | 0 0 1 9 |
5. | 1 1 0 11 |
|-------------------|
6. | 1 0 0 52 |
7. | 0 1 0 6 |
8. | 0 0 0 97 |
+-------------------+
�"��#�� ����"�:"����� �#��=��>��CC�F�������D���������>��G����������=!r�ED���!H���> (death penalty: y) �ED����� ��D�� (victim’s race: z) ���GH���� (dependant’s race :x)
32
. logit y [fw=count]
Iteration 0: log likelihood = -113.2564
Logit estimates Number of obs = 326
LR chi2(0) = -0.00
Prob > chi2 = .
Log likelihood = -113.2564 Pseudo R2 = -0.0000
------------------------------------------------------------------------------
y | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_cons | -2.086362 .176709 -11.81 0.000 -2.432705 -1.740019
------------------------------------------------------------------------------
. poisson count x y z xz
Iteration 0: log likelihood = -23.214349
Iteration 1: log likelihood = -21.916918
Iteration 2: log likelihood = -21.906601
Iteration 3: log likelihood = -21.906596
Iteration 4: log likelihood = -21.906596
Poisson regression Number of obs = 8
LR chi2(4) = 387.78
Prob > chi2 = 0.0000
Log likelihood = -21.906596 Pseudo R2 = 0.8985
------------------------------------------------------------------------------
count | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
x | -.4915943 .159943 -3.07 0.002 -.8050767 -.1781118
y | -2.086362 .176709 -11.81 0.000 -2.432705 -1.740019
z | -2.437504 .3475915 -7.01 0.000 -3.118771 -1.756238
xz | 3.31165 .3785702 8.75 0.000 2.569666 4.053633
_cons | 4.517713 .1004466 44.98 0.000 4.320841 4.714584
------------------------------------------------------------------------------
. logit y x [fw=count], nolog
Logit estimates Number of obs = 326
LR chi2(1) = 6.25
Prob > chi2 = 0.0124
Log likelihood = -110.13154 Pseudo R2 = 0.0276
------------------------------------------------------------------------------
y | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
x | 1.057941 .4635394 2.28 0.022 .1494208 1.966462
_cons | -2.87168 .4196435 -6.84 0.000 -3.694166 -2.049194
------------------------------------------------------------------------------
. poisson count x y z xy xz
Iteration 0: log likelihood = -21.803449
…
Poisson regression Number of obs = 8
LR chi2(5) = 394.03
Prob > chi2 = 0.0000
Log likelihood = -18.781739 Pseudo R2 = 0.9130
------------------------------------------------------------------------------
count | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
x | -.5875747 .1638567 -3.59 0.000 -.908728 -.2664214
y | -2.87168 .4196435 -6.84 0.000 -3.694166 -2.049194
z | -2.437504 .3475915 -7.01 0.000 -3.118771 -1.756238
xy | 1.057941 .4635394 2.28 0.022 .1494208 1.966462
xz | 3.31165 .3785702 8.75 0.000 2.569666 4.053633
_cons | 4.579669 .101065 45.31 0.000 4.381586 4.777753
------------------------------------------------------------------------------
33
. logit y z [fw=count], nolog
Logit estimates Number of obs = 326
LR chi2(1) = 0.22
Prob > chi2 = 0.6379
Log likelihood = -113.14567 Pseudo R2 = 0.0010
------------------------------------------------------------------------------
y | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
z | .1664121 .3539187 0.47 0.638 -.5272558 .8600799
_cons | -2.170733 .2559976 -8.48 0.000 -2.672479 -1.668987
------------------------------------------------------------------------------
. poisson count x y z yz xz
Iteration 0: log likelihood = -23.053495
…
Poisson regression Number of obs = 8
LR chi2(5) = 388.01
Prob > chi2 = 0.0000
Log likelihood = -21.795871 Pseudo R2 = 0.8990
------------------------------------------------------------------------------
count | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
x | -.4915943 .159943 -3.07 0.002 -.8050767 -.1781118
y | -2.170733 .2559979 -8.48 0.000 -2.67248 -1.668986
z | -2.455877 .3497847 -7.02 0.000 -3.141442 -1.770311
yz | .1664121 .3539191 0.47 0.638 -.5272566 .8600807
xz | 3.31165 .3785702 8.75 0.000 2.569666 4.053633
_cons | 4.526688 .101961 44.40 0.000 4.326848 4.726527
------------------------------------------------------------------------------
. logit y x z [fw=count]
Iteration 0: log likelihood = -113.2564
…
Logit estimates Number of obs = 326
LR chi2(2) = 7.43
Prob > chi2 = 0.0243
Log likelihood = -109.54096 Pseudo R2 = 0.0328
------------------------------------------------------------------------------
y | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
x | 1.324213 .5193463 2.55 0.011 .3063128 2.342113
z | -.4402222 .4008893 -1.10 0.272 -1.225951 .3455064
_cons | -2.842105 .4203379 -6.76 0.000 -3.665952 -2.018258
------------------------------------------------------------------------------
. poisson count x y z xz xy yz
Iteration 0: log likelihood = -21.72128
Poisson regression Number of obs = 8
LR chi2(6) = 395.21
Prob > chi2 = 0.0000
Log likelihood = -18.191161 Pseudo R2 = 0.9157
------------------------------------------------------------------------------
count | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
x | -.6331008 .1714027 -3.69 0.000 -.969044 -.2971577
y | -2.842105 .4203379 -6.76 0.000 -3.665952 -2.018258
z | -2.417691 .3480023 -6.95 0.000 -3.099763 -1.735619
xz | 3.357995 .3819713 8.79 0.000 2.609345 4.106645
xy | 1.324213 .5193463 2.55 0.011 .3063128 2.342113
yz | -.4402222 .4008893 -1.10 0.272 -1.225951 .3455064
_cons | 4.578062 .1012175 45.23 0.000 4.37968 4.776445
------------------------------------------------------------------------------
34
��(V&� '( odds ratio. logit y x z [fw=count],or
Logit estimates Number of obs = 326
LR chi2(2) = 7.43
Prob > chi2 = 0.0243
Log likelihood = -109.54096 Pseudo R2 = 0.0328
------------------------------------------------------------------------------
y | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
x | 3.759225 1.95234 2.55 0.011 1.358407 10.40319
z | .6438933 .25813 -1.10 0.272 .2934785 1.412705
------------------------------------------------------------------------------
. poisson count x y z xz xy yz,irr
Poisson regression Number of obs = 8
LR chi2(6) = 395.21
Prob > chi2 = 0.0000
Log likelihood = -18.191161 Pseudo R2 = 0.9157
------------------------------------------------------------------------------
count | IRR Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
x | .5309429 .0910051 -3.69 0.000 .3794456 .7429269
y | .0583028 .0245069 -6.76 0.000 .0255798 .1328867
z | .0891272 .0310165 -6.95 0.000 .0450599 .176291
xz | 28.73154 10.97462 8.79 0.000 13.59015 60.74261
xy | 3.759225 1.95234 2.55 0.011 1.358407 10.40319
yz | .6438933 .25813 -1.10 0.272 .2934785 1.412705