I'm running a multiple logistic regression in R. Im predicting whether or not a stimulus was seen from the number of dots in the stimulus (sample_numerosity
; 4 levels), the length of time it was presented (sample_length
; 5 levels), and the size of the dots in the stimulus (dot_sizes_mean_c
).
This is my model:
logit = glm(formula = Response ~ sample_numerosity+ sample_length+sample_numerosity*sample_length*dot_sizes_mean_c,data = df_exp2)
I'm using a single linear polynomial contrast for both sample_numerosity
:
1 -0.6708204
2 -0.2236068
3 0.2236068
4 0.6708204
and sample_length
:
60 -0.6324555
70 -0.3162278
80 0.0000000
90 0.3162278
100 0.6324555
When I compare the output from summary(logit)
with
car::Anova(logit,type=3,family = binomial(link="logit"),icontrasts = c("contr.sum","contr.poly"))
, they seem to match up:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.7663676 0.0169710 45.158 < 2e-16 ***
sample_numerosity.L -0.0731526 0.0408709 -1.790 0.07359 .
sample_length.L 0.2752797 0.0372421 7.392 1.93e-13 ***
dot_sizes_rev_gen_mean_c 0.0002995 0.0001553 1.929 0.05385 .
sample_numerosity.L:sample_length.L 0.2157081 0.0940304 2.294 0.02187 *
sample_numerosity.L:dot_sizes_rev_gen_mean_c 0.0005342 0.0002043 2.614 0.00899 **
sample_length.L:dot_sizes_rev_gen_mean_c 0.0005024 0.0003452 1.455 0.14569
sample_numerosity.L:sample_length.L:dot_sizes_rev_gen_mean_c 0.0006414 0.0004473 1.434 0.15171
---------------------
LR Chisq Df Pr(>Chisq)
sample_numerosity 3.204 1 0.07348 .
sample_length 54.636 1 1.45e-13 ***
dot_sizes_rev_gen_mean_c 3.720 1 0.05375 .
sample_numerosity:sample_length 5.263 1 0.02179 *
sample_numerosity:dot_sizes_rev_gen_mean_c 6.835 1 0.00894 **
sample_length:dot_sizes_rev_gen_mean_c 2.118 1 0.14557
sample_numerosity:sample_length:dot_sizes_rev_gen_mean_c 2.056 1 0.15160
---
But when I add quadratic and cubic trend contrasts for both sample_numerosity
and sample_length
, the two functions' outputs no longer seem to match. Specifically, there are no significant effects of any of the linear, quadratic, or cubic trends for sample_numerosity
, yet the omnibus test for sample_numerosity
shown in the car
package output is significant. How can this be?
Estimate Std. Error t value Pr(>|t|)
(Intercept) 8.442e-01 3.179e-02 26.557 < 2e-16 ***
sample_numerosity.L 2.505e-02 7.966e-02 0.315 0.753141
sample_numerosity.Q 8.336e-02 6.358e-02 1.311 0.189934
sample_numerosity.C -7.741e-02 4.171e-02 -1.856 0.063581 .
sample_length.L 2.655e-01 6.499e-02 4.085 4.54e-05 ***
sample_length.Q 7.396e-02 6.979e-02 1.060 0.289348
sample_length.C 5.249e-02 6.829e-02 0.769 0.442200
dot_sizes_rev_gen_mean_c 7.681e-04 2.264e-04 3.393 0.000702 ***
sample_numerosity.L:sample_length.L 1.133e-01 1.592e-01 0.711 0.476843
sample_numerosity.Q:sample_length.L -6.309e-02 1.300e-01 -0.485 0.627435
sample_numerosity.C:sample_length.L -7.070e-02 9.189e-02 -0.769 0.441712
sample_numerosity.L:sample_length.Q 2.137e-01 1.749e-01 1.221 0.222082
sample_numerosity.Q:sample_length.Q 2.632e-01 1.396e-01 1.886 0.059443 .
sample_numerosity.C:sample_length.Q 1.365e-01 9.144e-02 1.493 0.135578
sample_numerosity.L:sample_length.C 1.342e-01 1.687e-01 0.795 0.426454
sample_numerosity.Q:sample_length.C 1.736e-01 1.366e-01 1.271 0.203864
sample_numerosity.C:sample_length.C 4.958e-03 9.413e-02 0.053 0.958001
sample_numerosity.L:dot_sizes_rev_gen_mean_c 1.576e-03 5.267e-04 2.993 0.002788 **
sample_numerosity.Q:dot_sizes_rev_gen_mean_c 3.533e-05 4.528e-04 0.078 0.937807
sample_numerosity.C:dot_sizes_rev_gen_mean_c -3.214e-04 3.641e-04 -0.883 0.377433
sample_length.L:dot_sizes_rev_gen_mean_c 4.431e-04 4.656e-04 0.952 0.341345
sample_length.Q:dot_sizes_rev_gen_mean_c 2.945e-04 5.023e-04 0.586 0.557773
sample_length.C:dot_sizes_rev_gen_mean_c 9.351e-04 4.816e-04 1.942 0.052302 .
sample_numerosity.L:sample_length.L:dot_sizes_rev_gen_mean_c 2.198e-04 1.033e-03 0.213 0.831437
sample_numerosity.Q:sample_length.L:dot_sizes_rev_gen_mean_c -8.966e-04 9.312e-04 -0.963 0.335703
sample_numerosity.C:sample_length.L:dot_sizes_rev_gen_mean_c -6.488e-04 8.174e-04 -0.794 0.427371
sample_numerosity.L:sample_length.Q:dot_sizes_rev_gen_mean_c 1.750e-03 1.159e-03 1.509 0.131328
sample_numerosity.Q:sample_length.Q:dot_sizes_rev_gen_mean_c 1.879e-03 1.005e-03 1.871 0.061521 .
sample_numerosity.C:sample_length.Q:dot_sizes_rev_gen_mean_c 1.008e-03 8.214e-04 1.227 0.219867
sample_numerosity.L:sample_length.C:dot_sizes_rev_gen_mean_c 1.005e-03 1.105e-03 0.909 0.363245
sample_numerosity.Q:sample_length.C:dot_sizes_rev_gen_mean_c -3.832e-04 9.633e-04 -0.398 0.690827
sample_numerosity.C:sample_length.C:dot_sizes_rev_gen_mean_c 1.153e-03 7.964e-04 1.448 0.147635
-----------------------------------
LR Chisq Df Pr(>Chisq)
sample_numerosity 22.3714 3 5.459e-05 ***
sample_length 20.0617 3 0.0001648 ***
dot_sizes_rev_gen_mean_c 11.5118 1 0.0006916 ***
sample_numerosity:sample_length 10.6467 9 0.3007020
sample_numerosity:dot_sizes_rev_gen_mean_c 20.3277 3 0.0001452 ***
sample_length:dot_sizes_rev_gen_mean_c 5.2417 3 0.1549332
sample_numerosity:sample_length:dot_sizes_rev_gen_mean_c 17.3311 9 0.0437763 *
```