Linear regression results depend on type of interaction term

Discuss statistics related things
Post Reply
bgodde
Posts: 2
Joined: Thu Mar 04, 2021 10:02 am

Linear regression results depend on type of interaction term

Post by bgodde »

Hello,

I know that it makes a difference for the main effects in linear regression whether you center or not the predictors for calculating the interaction term. But how does the Linear Regression module in Jamovi does it when you don't enter those pre-computed interaction terms but in the model specification you add the 2-way interaction (and center/not center) the variables?

I have a design with a dummy coded factorial variable F and two continuous predictors X1,X2 (plus some covariates). Now I get all different results with the main effect for the factor once significant and once not when I:
a. include the pre-computed interaction terms F*x1 and F*x2
b. include the pre-computed interaction terms with centered x1,x2
c. Let the program do it and define the interaction in the model specification (centered).

Also, all 3 result also differ from SPSS (pre-computed interaction term - non centered), but as expected option a is closest.

FInally, doing it with lm() in R directly, also the results differ agian.

So, I am a bit confused how to do it correctly?? Any suggestions?

Thanks, Ben
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: Linear regression results depend on type of interaction

Post by jonathon »

it's hard to comment without seeing specifics. it also matters where you're seeing differences. in SPSS, for example, if you fit a univariate model, it will give you two tables, an ANOVA table and a parameter estimates table. you'd think these are from a single model, but SPSS actually fits two different models, and displays results from each. plenty of people have gone nuts (myself included) trying get the results to match between SPSS and <other statistical software>.

you can have a noodle through the source code for the jamovi lin reg here though:

https://github.com/jamovi/jmv/blob/master/R/linreg.b.R#L163-L179

cheers

jonathon
Post Reply