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
2 votes
2 answers
36 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 ...
user avatar
  • 25
1 vote
1 answer
13 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 ...
user avatar
  • 113
0 votes
0 answers
13 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 ...
user avatar
  • 13
1 vote
1 answer
23 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 ...
user avatar
  • 11
1 vote
0 answers
15 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 ...
user avatar
  • 11
0 votes
0 answers
7 views

Type III ANOVA in a crossed interaction showing significant main effect

Given a crossed interaction: ...
user avatar
0 votes
0 answers
37 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 ...
user avatar
  • 83
0 votes
0 answers
12 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 ...
user avatar
0 votes
0 answers
75 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 &...
user avatar
  • 165
1 vote
1 answer
26 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 ...
user avatar
  • 33
0 votes
0 answers
32 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 ...
user avatar
  • 153
1 vote
1 answer
48 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 ...
user avatar
  • 153
1 vote
1 answer
113 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: “...
user avatar
  • 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,...
user avatar
0 votes
0 answers
17 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 ...
user avatar
0 votes
0 answers
22 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 ...
user avatar
0 votes
1 answer
12 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: ...
user avatar
  • 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 (...
user avatar
  • 115
0 votes
0 answers
15 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-...
user avatar
1 vote
1 answer
107 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 ...
user avatar
0 votes
0 answers
41 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 ...
user avatar
  • 51
1 vote
1 answer
65 views

emmeans - change reference level of contrast

Good day I need some help, I used the following code: EMM <- emmeans(model1, ~ A | B) ...
user avatar
  • 51
1 vote
1 answer
76 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...
user avatar
0 votes
1 answer
105 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 ...
user avatar
0 votes
0 answers
5 views

Clustered Poisson Regression

Observational Unit – I have set up multiple grids where within each grid (3x3), there are 3 different kinds of cells labeled 0, 1, and 2 identically laid out across grids. This is an observational ...
user avatar
0 votes
0 answers
17 views

Obtaining standardized mean differences or pooled standard deviation for linear contrasts

I have a weighted linear regression with three categorical predictor variables (each with 4 levels), and have tested three contrasts using the multcomp package in R: ...
user avatar
  • 1
2 votes
2 answers
144 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 ...
user avatar
  • 23
0 votes
0 answers
24 views

Setting custom contrasts for a two-factor interactrion hypothesis in a mixed effect model using R

There has been some debate on how to set custom contrasts in this forum already. Nevertheless, I could not find (nor implement) tests for custom contrasts for an interaction and/or a bit more complex ...
user avatar
  • 71
0 votes
0 answers
9 views

how to report - simultaneous tests for general linear hypotheses of contrast

Dear all, hi, I wanted to do contrast analysis and with this commands I got that table for contrast analysis ...
user avatar
  • 49
0 votes
0 answers
12 views

Hypothesis and linear model with variables

A ~ B * C * D + (1|individual), data = Data_1) in script Outcome in console: A ~ B * C * D + (1 | individual) B and C are between UV and D is within UV (continuous interval scaled with 3 levels d1, d2,...
user avatar
  • 49
0 votes
0 answers
25 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-...
user avatar
  • 683
0 votes
0 answers
8 views

what exactly are level - 1 contrasts in determining factor effects in generalized linear models?

I am currently running a generalized linear model. As I have learned, the default contrasts of levels in factors lead to simple ...
user avatar
  • 1
1 vote
0 answers
45 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 ...
user avatar
0 votes
0 answers
133 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 ...
user avatar
0 votes
0 answers
118 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 ...
user avatar
2 votes
1 answer
87 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 ...
user avatar
  • 21
2 votes
0 answers
42 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: ...
user avatar
0 votes
0 answers
71 views

How to perform a directional hypothesis using Bayes Factors?

I would like to test a directional hypothesis using bayes factors, but I don't know how to do it. Given this data I perform a "bayesian anova" using the ...
user avatar
4 votes
1 answer
52 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: ...
user avatar
1 vote
0 answers
165 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 ...
user avatar
  • 121
0 votes
0 answers
25 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 ...
user avatar
2 votes
2 answers
124 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 ...
user avatar
  • 556
2 votes
2 answers
139 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. ...
user avatar
  • 41
0 votes
1 answer
82 views

Must interacting dichotomous categorical predictors be treated as factors?

If examining the main effects of dichotomous categorical variables, the levels of which are binary and absolute (present/absent), must they be treated as factors rather than numerics? Would the answer ...
user avatar
  • 65
4 votes
2 answers
587 views

Questions concerning visualizing model results with the R-package visreg

Following some discussions with colleagues, I'm seeking for clarification on how to visualize an ANCOVA with visreg, and what the visualization actually shows. I would like to run the following ANCOVA ...
user avatar
  • 71
1 vote
1 answer
228 views

calculating selected contrasts with emmeans within treatment

I have a dataset that has data collected at 8 different timepoints and in 5 different treatment groups, and want to do multiple pairwise comparisons. However, I want to run comparisons only between ...
user avatar
1 vote
0 answers
34 views

How do we calculate Standard Errors for effect-coded variables?

I'm a beginner following this UCLA tutorial to figure out how to interpret coefficients for effect-coded categorical predictors and have a couple of questions regarding their regression table below, ...
user avatar
  • 11
3 votes
2 answers
173 views

Is it preferable to subset data to test specific hypotheses or specify a full model and run contrasts?

Let's say I have a 2x2 design where participants are either in condition A or condition B and, within each condition, either get exposed to exposure C or exposure D. First, I want to test whether ...
user avatar
1 vote
1 answer
255 views

Categorical variable more than two levels

Say for the sake of argument I have a categorical variable called race. The variable has white, black, and Asian levels. I make two dummies (dummy variables) White and Asian (for variable white if 1 ...
user avatar
  • 881
0 votes
1 answer
43 views

Is it appropriate to only specify the contrasts you are interested in?

I am running some contrasts in R using emmeans, and when I specify my contrasts like this: ...
user avatar

1
2 3 4 5
8