Inconsistent b0 in linear regression between Jamovi and R

Discuss statistics related things

by joseluisblues » Wed Mar 13, 2019 9:29 pm

Hi,

I was comparing Jamovi with R and I find a striking difference of the intercept when I do a linear model,
Say I have:

"Picture",30
"Picture",35
"Picture",45
"Picture",40
"Picture",50
"Picture",35
"Picture",55
"Picture",25
"Picture",30
"Picture",45
"Picture",40
"Picture",50
"Real Spider",40
"Real Spider",35
"Real Spider",50
"Real Spider",55
"Real Spider",65
"Real Spider",55
"Real Spider",50
"Real Spider",35
"Real Spider",30
"Real Spider",50
"Real Spider",60
"Real Spider",39

Jamovi is giving me:

Predictor Estimate SE t p
Intercept 43.50 2.08 20.90 < .001
Group:
Real Spider – Picture 7.00 4.16 1.68 0.107

But R,
With:

m1 <- lm(Anxiety ~ Group, data=spiderLong)
summary(m1)

R version 3.5.0 (2018-04-23) -- "Joy in Playing"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

> m1 <- lm(Anxiety ~ Group, data=spiderLong)
> summary(m1)

Call:
lm(formula = Anxiety ~ Group, data = spiderLong)

Residuals:
Min 1Q Median 3Q Max
-17.0 -8.5 1.5 8.0 18.0

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 40.000 2.944 13.587 3.53e-12 ***
GroupReal Spider 7.000 4.163 1.681 0.107
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 10.2 on 22 degrees of freedom
Multiple R-squared: 0.1139, Adjusted R-squared: 0.07359
F-statistic: 2.827 on 1 and 22 DF, p-value: 0.1068

Why the intercept is giving 40 in one case and 43.5 in the other??

Thanks for any hint!

José
joseluisblues
 
Posts: 2
Joined: Wed Mar 13, 2019 8:30 pm

by jonathon » Wed Mar 13, 2019 11:40 pm

hi,

it's possible there are some options different between your local R, and jamovi.

`options('contrasts')` seems like a likely candidate.

let me know what you find.

cheers

jonathon
User avatar
jonathon
 
Posts: 773
Joined: Fri Jan 27, 2017 10:04 am

by MAgojam » Thu Mar 14, 2019 11:35 pm

Hi, @jonathon.
I tried the example of @joseluisblues, with regress in Stata v15.1 which replicates the same results as lm in R.
It seems that in jamovi, jmv::linReg returns the intercept of the null model (without covariates), ignoring DV factor.
I am attaching a screenshot of the Stata output.
ScreenShot_LR.png
ScreenShot_LR.png (170.32 KiB) Viewed 314 times

Cheers.
Maurizio
Last edited by MAgojam on Sat Mar 16, 2019 12:23 pm, edited 1 time in total.
User avatar
MAgojam
 
Posts: 44
Joined: Thu Jun 08, 2017 2:33 pm
Location: Parma (Italy)

by jonathon » Fri Mar 15, 2019 1:24 am

oh righto. i'll attend ravi to this thread.

cheers

jonathon
User avatar
jonathon
 
Posts: 773
Joined: Fri Jan 27, 2017 10:04 am

by joseluisblues » Sun Mar 17, 2019 9:09 pm

Hey, great, thanks to both of you,
So, this a bug in the function that should be fixed, or there is parameter that I can change?

cheers,
joseluisblues
 
Posts: 2
Joined: Wed Mar 13, 2019 8:30 pm

by Ravi » Sun Mar 17, 2019 9:17 pm

So I checked what's going on here, and it has to do with how we set up contrasts (so no bug). At the moment we set up contrasts in such a way that the intercept represents the grand mean. Not sure anymore why we did it this way though, have to look into this a bit more before deciding whether we should change it.
User avatar
Ravi
 
Posts: 139
Joined: Sat Jan 28, 2017 11:18 am


Return to Statistics