1

I have: model6 = get_model(formula="log(Y_star)~X_1_star*X_3_star", df=df)

Model summary gives me:

Coefficients:
                    Estimate Std. Error t value Pr(>|t|)    
(Intercept)       -1.049e+01  3.724e-01 -28.182  < 2e-16 ***
X_1_star           3.082e-08  7.517e-09   4.100 8.44e-05 ***
X_3_star           3.482e-07  8.708e-08   3.999 0.000122 ***
X_1_star:X_3_star -6.716e-15  7.822e-16  -8.587 1.22e-13 ***

Why is it giving me coefficients for X_1_star and X_3_star separately when they are not in the formula?

My formula is not Y = b_0 + b_1*X_1_star + b_2*X_3_star + b_3*X_1_star*X_3_star

Phil
  • 7,287
  • 3
  • 36
  • 66
NoName
  • 9,824
  • 5
  • 32
  • 52

1 Answers1

2

According to ?formula

The * operator denotes factor crossing: a*b interpreted as a+b+a:b

Based on the comment, if we want only interaction, then use a different symbol

The terms themselves consist of variable and factor names separated by : operators. Such a term is interpreted as the interaction of all the variables and factors appearing in the term.

akrun
  • 874,273
  • 37
  • 540
  • 662