I am fitting a dataframe with the linear regression model that includes interaction:

lm0 <- lm(Mean_RT ~ POS*Length, data = df)

The output of summary() function is:

             Estimate Std. Error t value Pr(>|t|)    
(Intercept)   582.040     16.701  34.851   <2e-16 ***
POSVB         -55.523     33.810  -1.642    0.101    
Length         25.064      1.958  12.803   <2e-16 ***
POSVB:Length    4.147      4.131   1.004    0.316    

I don't understand why it just uses POSVB and not POSNN (and POSNN:Length) in the coefficients?

The dataframe:

enter image description here


It is accounting for POSNN. Consider the equation that you (i.e. R) constructed:

$y_i = \beta_0 + \text{POS}_i\times \beta_1 + \text{Length}_i\times \beta_2 + \text{POS}_i\times \text{Length}_i\times \beta_3$

Where $\text{POS}_i$ may take values 0 (NN) and 1 (VB) by the way R converts factors into dummy-coded binary predictors. Length, presumably, can take some positive real-valued number.

Should you have a NN item, then the equation simplifies to $y_i = \beta_0 + \text{Length}\times \beta_2$. Therefore, we have the effect of NN (just the intercept) in interaction with $\text{Length}$. You need estimated coefficients $\beta_0$ and $\beta_2$. There's no $\text{POS}_i\times \text{Length}_i$ for $\text{POS}_i=0$ because this would just be 0.

Should you have an VB item, then you need estimated coefficients $\beta_0$, $\beta_1$, $\beta_2$, and $\beta_3$ (since $\text{POS}_i$ will be 1).

  • $\begingroup$ Thanks! Makes sense. $\endgroup$ – user3639557 Feb 21 at 22:34
  • 2
    $\begingroup$ Great! I'm pretty sure there are many similar questions on dummy-coded variables in regressions on this SE, consider searching if you'd like other answers. $\endgroup$ – Alex L Feb 21 at 22:39
  • $\begingroup$ what would happen if the factor could take three values? I assume it is no longer binary coded? Basically imagine $POS_i$ could take another value like DD. What would be the corresponding $y_i$ for DD? Assuming NN is still 0, and VB is 1. $\endgroup$ – user3639557 Feb 21 at 23:03
  • $\begingroup$ @user3639557 good question, simple answer. There are a lot of resources on regression, and almost any stats textbook will answer your questions. Here's one arbitrary (but seemingly decent) resource I found. $\endgroup$ – Alex L Feb 22 at 0:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.