2
$\begingroup$

I have data assessing reaction time (RT) with 2 variables: Variable 1: 'HighLow', with 2 levels ('High' and 'Low') Variable 2: 'Condition', with 3 levels ('Predicted', 'Implausible', 'Plaus/Unpred')

I am learning about contrasts and have therefore run 2 mixed models that differ based on the contrasts used.

Contrasts for 1st Mixed Model:

HighLow is left as default coding (dummy coded with 'High' representing the intercept). Condition is simple coded with the following contrast matrix:

Predicted     1   1/3  1/3
Implausible   1   -2/3 1/3
Plaus/Unpred  1    1/3 -2/3

The first contrast (cH01) therefore represents Predicted-Implausible, and the second contrast represents Predicted-Plaus/unpred.

Contrasts for 2nd mixed model:

Contrasts for Condition is the same as the first mixed model (simple coded). The contrast for the HighLow variable is sum coded (High=-0.5, Low=0.5).

The mixed model in both cases is

lmer(RT ~ Condition*HighLow+(Condition|Pt_ID) + (Condition|SentNumb)

Fixed Effects Output For Mixed Model 1

      Estimate Std. Error        df
(Intercept)                0.77357    0.03029  84.70182
ConditioncH01             -0.08738    0.01886 115.78438
ConditioncH02             -0.35944    0.03105  99.02833
HighLowLow                -0.01422    0.01439  75.30162
ConditioncH01:HighLowLow   0.05955    0.02043  76.36148
ConditioncH02:HighLowLow   0.17244    0.04049  74.76725
                         t value Pr(>|t|)    
(Intercept)               25.539  < 2e-16 ***
ConditioncH01             -4.634 9.47e-06 ***
ConditioncH02            -11.576  < 2e-16 ***
HighLowLow                -0.988  0.32632    
ConditioncH01:HighLowLow   2.915  0.00467 ** 
ConditioncH02:HighLowLow   4.259 5.90e-05 ***

Fixed Effects Output For Mixed Model 2

Fixed effects:
                        Estimate Std. Error        df
(Intercept)              0.76647    0.02943  76.32919
ConditioncH01           -0.05760    0.01592  95.00997
ConditioncH02           -0.27322    0.02365 109.77111
HighLow1                -0.01422    0.01439  75.30164
ConditioncH01:HighLow1   0.05955    0.02043  76.36134
ConditioncH02:HighLow1   0.17244    0.04049  74.77345

My interpretation is as follows:

Model 1

(Intercept)   : mean of High             
ConditioncH01: Predicted,High-Implausible,High       
ConditioncH02: Predicted,High- Plaus/unpred,high             
HighLowLow: Low-High                
ConditioncH01:HighLowLow: Predicted,low-Implausible,low   
ConditioncH02:HighLowLow: Predicted,low- Plaus/unpred,low

Model 2

(Intercept)   : grand mean across all levels of both variables        
ConditioncH01: Predicted-Implausible (high and low combined)     
ConditioncH02: Predicted- Plaus/unpred (high and low combined)            
HighLowLow: Low-High/2                
ConditioncH01:HighLowLow: (Predicted-Implausible) for high- (Predicted-Implausible) for low
ConditioncH02:HighLowLow: (Predicted-plaus/unpred) for high- (Predicted-plaus/unpred)low

However, looking at the means (see below) my assumptions do not all seem to be correct? In particular, I am confused about the interpretation of HighLow in both outputs and the interactions (which are the same in both outputs)?

Means

Predicted,High      0.6272715   
Implausible,Hig     0.7055791   
Plaus/Unpred,High   0.9423626   
Predicted,Low       0.6861870   
Implausible,Low     0.7123400   
Plaus/Unpred,Low    0.8428695   


Predicted               0.6564936   
Implausible             0.7089290   
Plaus/Unpred            0.8896377   


High    0.7421962           
Low     0.7426768   
$\endgroup$

1 Answer 1

2
$\begingroup$

The unique rows of your fixed effects design matrix under your first contrast specification can be obtained via

library(MASS)

condition <- gl(3, 1, length = 6, labels = c("predicted", "implausible", "plausible"))
contrasts(condition) <- cbind(c(1/3, -2/3, 1/3), c(1/3, 1/3, -2/3))

highlow <- gl(2, 3, labels = c("high", "low"))

X_1 <- model.matrix(~ condition * highlow)
rownames(X_1) <- paste(condition, highlow, sep = "_")
fractions(X_1)
#                  (Intercept) condition1 condition2 highlowlow condition1:highlowlow condition2:highlowlow
# predicted_high      1         1/3        1/3          0          0                     0                 
# implausible_high    1        -2/3        1/3          0          0                     0                 
# plausible_high      1         1/3       -2/3          0          0                     0                 
# predicted_low       1         1/3        1/3          1        1/3                   1/3                 
# implausible_low     1        -2/3        1/3          1       -2/3                   1/3                 
# plausible_low       1         1/3       -2/3          1        1/3                  -2/3 

Each row of X_1 shows how the corresponding (population) cell mean, indicated by the row name, is a linear combination of the (fixed) regression coefficients.

To interpret the regression coefficients in terms of the cell means, we need the inverse of X_1

fractions(solve(X_1))
#                       predicted_high implausible_high plausible_high predicted_low implausible_low plausible_low
# (Intercept)            1/3            1/3              1/3              0             0               0         
# condition1               1             -1                0              0             0               0         
# condition2               1              0               -1              0             0               0         
# highlowlow            -1/3           -1/3             -1/3            1/3           1/3             1/3         
# condition1:highlowlow   -1              1                0              1            -1               0         
# condition2:highlowlow   -1              0                1              1             0              -1 

Now, each row shows the representation of the corresponding regression coefficient as a linear combination of the cell means.

This confirms your output interpretation except for the estimated interaction coefficients, which (reading off from the corresponding rows) are estimates of \begin{align} &-1 \cdot \mu_\text{predicted, high} + 1 \cdot \mu_\text{implausible, high} + 1 \cdot \mu_\text{predicted, low} -1 \cdot \mu_\text{implausible, low} \\ &= \left(\mu_\text{implausible, high} - \mu_\text{predicted, high} \right) - \left(\mu_\text{implausible, low} - \mu_\text{predicted, low} \right) \end{align} and \begin{align} &-1 \cdot \mu_\text{predicted, high} + 1 \cdot \mu_\text{plausible, high} + 1 \cdot \mu_\text{predicted, low} -1 \cdot \mu_\text{plausible, low} \\ &= \left(\mu_\text{plausible, high} - \mu_\text{predicted, high} \right) - \left(\mu_\text{plausible, low} - \mu_\text{predicted, low} \right), \end{align} respectively.

The output for your second contrast specification

contrasts(highlow) <- c(-0.5, 0.5)

X_2 <- model.matrix(~ condition * highlow)
rownames(X_2) <- paste(condition, highlow, sep = "_")
fractions(X_2)
#                  (Intercept) condition1 condition2 highlow1 condition1:highlow1 condition2:highlow1
# predicted_high      1         1/3        1/3       -1/2     -1/6                -1/6               
# implausible_high    1        -2/3        1/3       -1/2      1/3                -1/6               
# plausible_high      1         1/3       -2/3       -1/2     -1/6                 1/3               
# predicted_low       1         1/3        1/3        1/2      1/6                 1/6               
# implausible_low     1        -2/3        1/3        1/2     -1/3                 1/6               
# plausible_low       1         1/3       -2/3        1/2      1/6                -1/3  

fractions(solve(X_2))
#                     predicted_high implausible_high plausible_high predicted_low implausible_low plausible_low
# (Intercept)          1/6            1/6              1/6            1/6           1/6             1/6         
# condition1           1/2           -1/2                0            1/2          -1/2               0         
# condition2           1/2              0             -1/2            1/2             0            -1/2         
# highlow1            -1/3           -1/3             -1/3            1/3           1/3             1/3         
# condition1:highlow1   -1              1                0              1            -1               0         
# condition2:highlow1   -1              0                1              1             0              -1

shows that your interpretation of the coefficient estimate HighLowLow (which I interpret as HighLow1) is off by a factor of $2$ (it should be the same as with the first contrast specification) and your interpretation of the estimated interaction coefficients is off by a factor of $-1$ (it should, again, be the same as with the first contrast specification).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.