lm contrast coding

General help and assistance with jamovi. Bug reports can be made at our issues page: https://github.com/jamovi/jamovi/issues . (If you're unsure feel free to discuss it here)

by paulgs » Fri May 18, 2018 12:18 am

Hi,

Thanks for the efforts with Jamovi - it is great to use in conjunction with R.

Is there a way to change the way contrasts are coded in lm()? I'm trying to make a comparison for a model output to that from R:

Code: Select all
Coefficients:
                          Estimate Std. Error t value Pr(>|t|)   
(Intercept)                 61.309      1.120   54.76   <2e-16 ***
sexmales                    28.297      1.583   17.87   <2e-16 ***
activityshopping            31.739      1.583   20.05   <2e-16 ***
sexmales:activityshopping  -56.028      2.239  -25.02   <2e-16 ***


In Jamovi I get:
#
# Model Coefficients
# ──────────────────────────────────────────────────────────────────────────────────────
# Predictor Estimate SE t p
# ──────────────────────────────────────────────────────────────────────────────────────
# Intercept 77.320 0.560 138.129 < .001
# sex:
# males – females 0.283 1.120 0.252 0.801
# activity:
# shopping – fishing 3.725 1.120 3.327 0.001
# sex ✻ activity:
# (males – females) ✻ (shopping – fishing) -56.028 2.239 -25.023 < .001
# ──────────────────────────────────────────────────────────────────────────────────────


If I understand correctly, the default in R is treatment contrast coding (simple effects). Jamovi uses something different (for main effects?)

Thank you,
Paul
paulgs
 
Posts: 1
Joined: Fri May 18, 2018 12:05 am

by Ravi » Tue May 29, 2018 11:27 pm

Hi Paul,

Yes, the default in R is treatment contrasts. We use a different contrast by default described over here: https://stats.idre.ucla.edu/r/library/r ... es/#SIMPLE. This reproduces the simple contrast used in SPSS. You can create the contrasts to reproduce the jmv results using lm with the following code: https://github.com/jamovi/jmv/blob/c3e3 ... 1091-L1101.

Cheers,
Ravi
User avatar
Ravi
 
Posts: 143
Joined: Sat Jan 28, 2017 11:18 am


Return to Help