Presentation is loading. Please wait.

Presentation is loading. Please wait.

Topic 17: Interaction Models. Interaction Models With several explanatory variables, we need to consider the possibility that the effect of one variable.

Similar presentations


Presentation on theme: "Topic 17: Interaction Models. Interaction Models With several explanatory variables, we need to consider the possibility that the effect of one variable."— Presentation transcript:

1 Topic 17: Interaction Models

2 Interaction Models With several explanatory variables, we need to consider the possibility that the effect of one variable depends on the value of another variable Special cases –One binary variable (Y/N) and one continuous variable –Two continuous variables

3 One binary variable and one continuous variable X 1 takes values 0 and 1 corresponding to two different groups X 2 is a continuous variable Model: Y = β 0 + β 1 X 1 + β 2 X 2 + β 3 X 1 X 2 + e When X 1 = 0 : Y = β 0 + β 2 X 2 + e When X 1 = 1 : Y = (β 0 + β 1 )+ (β 2 + β 3 ) X 2 + e

4 One binary and one continuous β 0 is the intercept for Group 1 β 0 + β 1 is the intercept for Group 2 Similar relationship for slopes (β 2 and β 3 ) H 0 : β 1 = β 3 = 0 tests the hypothesis that the regression lines are the same H 0 : β 1 = 0 tests equal intercepts H 0 : β 3 = 0 tests equal slopes

5 KNNL Example p316 Y is number of months for an insurance company to adopt an innovation X 1 is the size of the firm (a continuous variable X 2 is the type of firm (a qualitative or categorical variable)

6 The question X 2 takes the value 0 if it is a mutual fund firm and 1 if it is a stock fund firm We ask whether or not stock firms adopt the innovation slower or faster than mutual firms We ask the question across all firms, regardless of size

7 Plot the data symbol1 v=M i=sm70 c=black l=1; symbol2 v=S i=sm70 c=black l=3; proc sort data=a1; by stock size; proc gplot data=a1; plot months*size=stock; run;

8 Two symbols on plot

9 Interaction effects Interaction expresses the idea that the effect of one explanatory variable on the response depends on another explanatory variable In the KNNL example, this would mean that the slope of the line depends on the type of firm

10 Are both lines the same? From scatterplot, looks like different intercepts but can use the test statement for formal assessment Data a1; set a1; sizestock=size*stock; Proc reg data=a1; model months=size stock sizestock; test stock, sizestock; run;

11 Output Test 1 Results for Dependent Variable months SourceDF Mean SquareF ValuePr > F Numerator2158.1258414.340.0003 Denominator1611.02381 Reject H 0.There is a difference in the linear relationship across groups

12 Output How are they different? Parameter Estimates VariableDF Parameter Estimate Standard Errort ValuePr > |t| Intercept133.838372.4406513.86<.0001 size1-0.101530.01305-7.78<.0001 stock18.131253.654052.230.0408 sizestock1-0.000417140.01833-0.020.9821 1.No difference in slopes assuming different intercepts 2.Potentially different intercepts assuming different slopes

13 Two parallel lines? proc reg data=a1; model months=size stock; run;

14 Output Analysis of Variance SourceDF Sum of Squares Mean SquareF ValuePr > F Model21504.4133752.206672.50<.0001 Error17176.3866710.37569 Corrected Total191680.8000 Root MSE3.22113R-Square0.8951 Dependent Mean19.40000Adj R-Sq0.8827 Coeff Var16.60377

15 Output Int for stock firms is 33.87+8.05 = 41.92 Common slope is –0.10 Parameter Estimates VariableDF Parameter Estimate Standard Errort ValuePr > |t| Intercept133.874071.8138618.68<.0001 size1-0.101740.00889-11.44<.0001 stock18.055471.459115.52<.0001

16 Plot the two fitted lines symbol1 v=M i=rl c=black l=1; symbol2 v=S i=rl c=black l=3; proc gplot data=a1; plot months*size=stock; run;

17 The plot

18 Two continuous variables Y = β 0 + β 1 X 1 + β 2 X 2 + β 3 X 1 X 2 + e Can be rewritten as follows Y = β 0 + (β 1 + β 3 X 2 )X 1 + β 2 X 2 + e Y = β 0 + β 1 X 1 + (β 2 + β 3 X 1 ) X 2 + e The coefficient of one explanatory variable depends on the value of the other explanatory variable

19 Last slide We went over KNNL 8.2 – 8.7 We used programs Topic17.sas to generate the output for today


Download ppt "Topic 17: Interaction Models. Interaction Models With several explanatory variables, we need to consider the possibility that the effect of one variable."

Similar presentations


Ads by Google