# [R-sig-ME] Main effects dilemma in logistic regression

Francesco Romano |brom@no77 @end|ng |rom gm@||@com
Mon Aug 26 12:05:41 CEST 2019

```Dear all,

Apologies for cross-posting if you are also part of R-ling-lang.
I am struggling to understand my results and would appreciate some advice
on a matter that has more to do with understanding logistic regression
outputs in R than actual issues with ME.

I have modelled a binomial mixed effects regression via glmer with two IVs,
a Task factor with two levels (AJT, priming) and a Proficiency continuous
predictor centered on its mean (proficiency). The DV is correct versus
incorrect response on the two tests. Participants and items are added as
random effects along with a slope of task by participants.

The main effects analysis of the model

*correctness ~ task * cent_Proficiency + (1 + task | Participant) +  (1 |
item)*

is as follows

> car::Anova(profmodL2)
Analysis of Deviance Table (Type II Wald chisquare tests)

Response: correctness
Chisq Df Pr(>Chisq)
task                  17.1340  1  3.483e-05 ***
cent_Proficiency       0.2377  1   0.625868
task:cent_Proficiency  7.6260  1   0.005753 **
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

What I am interested in is the relationship between the continuous
predictor and each level of task. As far as I understand, the main
interaction here is irrelevant to my query since what I am really after is
understanding is whether each increase in unit for proficiency results in
statistically significant log odd increase or decrease on each task. Thus,
I investigating simple effects of proficiency at each of the two levels of

Simple effect analysis yields:

> summary(profmodL2)
Cov prior  : item ~ wishart(df = 3.5, scale = Inf, posterior.scale = cov,
common.scale = TRUE)
: Participant ~ wishart(df = 4.5, scale = Inf, posterior.scale =
cov, common.scale = TRUE)
Prior dev  : 2.2697

Generalized linear mixed model fit by maximum likelihood (Laplace
Approximation) [bglmerMod]
Family: binomial  ( logit )
Formula:
correctness ~ task * cent_Proficiency + (1 + task | Participant) +
(1 | item)
Data: prodataL2
Control: glmerControl(optimizer = "bobyqa")

AIC      BIC   logLik deviance df.resid
1288.2   1331.0   -636.1   1272.2     1547

Scaled residuals:
Min      1Q  Median      3Q     Max
-1.6314 -0.4378 -0.2570 -0.1624  4.8020

Random effects:
Groups      Name        Variance Std.Dev. Corr
item        (Intercept) 1.0547   1.0270
Participant (Intercept) 0.5403   0.7350
taskpriming 0.7617   0.8728   -0.70
Number of obs: 1555, groups:  item, 219; Participant, 13

Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept)                  -2.58787    0.27034  -9.573  < 2e-16 ***
taskpriming                   1.47193    0.33943   4.336 1.45e-05 ***
cent_Proficiency             -0.06246    0.02659  -2.349  0.01884 *
taskpriming:cent_Proficiency  0.08935    0.03235   2.762  0.00575 **
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
(Intr) tskprm cnt_Pr
cnt_Prfcncy  0.123 -0.087
tskprmng:_P -0.107  0.076 -0.730

Interpreting the coefficient for cent_Proficiency, it looks like the log
odds of a correct response decrease by .06, signalled by the - sign, when
the task is the AJT (default level), for each unit increase in proficiency.
This effect is mildly significant at the p <.05 level.

Here is the dilemma. If I graph the results I obtain the plot in attachment
where the probability in the AJT of a correct answer (coded as 1) is
actually the other way around, that is directly proportional to proficiency.

The R script for the ggplot is taken from the last page of the VCD package,
reported here for convenience in its original:

> ggplot(Donner, aes(age, survived, color = sex)) +

+ geom_point(position = position_jitter(height = 0.02, width = 0)) +

+ stat_smooth(method = "glm", family = binomial, formula = y ~ x,

+ alpha = 0.2, size=2, aes(fill = sex))

What am I to make of this?

Best,

Francesco

-------------- next part --------------
A non-text attachment was scrubbed...
Name: plotL22.pdf
Type: application/pdf
Size: 104806 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20190826/19c0e45c/attachment-0001.pdf>
```