# 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']

380 questions
Filter by
Sorted by
Tagged with
12 views

### How to interpret the sign of Helmert contrasts regression coefficients?

Helmert1 is the the contrast encoded in the vector (-1 0.333 0.333 0.333). Suppose the groups in order are control, No-Show, Treatment One, Treatment Two. Suppose the dependent variable is the log(...
5 views

### Custom polynomial contrast to look at trend within a set of measurements?

I have conducted a study with 3 treatment conditions where one hypothesis is that the 8 treatment sessions across all three conditions would show a linear trend. I also have pre- and post- ...
50 views

### Is it possible to do a contrast in a 2x2 (or more) contingency table or am I completely missing the point?

I have the following 2x2 contingency table of observed frequencies: ...
• 101
22 views

### How to Code categorical variables in LME for binary outcomes (R)

I am struggling to work out how best to code my categorical variables in a LME model. I am predicting RT on a task, and have several categorical variables used as predictors, including whether a ...
57 views

### Problems with emmeans if RE-adjustment and backtransformation from logit

In an experiment (4 sessions, 2 groups), subjects try to remember words. We want to test H1: the overall (marginal) main effect of group H2: the specific interaction contrast of group and sesson1 _ 2 ...
• 11
50 views

### Advice on computing contrasts of categorical predictor across range of interacting continuous predictor fitted with a restricted cubic spline #rms

Background After fitting a logistic regression model, I am trying to produce a series contrasts between levels of a categorical variable, x1, across the values of an interacting continuous variable, ...
27 views

### Interpretation of default Type III Sums in Squares in R

Many posts (i.e. here and here) discuss how the Type III sums of squares produced by car::Anova() in R are incorrect or nonsensical under R's default model parameterization, "contr.treatment"...
• 1,131
31 views

### contrast comparison

I have a linear model where one dv is predicted by one categorical with 4 levels. I want to check if the intercept differs from the average of the other 3 conditions. I fit the model ...
68 views

### How to interpret categorical variable in logistic regression with contrast coding

I'm currently having the following regression that I found a bit tricky to explain: ...
19 views

### Calculate contrasts from lme model across specified timepoints

I have an MMRM with the below structure: ...
82 views

### Linear model with constraints in R

I have the following problem: I have a simple linear model with 3 independent variables. ...
122 views

### Post hoc contrasts when only certain contrasts make sense

My experiment has a 2x2 design, full between-subjects, so that the resulting four groups are as follows: -Group A-1: Experimental treatment A. -Group A-2: Control for experimental treatment A. -Group ...
9 views

### How can I make contrast codes that satisfy the conditional for orthogonality?

I am trying to contrast code my categorical predictor variable, but I cannot produce contrast codes that satisfy the condition for orthogonality. According to Judd, McClelland, and Ryan (2017), the ...
1 vote
90 views

### planned contrast with **emmeans** on interaction term in mixed model

I think this is simple: I want to test if a treatment (that I know a priori does something) is stronger in one group vs. the other (in the presence of random effects). This seems like it should be ...
77 views

### Test for interaction effect when contrasting specific timepoints in mixed-model

I'm having a mixed model (lmer in R) with 5 repeated measurements (time is categorical), and 6 groups, and several covariates. I'm mainly interested in seeing whether there is a significant difference ...
• 27
1 vote
35 views

### What is the scaling applied to Helmert contrasts in emmeans?

I'm trying to understand why the values under 'estimate' from an emmeans contrast function differ from those of the default 'Estimate' values from, say, 'summary.lm()' in R. As an example, let's use ...
• 113
21 views

### Effect size calculation on a MANOVA with contrasts

I would like to conduct a repeated samples (patient) ANOVA (with Factor X with 3 levels A, B, C) with the planned contrasts (A+B)-C (i.e 1 1 -2) and (A+C)-B (i.e 1 -2 1) as well as calculate the ...
• 13
1 vote
119 views

### How are simple effects calculated in JASP (and how to calculate them properly)?

I'm conducting 3-way (2x2x2) repeated measures ANOVA in JASP with a main factor of interest called symm, and two other factors: emotion (neutral/fearful) and masking (masked/unmasked). I want to ...
• 11
1 vote
20 views

### Design matrix for getting desired contrasts in 3x3 design with 2 controls

We have nine conditions in our study (two category factors each with three levels; A: a1, a2, a3; S: s, c1, c2). I did two-way ANOVA; however, we are interested in a more nuanced question. c1 and c2 ...
• 11
13 views

### Type III ANOVA in a crossed interaction showing significant main effect

Given a crossed interaction: ...
46 views

### How to interpred effect and weighted effect coded regression with continuous and factor variable interaction

I have a linear mixed model y~(x)*fac+random fac has two levels, with different numbers of observations x is not normalized or centered but log transformed. given ...
• 83
21 views

### Linear mixed model poly contrast & numeric covariates

I want to compute mixed linear model and have a repeated measure design. I suspect dependent variable to decrease in an linear model with time. Which is why I defined the contrast for that variable as ...
135 views

### How to obtain contrasts for constrained longitudinal data analysis?

I would like to apply a constrained longitudinal data analysis (cLDA) with a linear response variable of the form, y ~ Time + Treatment:Time + (1 | ID). I am using &...
• 165
1 vote
60 views

### Intercept of logistic regression with contrast coding

Say I have a binary dependent variable (Choice) being either 0 or 1, and people answer this DV multiple times. I also evenly split people in two groups (Group, group A vs group B). I simulate data so ...
• 33
50 views

### Pros and cons: Splitting a single dummy variable into multiple and fit seperately

I was discussing dummy coding with a colleague. They wanted to compute a series of combinations from the levels of a three-leveled categorical variable (A vs B+C; B vs A+C; C vs A+B) but as it's not ...
• 153
1 vote
63 views

### Custom-define contrast - mix between dummy and Helmert coding

I'm trying to use custom-defined contrasts. They are sort of a combination of traditional dummy coding and the last contrast produced by reversed Helmert coding. In short, I want to compare each of ...
• 153
1 vote
516 views

### How report planned contrast test results

I was reading through Andy Field's Discovering Statistics with SPSS. Following ANOVA, he ran several planned contrasts. When he described how to report the planned contrast results, he wrote this: “...
• 21
17 views

• 556