Skip to main content

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
14 views

Effects Contrast Matrix for Interaction with Multiple Grand Means

I want to include an interaction between two factors: area and house_type, in my GAM (MGCV), I hope to make a sum-to-zero ...
statmaj's user avatar
  • 76
0 votes
0 answers
22 views

The problem of double adjustment of p-values in multilevel models with categorical predictors

I have a set of around 30 multilevel models which have the same predictor variables (and the same cluster variable), but different outcome variables. Since there are so many models, I want to perform ...
J. Doe's user avatar
  • 357
4 votes
2 answers
67 views

Making 3 comparisons with a ternary variable

I have a study in which I want to study the effect of a ternary variable $x$ in interaction with a binary variable $y$. The ternary variable is categorical, and for some reasons, I want to do the $3$ ...
Alexandra Steinhilber's user avatar
5 votes
1 answer
69 views

ANOVA Type III understanding

I stumbled across something very interesting to me earlier, in the question and answer here: ANOVA type III strange results I reiterate the warning I found in the function documentation, highlighting ...
Lynchian's user avatar
  • 305
0 votes
1 answer
46 views

Emtrends pairwise comparisons all have same standard errors. 3 way interaction

I have created a linear mixed model and am using emtrends to determine the impact of a dichotomous variable on the effect of a continuous variable, across levels of a categorical variable. Is it ...
Jackson's user avatar
  • 11
1 vote
0 answers
31 views

Constructing subgroup comparisons for variable selection

I am trying to construct a covariate according to the the following description: When constructing the covariates to measure a subgroup effect, we generate covariates that capture the causal effect ...
T-Porsch's user avatar
0 votes
0 answers
23 views

Is the intercept of a complex sum-coded regression basically useless for interpretation? Maybe even for some simple models?

In regression analysis, one may choose to code categorical variables differently depending on interpretability considerations. One such coding scheme known as sum coding (a kind of effect coding ...
nsa's user avatar
  • 272
0 votes
0 answers
23 views

What is the name for contrast coefficients where the difference between the coefficients = 1?

I am wondering if there is a name for the type of contrast coding where the difference between the terms is equal to 1. Let me illustrate with some fake data (using R code, apologies) Two groups, with ...
llewmills's user avatar
  • 2,043
0 votes
0 answers
14 views

How to translate the set of contrasts over model coefficients into definitions of two nested models for Likelihood Ratio testing?

With the data as below: Categorical predictor: "Group" with 2 levels: Group 1 and Group 2 Categorical predictor: "Treatment" with 3 levels: A, B, C Categorical binary response: &...
AshanaShiiii's user avatar
1 vote
0 answers
34 views

How to test specific contrasts about levels of categorical variables through nested models? [closed]

This is not about obtaining any dataset. I HAVE the dataset. This is not about debugging code, this is about EXPLAINING the way to obtain statistical relationship between the nested models (LRT ANOVA) ...
AshanaShiiii's user avatar
0 votes
0 answers
38 views

Multilevel-Regression Contrasts and Multiple Comparisons

My experiment looks roughly something like this: 5 Different biological replicates were tested with 4 Conditions (incl. Control) and 3 Time points (1h, 6h, 24h). My samples are nested within ...
Sebastian_Mrtn's user avatar
0 votes
0 answers
22 views

Contrasts by each categorical factor or by all?

I have the following model: Cmic_mg_cm2 ~ group*sample_date + mean_ph + mean_shan_veg + mean_tree_shandiv + (1|plot) with both group and sample_date ...
Eco_Analysis's user avatar
0 votes
0 answers
10 views

Why do we use n-1 effect codes and -1 values in sum (effect) coding in linear regression? Why can't we treat all the effects equally? [duplicate]

When doing effect/sum coding in linear regression (which AFAIK are the same), the contrasts are coded as: condition1 condition2 condition3 condition1 1 0 0 condition2 0 1 0 condition3 0 0 1 ...
edetone's user avatar
1 vote
1 answer
25 views

How to set contrasts for contrast in post-hoc comparison of linear mixed effect model in R?

i am new in R and studying statistical analysis for experiments, please help me~ I have 3 age groups (Y/HO/LO) and 2 conditions (Related/Unrelated). I am running a linear regression model on RT (...
Yun's user avatar
  • 13
0 votes
0 answers
24 views

Which of these is the correct way to encode a type III ANOVA analysis?

I am trying to run a type III ANOVA analysis to look at how the three factors A, B and C affect the continuous variable X. Online I have found two ways of encoding the model which give different ...
Insect_biologist's user avatar
5 votes
1 answer
294 views

What are average comparisons in the `marginaleffects` package?

I am confused about what the avg_comparison function does in the marginaleffects package. ...
Carol Eisen's user avatar
0 votes
0 answers
32 views

Apply custom (ANOVA-like) contrasts to all interactions in a mixed model (with a stacked dataset)

I am conducting a multilevel mediation analysis with a multicategorical X (4 levels from a 2-by-2 design) for which I want to apply custom contrasts that code two ...
brizzen's user avatar
1 vote
0 answers
18 views

Assumptions to be met for a contrast test of mean against zero

When doing a contrast test (see R code below) or it's rather unusual regression style equivalent, both of which are basically a t-test, what assumptions have to be ...
Madamadam's user avatar
  • 247
1 vote
1 answer
29 views

Interpretation of Intercept in mixed model with repeated contrasts

I am running the following logistic mixed model in lme4: ...
SilvaC's user avatar
  • 512
1 vote
0 answers
25 views

How do I calculate effect size in a pretest-posttest three group randomized study for two planned contrasts (ANCOVA)?

I am having a hard time calculating the individual effect sizes for ANCOVA simple contrasts ($1$ vs. $2$ and $1$ vs. $3$) in a randomized pretest-posttest design study with three groups. In the ANCOVA,...
Eniko's user avatar
  • 11
0 votes
3 answers
355 views

How to choose reference category of predictors in logistic regression? [duplicate]

I am struggling to decide which reference category I should define in my logistic regression model. When I define "mandatory school" as a reference in the variable education the results seem ...
Gustav's user avatar
  • 127
0 votes
0 answers
41 views

Prove two orthogonal contrasts are uncorrelated

I am reading some ANOVA notes and have a problem with proving two orthogonal contrasts are uncorrelated. Here is what I tried: Assume that $\bar X_i, i=1,\dots,n$ are uncorrelated. Suppose we have two ...
Matata's user avatar
  • 671
3 votes
2 answers
42 views

Logic behind writing custom planned contrasts for a triple interaction

I have a model with a triple interaction involving two factors and one continuous variable. Replicable example: ...
Maurice Pasternak's user avatar
1 vote
0 answers
56 views

Is there a way to do planned contrasts after a Kruskal-Wallis test in R?

I want to compare three groups: Children, Caregovers and Experts. I cannot do an ANOVA as my data does not meet the assumptions. Therefore, I need to do a Kruskal-Wallis test. For Post-hoc I am ...
Noah's user avatar
  • 111
0 votes
0 answers
25 views

How to interpret sum contrast in logistic regression

I have a two level factor (treatment 1 and treatment 2) and I want to explore the influence of this factor into a binomial factor (death, yes no, with ref=no). I would like to obtain an odds ratio, ...
Adrián Valls Carbó's user avatar
0 votes
0 answers
23 views

Understanding parameters interaction contrasts in model averaging

I am struggling to understand how parameter interaction contrasts play into model averaging. As I am new to Stack Exchange, I apologize if my question is in the wrong place or incorrectly asked. I ...
artessy's user avatar
2 votes
0 answers
30 views

Custom contrasts in piecewise mixed effects models

I have longitudinal data from a two-group RCT in which the primary outcome was assessed at baseline, each week during the intervention, post-test and 5-month follow-up (6 times total). I am modeling ...
yeshe's user avatar
  • 21
3 votes
1 answer
151 views

Appropriate way to configure contrasts and interactions in GLM likelihood ratio test

I have a pretty large experiment where we are looking for differences in gene expression in RNA sequencing experiments. We are using EdgeR's GLM functionality, and then using contrasts to look for ...
jay's user avatar
  • 143
0 votes
0 answers
54 views

Interpretation of an interaction effect (ratio of odds ratios) when using effect coding

I ran a multilevel logistic regression model using function glmer from R package lme4. All of my predictors are binary and I have used effect coding, i.e., coding -...
Michael Krah's user avatar
0 votes
0 answers
231 views

Orthogonal polynomial contrasts in SPSS (for a binary logistic regression)

I have 4 IVs: gender (male, female), marital status (married, single), threat (continuous variable) and stress with four levels (ranging from 7 to 10 with ten being 'most stressed'). My DV is ...
lisaarthur's user avatar
0 votes
0 answers
66 views

Multiple regressions with each factor level as contrast coding

I've determined there is a difference in factor levels on a dependent variable. I'd now like to determine which level differs from other levels. I know I can use contrast coding, specifically ...
Brian Syzdek's user avatar
0 votes
0 answers
53 views

3 way interaction in linear mixed model with 2 continous and 1 categorical predictors

I want to know if the relationship between x (continuous independent variable) and y (continuous dependent variable) is influenced by gender (binary variable) AND stronger for those participants who ...
Mika2019's user avatar
1 vote
0 answers
71 views

Contrast matrix with two factors with more than 2 levels each

I have not come across a contrast matrix like the one I would like to make. To put it in situation. I have the following model: ...
Maik's user avatar
  • 31
2 votes
1 answer
162 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 ...
Jonathan deGrom's user avatar
0 votes
0 answers
44 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 ...
Crops's user avatar
  • 477
0 votes
1 answer
54 views

Comparison between contrasts in emmeans

Let's say I have these estimated marginal means: ...
Alex Il's user avatar
  • 45
0 votes
0 answers
241 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 ...
Malin's user avatar
  • 1
3 votes
1 answer
141 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, ...
Syd Amerikaner's user avatar
0 votes
1 answer
30 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-...
Guillaume Pech's user avatar
7 votes
0 answers
72 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 ...
z8080's user avatar
  • 2,362
1 vote
0 answers
84 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: ...
z8080's user avatar
  • 2,362
3 votes
2 answers
69 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 ...
Matthew Graham's user avatar
2 votes
0 answers
62 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 ...
Frank Leoné's user avatar
2 votes
1 answer
234 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 ...
user167591's user avatar
1 vote
1 answer
94 views

ANOVA: contrast to ratio of adjusted geometric means

Could you, please, help me with the following problem? Suppose we have a one-way ANOVA with a single 2-level factor. The dependent variable is a logarithmized value: $y_i = log(Y_i)$. $y_{iz} = \mu + ...
dfgh19283's user avatar
2 votes
1 answer
106 views

Interpretation of lme4 output with different contrasts for variables

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 ...
SilvaC's user avatar
  • 512
1 vote
0 answers
93 views

How to perform non-orthogonal planned contrasts (and a-priori power-analysis for this)?

I have four treatment groups (A, B, C, D) and measure three dependent variables (X, Y, Z). My hypotheses are that each dependent variable is strongest in one of the treatment groups, compared to all ...
Annette M's user avatar
0 votes
1 answer
114 views

Three-level variable in LME analysis - output

I am currently unsure about a three-level variable in an linear mixed effects analysis in R (lme4) - I should add that I am new to LMEs and would very much appreciate some very basic advice! I am ...
Jane's user avatar
  • 3
0 votes
1 answer
143 views

Why is the last level not reported in R's `summary()`, if its coefficient is not 0? [closed]

In section 4.7.7 of Introduction to Statistical Learning (version 2), the authors code regression contrasts where the last level of a predictor sums to the remaining levels. My question is, why doesn'...
its.me.adam's user avatar
2 votes
1 answer
55 views

How to deal with potentially too few levels of the random effect

I built a linear mixed effect model with nlme with Body length, Habitat and Sex as fixed effects. Body length is added for body size correction while the other two both have two levels. In the random ...
Anna's user avatar
  • 21

1
2 3 4 5
9