Download presentation
Presentation is loading. Please wait.
Published byAndrea Wiggins Modified over 8 years ago
1
Log-linear Models Please read Chapter Two
2
We are interested in relationships between variables White VictimBlack Victim White Prisoner151 (151/160=0.94) 9 Black Prisoner 63 (63/166=0.40) 103
3
Pearson Chi-square test of Independence Based on P(A,B) = P(A) P(B) p 11 p 12 p 13 p 14 p 1+ p 21 p 22 p 23 p 24 p 2+ p +1 p +2 p +3 p +4 p ++ = 1 x 11 x 12 x 13 x 14 x 1+ x 21 x 22 x 23 x 24 x 2+ x +1 x +2 x +3 x +4 x ++ = N Under H 0 of independence, p ij = p i+ p +j
4
Computing the Pearson chisquare test of independence Calculate (estimated) expected frequencies Calculate For large samples, has an approximate Chisquare distribution if H 0 is true Degrees of freedom (I-1)(J-1)
5
Numerical example of Pearson chisquare White Victim Black Victim Total White Prisoner 151 (105) 9 (55) 160 Black Prisoner 63 (109) 103 (57) 166 Total214112326
6
With R
7
Conclusions X 2 = 115, df = (2-1) (2-1) = 1 Critical value at alpha = 0.05 is 3.84 Reject H 0 Conclude race of prisoner and race of victim are not independent. That’s not good enough! Murder victims and the persons convicted of murdering them tend to be of the same race. (Say what happened!)
8
Two treatments for Kidney Stones Treatment ATreatment B Effective273289 Ineffective7761 X 2 = 2.3106, df = 1, p = 0.1285 These results are consistent with no difference in effectiveness between treatments.
9
All this applies to the multinomial, but there are 3 main sampling models Multinomial Poisson Product Multinomial Fortunately, the same statistical methods work with all.
10
Poisson Independent Poisson processes generate the counts in each category (for ex., traffic accidents). In homework you proved that conditionally upon the total number of events, the joint distribution of the counts is multinomial. Justifies use of multinomial theory But in hard cases, Poisson probability calculations can be easier.
11
Product multinomial Take independent random samples of sizes N 1, N 2, …, N I from I sub-populations. In each, observe a multinomial with J categories. Compare. Examples: Vitamin C study, Kidney stone study. Likelihood: A product of I multinomial likelihoods, because of independent sampling from sub-populations. This is almost always the right model for experimental studies.
12
Suppose the null hypothesis is no differences among the I vectors of multinomial probabilities Then under H 0, the MLE of the (common) p j is the sample proportion, pooling data across the I rows: x +j /N. And the expected cell frequency is x 11 x 12 x 13 x 14 x 1+ = N 1 x 21 x 22 x 23 x 24 x 2+ = N 2 x +1 x +2 x +3 x +4 x ++ = N Same as for the usual chisquare test of independence
13
So let’s concentrate on the multinomial
14
Assume a multinomial and test independence? Messy! p1p1 p2p2 p 1 +p 2 p3p3 p4p4 p 3 +p 4 p 1 +p 3 p 2 +p 4
15
Log-linear models Linear model for the (natural) logs of the expected frequencies Looks like ANOVA notation (STA332) First, one-factor (not in the text) Then two-factor (in the text) Start with the familiar normal example, testing for differences among means.
16
Compare 3 means Grand Mean Effects are deviations from the grand mean –
17
Single categorical variable, k categories Linear model for log of expected frequencies No probability can equal zero!
18
This is a Re-Parameterization Substitute into likelihood function and do maximum likelihood How many parameters, k or k-1?
19
There are still k-1 parameters All “effects” zero corresponds to equal probabilities
20
Maximum Likelihood
21
Log Likelihood
22
k = 3 Categories Numerical MLE
23
Remember the employment study? 106 Employed in a job related to field of study 74 Employed in a job unrelated to their field of study 20 Unemployed Use R to –Estimate the effects –Test equal probabilities (senseless)
24
Generic MLE with R
27
Estimate the probabilities and test
28
This seems like a lot of trouble just to estimate some probabilities and test if they are equal. But the payoff comes for tables of two or more dimensions.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.