# Questions tagged [contrasts]

In linear models and particularly in ANOVA, a contrast is a linear combination of parameters with coefficients summing up to zero. It is used to test the corresponding null hypothesis. Contrasts are especially often used with categorical predictors (factors) to make comparisons among the groups (categories). [See also tag 'categorical-encoding']

418 questions
Filter by
Sorted by
Tagged with
53 views

### Sum of squares in linear contrast

$$SS(\text{Contrast}) = \frac{(\sum_{i=1}^{k} c_i\bar{X}_i)^2}{\sum_{i=1}^{k} c_i^2/n_i}$$ This is a formula from Howell's Statistical Methods for Psychology. The author claims that one of the major ...
7 views

### Equivalent of aov with split argument for contrasts in GLM in R

In case of linear models (LM) it is possible to get ANOVA with planned contrasts by using a contrast matrix and aov. Is there any equivalent of the same for analysis of deviance in case of ...
15 views

### Comparison between contrasts in emmeans

Let's say I have these estimated marginal means: ...
34 views

### R: emtrends pairwise contrast results change when testing slopes against 0 or 1

When performing post-hoc simple slope analysis on my linear mixed effect model in R using emtrends(), I noticed that pairwise slope comparisons showed differences in the significance when I tested all ...
60 views

### Two-way ANOVA with interaction term / orthogonal design

The two-way ANOVA model with interaction for some continuous variable $y$ can be expressed as $$y = X\mu + \varepsilon,$$ where $X$ is the design matrix (the first column of $X$ contains the constant, ...
18 views

### Access to the interaction of two three level factors on a mixed model

Using a mixed model (either frequentist lmer or bayesian brms) I have an issue regarding an interaction in my model. I have two factor variable of three level : condition (0-1-2) and Tps_real (0-300-...
23 views

### Posthoc pairwise test on the output of a linear mixed-model (MATLAB or R/Python)

I have observations from three groups of participants (A, B, C), that each represent ratings on three different measures (measure 1, 2, and 3). I would like to know if it is the case that, regardless ...
1 vote
41 views

### Posthoc (planned) comparisons as contrasts between different levels of a regressor, in fitlme (Matlab)

I have participant data for 5 different rating dimensions (A to E), and I have fitted linear mixed-effects models, separately for each rating, with several fixed- and random-effects predictors: ...
52 views

### How to construct the full interaction term for a 3-way ANOVA?

Say for the sake of the argument I have a 2x2x2 ANOVA on factors A, B, and C with levels (A1, A2), (B1, B2), and (C1, C2). Also, the design is fully balanced. I have the following 8 groupings as a ...
28 views

### R, lme4, glmer function: How to calculate significance values for Helmert contrasts? [closed]

I am running a GLMM using the glmer function from the lme4 package in R. I would like to use a Helmert contrast to test a specific difference for the factor condition. If I run that in the glmer ...
61 views

### Contrasts for relative change in proportions #emmeans

I have data indicating quality of life (QOL) as a percentage score from questionnaire data. The data is longitudinal (collected at baseline, 3, 6, 9 and 12 months) and there are other covariates such ...
1 vote
50 views

1 vote
113 views

### Correction for multiple comparisons using sum contrasts with linear regression

I am computing the following model using the lme4 package in R: ...
1 vote
26 views

### Why same t-score for contrast pairs involve continuous x continuous interaction (emtrends)?

I want to calculate the difference in simple slope estimates for two-way interactions that involve two continuous variables. But I found the t-score is all the same for the contrast-pair results when ...