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

Filter by
Sorted by
Tagged with
0 votes
0 answers
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(...
0 votes
0 answers
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- ...
  • 1
0 votes
1 answer
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
0 votes
0 answers
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 ...
0 votes
1 answer
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
2 votes
1 answer
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, ...
2 votes
0 answers
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
0 votes
1 answer
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 ...
3 votes
1 answer
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: ...
0 votes
1 answer
19 views

Calculate contrasts from lme model across specified timepoints

I have an MMRM with the below structure: ...
4 votes
1 answer
82 views

Linear model with constraints in R

I have the following problem: I have a simple linear model with 3 independent variables. ...
5 votes
2 answers
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 ...
0 votes
0 answers
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
1 answer
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 ...
2 votes
2 answers
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
1 answer
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
0 votes
0 answers
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
1 answer
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
0 answers
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
0 votes
0 answers
13 views

Type III ANOVA in a crossed interaction showing significant main effect

Given a crossed interaction: ...
0 votes
0 answers
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
0 votes
0 answers
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 ...
0 votes
0 answers
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
1 answer
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
0 votes
0 answers
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
1 answer
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
1 answer
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
0 votes
0 answers
17 views

Relation between main effect and least square estimates

Consider the usual two-factor experiment randomized as a CRD, with factors $A$ and $B$, and with model $$Y_{ijl} = \mu + \alpha_i + \beta_j + (\alpha \beta)_{ij} + \epsilon_{ijl}$$ where $i=1,2$, $j=1,...
0 votes
0 answers
18 views

When testing two contrasts on the same model over multiple sets, how many times do you adjust for multiple comparisons?

I have not found an answer to this specific question elsewhere. I have a simple model with a single factor of three levels. I am running this model over about 1800 different sets. I am interested in ...
0 votes
0 answers
43 views

Best approach for limma contrasts to remove batch effects

Given the following sample batches: Batch1 = 3x Control Samples, 3x Group1 Samples Batch2 = 3x Additional Control Samples 3x Additional Group1 Samples Batch3 = 3x Additional Controls, 4x Group2 ...
0 votes
1 answer
22 views

percentage of difference with estimated marginal means

I am calculating the difference between concentration of different metabolites according to the factor sex (male/female) and age group (<55 / >=55) from this linear model: ...
  • 1
1 vote
0 answers
24 views

Experiment with two within-subjects and one between-subject with linear mixed models?

I need to analyze one dataset that contain two variables measured in the same subject and one across subjects. The variables are: id = subject id, factor with 83 levels tissue = factor with 2 levels (...
  • 115
0 votes
0 answers
16 views

R - contrasts in two-way within-subjects ANOVA?

I have a data set from a 4x2 within-subjects (aka repeated measures) design. Participant Identifier: SubjectNumber IV1: Purpose (A, B, C, D) IV2: Type (X, Y) DV: Score After running the overall two-...
1 vote
1 answer
205 views

Interpreting interaction effect with orthogonal polynomial contrast codes

I'm running a logistic regression with two categorical variables (sample_number: 1, 2, 3, 4; and sample_length: 60, 70, 80, 90, 100) and a continuous predictor (dot_size). My model in R looks like ...
0 votes
0 answers
78 views

emmeans - joint effects of interaction terms

I would like to see the joint effects of an interaction term. I tried joint_tests() but it gives f ratios. However, I would prefer Incidence Rate Ratios (IRR) because the rest of my results section ...
  • 51
1 vote
1 answer
144 views

emmeans - change reference level of contrast

Good day I need some help, I used the following code: EMM <- emmeans(model1, ~ A | B) ...
  • 51
2 votes
1 answer
123 views

How to test whether the relationship between an IV and a DV varies depending on levels of two other variables

Let's say I have 2 different conditions participants can be assigned to (stored in the variable condition). Within each condition...
0 votes
1 answer
231 views

emmeans ignoring `adjust`

I am running a gls on a repeated measures design. I am trying to check if my contrasts are being adjusted but I am failing to get any adjustment using either ...
3 votes
2 answers
241 views

Can all possible pairs of comparison be planned comparisons in ANOVA?

Let's say we have three intervention groups (condition A, condition B, and condition C/control) to be analyzed in ANOVA, and we are theoretically interested in the difference between each pair of all ...
  • 33
0 votes
0 answers
33 views

Analysis sense check: preregister planned contrasts which we wish to conduct even if associated ANOVA is nonsignificant?

I could use a sense check on my analysis plan for an experimental study which has not yet been run; I will preregister it once I am confident that it is reasonable. There are seven between-...
  • 723
1 vote
0 answers
116 views

How to code a contrast matrix for repeated contrasts (comparing adjacent levels) where the intercept corresponds with the grand mean?

In brief: How to code a contrast matrix for repeated contrasts (comparing adjacent levels) where the intercept corresponds with the grand mean? Example-Problem: A factor of 10 levels. Each contrast ...
0 votes
0 answers
195 views

Why do sum and treatment contrasts give the same coefficients in linear regression?

I have been given a dummy dataset upon which linear regression is performed and treatment and sum contrasts outputs are compared. In this scenario the coefficients are exactly the same and I don't ...
0 votes
0 answers
154 views

Repeated Measures ANOVA Tests of Within-Subjects Contrasts

Using the MIXED procedure and a set of repeated measures data of vertical format, I obtained the results of fixed effect estimates and related t-tests for orthogonal polynomial linear and quadratic ...
2 votes
1 answer
126 views

Helmert coding for mixed models in R

I am using R to analyse data from an experiment with six conditions. Condition has two dimensions: for cognitive load, I have two levels (load and ...
  • 21
2 votes
0 answers
53 views

Custom contrasts in R: why should I take the generalized inverse of transpose of the original contrast matrix?

Let's say there is a continuous variable y and a grouping (factor) variable x with 3 different levels: ...
1 vote
1 answer
64 views

How to check the significance of different combinations of factors in a 3-way binomial GLM

I have a binomial model with a 3-way interaction: ...
1 vote
0 answers
282 views

emmeans: compare treatment effect across two levels of a category

I want to compare the difference between treatment and placebo across two levels of a factor, lets say gender. This, to answer the question whether there is a significant difference in treatment ...
  • 121
0 votes
0 answers
27 views

Multiple comparison when testing one planned hypothesis

I am running one logit model containing an interaction: logit dv year contract_type yearXcontract+Z where contract_type and year are dummies with 4 levels. After ...
2 votes
2 answers
159 views

Prove two orthogonal contrasts are statistically independent

Linear combination $C=\sum_{i=1}^{n} a_i \bar{X}_i$ is called a (estimated) contrast if $\sum_{i=1}^{n} a_i=0$. Two contrasts are called orthogonal if $\sum_{i=1}^{n} a_i b_i = 0$; simplest example ...
  • 556
2 votes
2 answers
180 views

Contrast coding and scaled estimates using emmeans / lmer

I am trying to analyse subgroups of a mixed-effects model using custom contrasts. I have 2 factors F1 and F2, each with 3 levels. My interest is in comparing the groups like this: F1_group1 vs. ...
  • 41

1
2 3 4 5
8