2

In my language learning experiment, I would like to check whether or not the variables "Day" (varying from day1 to day4), "Generalization" (familiar stimuli v.s. novel stimuli), and "Types" (there are 2 types of stimuli) predict the learning results, which is the variable "Correct".

Considering that the model might be complex if I put all these three explanatory variables in one go, I built up two different models with each having two fixed factor variables. The codes are as below:

model_1 <- glmer(Correct ~ Day + Types + (1|Subject) + (1|Item), 
                 data=alldata, family="binomial")
model_2 <- glmer(Correct ~ Day + Generalization + (1|Subject) + 
                 (1|Item), data=alldata, family="binomial")

I expected that the outputs for "Day" would be exactly the same between the two models because the calculation was based on the same data source. However, the final outputs turned out to be like:

**"Day" in model_1:**
|   | Estimate Std. | Error | z value | Pr (> z) |
|:---- |:---- |:------ | ----- | ----- |
| (Intercept)  | 0.39283  | 0.14807    | 2.653 | 0.007978 |
| Dayday2  | 0.12198  | 0.11996    | 1.017 | 0.309256 |
| Dayday3  | 0.30082  | 0.12127    | 2.481 | 0.013118 |
| Dayday4  | 0.42465  | 0.12247    | 3.467 | 0.000526 |

**"Day" in model_2:**
|   | Estimate Std. | Error | z value | Pr (> z) |
|:---- |:---- |:------ | ----- | ----- |
| (Intercept)  | 0.64559  | 0.14004    | 4.610 | 4.03e-06 |
| Dayday2  | 0.12466  | 0.12107    | 1.030 | 0.303158 |
| Dayday3  | 0.30638  | 0.12240    | 2.503 | 0.012309 |
| Dayday4  | 0.43241  | 0.12360    | 3.498 | 0.000468 |

These results look similar but not exactly the same, which made me a bit confused. I just get started with learning the MLE model. I'm sorry to ask these naive questions: Would the calculation for the same fixed factor be influenced by another fixed factor in the model? Otherwise, would this be because I made something wrong with my data file? I would really appreciate it if anyone would like to help me.

Besides, I was also wondering about a minor question: Could the df.resid from a generalized linear mixed model be as large as 2425? (I had 2432 rows of data in my CSV file though.)

kjetil b halvorsen
  • 63,378
  • 26
  • 142
  • 467
  • 1
    When you consider new information, your understanding of other things can change. Same with your linear model. – Gregor Thomas Dec 08 '21 at 14:39
  • Think about it this way: if adding new variables didn't change the estimates of current variables, there would be no downside to including more variables! Every model would include every variable, and you would just look at the estimates you were interested in. – Gregor Thomas Dec 08 '21 at 14:48
  • 1
    Changing the IVs in the model can change the estimated coefficients. The duplicate explains why in great detail. – Sycorax Dec 08 '21 at 15:36
  • @GregorThomas, **if** the new variables were completely orthogonal to the current variables, then the estimates wouldn't change - only the residual variance and residual degrees of freedom. – Ben Bolker Dec 08 '21 at 15:54

0 Answers0