150 likes | 162 Views
Learn about indicator variables and regression models with varying intercepts and slopes for two or three categories, plus testing hypotheses of equality. Understand how to apply these concepts in statistical analysis.
E N D
Indicator variable for two categories • Two categories, A and B(not A) • Define an indicator variable • Ai = 1 for members of category A • Ai = 0 otherwise
Regression model with different intercepts for two categories • Consider the regression model yi = b0+ b1 xi+ d0 Ai+ ei • For Ai = 0 yi = b0+ b1 xi+ ei • ForAi = 1 yi =(b0+ d0 ) + b1 xi+ ei • Difference between the two intercepts, d0 • Test if the two intercepts are the same • H0: d0 = 0
Regression model with different intercepts and Slopes yi = b0+ b1 xi+ d0 Ai+ d1 Ai xi+ ei • For Ai = 0 yi = b0+ b1 xi+ ei • ForAi = 1 yi =(b0+ d0 ) + (b1 + d1 ) xi+ ei • Difference between the two intercepts, d0 • Difference between the two slopes, d1 • Test if the two regression lines are the same • H0: d0 = d1 = 0 (Partial F)
Indicator variables for three categories • Three categories, A, B, and C • Define two indicator variables • Ai = 1 for members of category A • Ai = 0 otherwise • Bi = 1 for members of category B • Bi = 0 otherwise • Members of category C are coded as • Ai = 0 (not A) and Bi = 0 (not B) • C is the base category
Indicator variables for all categories • Three categories, A, B, and C • Ai = 1 for members of category A • Ai = 0 otherwise • Bi = 1 for members of category B • Bi = 0 otherwise • Ci = 1 for members of category C • Ci = 0 otherwise • Note that A + B = C = 1, hence a linear dependency if there is an intercept
Different intercepts for three categories yi = b0+b1 xi+d10 Ai+ d20 Bi+ ei • For Ai = 0 (not A) and Ai = 0 (not B) yi = b0+b1 xi+ ei • ForAi = 1 (A) and Bi = 0 (not B) yi =(b0+ d10 ) +b1 xi+ ei • Difference between the intercepts for A and C, d10
Different intercepts for three categories yi = b0+ b1 xi+ d01 Ai+ d02 Bi+ ei • For Ai = 0 (not A)andBi = 1 (B) yi =(b0+ d20 ) +b1 xi+ ei • Difference between the intercepts for B and C, d02 • Test if the three intercepts are the same • H0: d01 = d02= 0 • Partial F
Different intercepts and slopes for three categories yi = b0+ b1 xi + d01 Ai +d02 Bi + d11 Ai xi+ d12 Bi xi+ ei • For Ai = 0 (not A) and Bi = 0 (not B) yi = b0+ b1 xi+ ei
Categories A and C yi = b0+ b1 xi + d01 Ai +d02 Bi + d11 Ai xi+ d12 Bi xi+ ei • ForAi = 1 (A) and Bi = 0 (not B) yi =(b0+ d10 ) + (b1 + d11 ) xi+ ei • Difference between the intercepts for A and C, d10 • Difference between the slopes A and C, d11
Group B and C yi = b0+ b1 xi + d01 Ai +d02 Bi + d11 Ai xi+ d12 Bi xi+ ei • ForAi = 0 (not A) and Bi = 1 (B) yi =(b0+d02) + (b1 +d12 ) xi+ ei • Difference between the intercepts for A and C, d0 2 • d12, Difference between the slopes for A and C
Test for the same linear relationship yi = b0+ b1 xi + d01 Ai +d02 Bi + d11 Ai xi+ d12 Bi xi+ ei • For Ai = 0 (not A) and Bi = 0 (not B) yi = b0+ b1 xi+ ei • Test if the three regression lines are the same • H0: d01 = d02=d11 = d12 = 0 • Partial F
Seasonality in time series • Indicator variables for the four seasons • W = 1 if winter, = 0, otherwise • SP = 1 if spring, = 0, otherwise • SU = 1 if summer, = 0, otherwise • Fall is given by W = 0, SP = 0, SU = 0 • Indicator variables for months (11 variables) • Jan = 1 if January, = 0, otherwise • etc.
An alternative coding scheme • Two categories, A and B(not A) • Define a variable • Ai = 1 for members of category A • Ai = -1 otherwise
Regression model with different intercepts and Slopes yi = b0+ b1 xi+ q0 Ai+ q1 Ai xi+ ei • ForAi = 1 yi =(b0+q0 ) + (b1 +q1 ) xi+ ei • For Ai = -1 yi = (b0-q0 ) + (b1 -q1 )xi+ ei • “average” intercept b0 • “average” slope, b1 • Intercept deviation for each category, q0 • Slope deviation for each category, q1
Regression model with different intercepts and Slopes • Hypothesis of equality of slopes for two categories, H0: q1 = 0 • Hypothesis of equality of intercepts for two categories, H0: q0 = 0 • Hypothesis of the same regression line for two categories • H0: q0 = q1 = 0 (Partial F)