# Meaning of p-values for an interaction between a categorical variable (w/ >2 cats) & continuous variable

I have a question about the meaning of the p-values when testing an interaction between a continuous and a categorical variable (with more than 2 categories).

When I do that in a glm model using R, I obtain a p-value for each class of the categorical variable vs. continuous one. However, I would like to get the p-value for the interaction itself using R, and to understand what the meaning of this p-value is.

An example of the code and results:

model_glm3=glm(cog~lg_hag+race+pdg+sex+as.factor(educa)+(lg_hag:as.factor(educa)),
data=base_708)

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept)               21.4836     2.0698  10.380  < 2e-16 ***
lg_hag                     8.5691     3.7688   2.274  0.02334 *
raceblack                 -8.4715     1.7482  -4.846 1.61e-06 ***
racemexican               -3.0483     1.7073  -1.785  0.07469 .
racemulti/other           -4.6002     2.3098  -1.992  0.04687 *
pdg                        2.8038     0.4268   6.570 1.10e-10 ***
sexfemale                  4.5691     1.1203   4.078 5.15e-05 ***
as.factor(educa)2         13.8266     2.6362   5.245 2.17e-07 ***
as.factor(educa)3         21.7913     2.4424   8.922  < 2e-16 ***
as.factor(educa)4         19.0179     2.5219   7.541 1.74e-13 ***
as.factor(educa)5         23.7470     2.7406   8.665  < 2e-16 ***
lg_hag:as.factor(educa)2 -21.2224     6.5904  -3.220  0.00135 **
lg_hag:as.factor(educa)3 -19.8083     6.1255  -3.234  0.00129 **
lg_hag:as.factor(educa)4  -8.5502     6.6018  -1.295  0.19577
lg_hag:as.factor(educa)5 -17.2230     6.3711  -2.703  0.00706 **


I would like to have the p-value of the interaction and its meaning (i.e., just one p-value for the whole interaction, not one for each category)

The general way to do this is with a full-reduced model test using the anova function. Refit your model without the interaction of interest (the update function can be convenient for this) then run the anova function on the full and reduced models, for a glm fit you probably want to include test="Chisq".

Something like:

model_glm3_reduced <- update( model_glm3, .~. - lg_hag:as.factor(educa) )
anova( model_glm3_reduced, model_glm3, test="Chisq" )


Here the null hypothesis is that the 2 models fit equally well (any differences due to chance) and the alternative is that the full model contains at least one term that is an improvement in the fit. Since the difference in the 2 models is only the interaction term, this gives a single test (p-value) for testing the entire interaction.

• I think you are advising the OP on how to test for an interaction appropriately. I took the question on face value and assumed that he just wanted to interpret the p-values in the table for the model and might be puzzled by the symbols to the right of the p-value in the table. – Michael R. Chernick Oct 4 '12 at 17:00
• Hi Greg,Thank you very much for the information, that is the answer i wanted, i did that. I just want to know now if this p value of the anova between my two models could be used to say that the p-value of the interaction is this xxx – You Safe Oct 4 '12 at 17:09
• @YouSafe, Yes (provided that the only difference between the 2 models is the interaction term) you can quote the p-value as a test of that interaction. – Greg Snow Oct 4 '12 at 17:32
• I deleted my answer. Despite the unclear statement Greg apparently understood and gave the answer the OP was looking for. A big +1 for your psychic powers @GregSnow. – Michael R. Chernick Oct 4 '12 at 19:47
• I asked my attempt at an esp package (very pre-alpha) if I should claim to be psychic or not, the response: "negate clothesline loaves French parking boondoggle". – Greg Snow Oct 5 '12 at 16:23