Joyful mood is a meritorious deed that cheers

  • Slides: 21
Download presentation
Joyful mood is a meritorious deed that cheers up people around you like the

Joyful mood is a meritorious deed that cheers up people around you like the showering of cool spring breeze. 1

Categorical Data Analysis Chapter 8: Loglinear Models for Contingency Tables (SAS: Chapter 12)

Categorical Data Analysis Chapter 8: Loglinear Models for Contingency Tables (SAS: Chapter 12)

Loglinear vs. Logit Models • Loglinear models treat categorical variables equally, focusing on associations

Loglinear vs. Logit Models • Loglinear models treat categorical variables equally, focusing on associations and interactions in their joint distribution. • Logit models, by contrast, describe how a single categorical variable (response) depends on other (explanatory) variables. 3

Distributions/Models for Categorical Data • Binomial data (logit models) PROC LOGISTIC • When the

Distributions/Models for Categorical Data • Binomial data (logit models) PROC LOGISTIC • When the sample size n is fixed and the response per subject is binary • Use logit models; sas link is logit • Multinomial data (general logit models) PROC LOGISTIC • When the sample size n is fixed and the response per subject is multinary • Use base-category logit models (sas link: glogit) for nominal response; use culmulative logit models/proportional odds models (sas link: clogit) • Poisson data (loglinear models) PROC GENMOD • When the sample size n is not fixed and the response per subject is binary/multinary • A Poisson model conditioned on a given n is a Binomial/ Multinomial model (Sec. 1. 2. 5) 4

Example: Z = Sex Partial table Response Sex Treatment Died Lived Men Standard 950

Example: Z = Sex Partial table Response Sex Treatment Died Lived Men Standard 950 50 New 9000 1000 Standard 5000 New 5 95 Standard 5950 5050 New 9005 1095 Women Total Marginal table 5

What Models to Use • If the row totals are pre-fixed (prospective study): Can

What Models to Use • If the row totals are pre-fixed (prospective study): Can only study the column (response) distribution for a given row (factors) • Bi- or multi-nomial data (logit models) If the grand total is pre-fixed (prospective study): • Can study the joint distribution of response and factors (all variables) • Can be treated as bi- or multi-nomial data (logit models) • • • If nothing is pre-fixed/ totally observational (respective study): • Can study the joint distribution of response and factors (all variables) • Poisson data/ loglinear models 6

Loglinear Models for Counts • Poisson counts: count ~ Poisson(u) • Qualitative factors: X,

Loglinear Models for Counts • Poisson counts: count ~ Poisson(u) • Qualitative factors: X, Y, … • Saturated Model: As usual, the baseline (last level) effects are set as 0 for each term 7

Independence Model • No interaction effect between X and Y on counts; that is,

Independence Model • No interaction effect between X and Y on counts; that is, X and Y are independent As usual, the baseline effects are set as 0 for each term 8

Interpretation of Parameters • The effect of factor on log(odds) is: For Ix 2

Interpretation of Parameters • The effect of factor on log(odds) is: For Ix 2 table, level i vs. baseline level I – Without XY term: – With XY term: 9

Associations in 3 -way Tables • Let Y be the response, X be the

Associations in 3 -way Tables • Let Y be the response, X be the major factor and Z be nuisance factor • The observed marginal association of X on Y might be simply due to the other factor Z • In general we cannot collapse a 3 -way table and interpret the 2 -way marginal table 10

Example: Z = Sex Partial table Response Sex Treatment Died Lived Men Standard 950

Example: Z = Sex Partial table Response Sex Treatment Died Lived Men Standard 950 50 New 9000 1000 Standard 5000 New 5 95 Standard 5950 5050 New 9005 1095 Women Total Marginal table 11

Type of Independence of X, Y Conditionally independent given Z Mutually independent with Z

Type of Independence of X, Y Conditionally independent given Z Mutually independent with Z Jointly independent of Z Marginally independent strong weak 12

Associations in 3 -way Tables Eg. 2 x 2 x. K tables • Conditional

Associations in 3 -way Tables Eg. 2 x 2 x. K tables • Conditional odds ratio • • Marginal odds ratio Marginal independence of X, Y: marginal X-Y odds ratios are all 1 Conditional independence of X, Y given Z: conditional X-Y odds ratios given Z are all 1; Homogeneous association of X, Y given Z: conditional X-Y odds ratios given Z are the same (no need to be 1) 13

Partial Association (Sec 2. 3) • The associations in partial tables are called “partial”

Partial Association (Sec 2. 3) • The associations in partial tables are called “partial” associations between X and Y given Z • They are measured by conditional odds ratios 14

Associations in 3 -way Tables • We need to condition on all important variables;

Associations in 3 -way Tables • We need to condition on all important variables; but it is not practical. • In randomized experiments this (confounding) problem is less likely to happen. • To study whether an association exists between a primary factor and the response variable AFTER controlling for other possibly confounding variables, such as – Different medical centers – Severity of Condition – Age 15

Loglinear Models for 3 -way Tables • Saturated (also full) model: Deviance is the

Loglinear Models for 3 -way Tables • Saturated (also full) model: Deviance is the Likelihood-Ratio test statistic of Ho: current model vs. H 1: saturated model; can be a measure of goodness of fit 16

Interpreting Model parameters • X: effect of X on (expected) counts • XY: the

Interpreting Model parameters • X: effect of X on (expected) counts • XY: the partial association between X and Y given Z • XYZ: significant XY depends on Z insignificant XY does not depend on Z 17

Interpreting Models Loglinear Model Symbol Interpretation (X, Y, Z) (Y, XZ) (XY, XZ) (YZ,

Interpreting Models Loglinear Model Symbol Interpretation (X, Y, Z) (Y, XZ) (XY, XZ) (YZ, XZ) (XY, YZ, XZ) (XYZ) 18

Inference for Loglinear Models • Goodness-of-fit tests • Residuals • Tests for partial associations

Inference for Loglinear Models • Goodness-of-fit tests • Residuals • Tests for partial associations • Confidence intervals for odds ratios 19

The Loglinear-Logit Connection • Using logit models to interpret loglinear models • Correspondence between

The Loglinear-Logit Connection • Using logit models to interpret loglinear models • Correspondence between loglinear and logit models Loglinear symbol (Y, XZ) Logit symbol (--) (XY, XZ) (XZ, YZ) (XY, YZ, XZ) (X+Z) (XYZ) (X*Z) 20

Connection with Logit Models • The loglinear model which corresponds to a logit model

Connection with Logit Models • The loglinear model which corresponds to a logit model is the one with the most general interaction among explanatory variables from the logit model. It has the same association and interaction structure relating the explanatory variables to the response. 21