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

262 questions
Filter by
Sorted by
Tagged with
5 views

### Designing a customized contrasts analysis

I would like to get some advice on running a customized contrast analysis. I have looked at a few vignettes and I think I get the basic idea, but I'm not sure how to adapt them for my purpose. To ...
9 views

### MANOVA contrast results p-value in SPSS - Bonferroni correction required?

I am running a MANOVA with 2 IVs(2*3) and 4 DVs. I want to test the effect of the 3-level IV using a Helmert contrast: to compare if level 1 significantly differs from the mean of levels 2 and 3, as ...
39 views

### Is it ok to define the contrasts after building the model?

I have this mode starting model but I need to build the random structure but I am not sure if I can do that without setting the contrasts. Variable Time is a 3-...
8 views

### Regression/anova with imbalanced controls

I am thinking of a regression setup where the dependent variable, Y, is continuous and the predictor is a factor. The data is an aggregation of multiple sources with similar and pooled controls but ...
10 views

### Contrast coding DV in multinomial regression

In a multinomial logistic regression (for example, with 3 levels of a categorical DV), my understanding is that the DV is essentially dummy-coded, with coefficients corresponding to differences ...
31 views

### Why does an ANOVA design matrix with a fictitious 0 observation allow for ANOVA with mean plus contrasts to be estimated?

I was reading Functional Data Analysis with R and MATLAB (Ramsay et. al., 2009) and they presented the following (functional) ANOVA model (but I'm ignoring the functional aspect; it doesn't appear ...
34 views

### Testing contrasts in multilevel models

I'm trying to think of a way to test certain hypotheses regarding an experiment I've run. It's a 2 x 3 x 4 within-subjects, repeated-measures design. I would like to fit a (cross-classified) ...
8 views

### Why Does emmeans add_grouping average over the levels of the reference factor?

I've implemented a learning technology to reduce the gender gap(the difference between male and female student grades) in CS education. I conducted a quasi-experiment across six semesters, with ~200 ...
4 views

### Contrasts for gini indices in R or matlab

I am trying to show that two populations distributed by Pareto distribution differ in skewness. For this I plan to use the Gini indices of the populations. However I was wondering if there is a way to ...
3 views

### Effect of assymetrical weights to compute omnibus contrast

To compute an omnibus contrast for an ANOVA factor with an uneven number of levels, my understanding is that the weights of the contrast vector inevitably need to be unbalanced, e.g. ...
36 views

### Literature on nonparametric contrasts

I am wondering how I can perform and interpret contrasts in a particular case described below. I am comparing three independent groups which are not normally distributed (heavily), thus I have opted ...
74 views

### Testing simple (conditional) effects in orthogonal contrasts for three levels

I would like to test the y ~ x relation across 3 groups by the means of a set of two orthogonal contrasts codes. When dealing with two groups, I examine the simple ...
19 views

### How to set up a contrast matrix in a multilevel model (lme4, multcomp)

I'm struggling with setting up a contrast matrix for my model. Here's some made-up data (similar to my original data): There are 50 subjects that have been tested twice (an "easy" and a "hard" test) ...
4 views

### Contrasts Intutition Sum of Squares and Df

I am reading about contrasts for a class and at some point the formula for the sum of squares of a contrast is randomly stated. The author mentions then that constrasts display one degree of freedom ...
32 views

### Deviation Coding meaning of test statistic on grand mean (intercept)

I have a dataset with 7 factor levels none of which are a reasonable reference group, so I've chosen to set up my GLM (negative binomial) analysis using deviation coding. I've studied this question ...
18 views

### Mixed model contrasts for testing whether group differences increase/decrease across time points

I'm trying to fit a lmer model in order to predict whether group differences in scores on a scale increase/decrease over time. The dataset includes the following variables: Dependent variable: ...
111 views

### How do I define an “interaction” contrast with single explantory variable?

Suppose I have an experiment with four groups defined by two binary variables. ...
48 views

### Cluster Bootstrap Mixed Model Contrasts

So I regularly make use of lme4 and lmerTest to fit Linear Mixed Models. I then do the post ANOVA contrasts via the emmeans (Estimated Marginal Means) package. However, I understand that for ...
13 views

### confused about dummy coding and contrasts

Dummy coding refers to use k - 1 variables to represent k level variable in a model, while contrasts assign each parameter for a level (for example, assign 1 to level k1 and -1 to level k2, so as to ...
43 views

### Polynomial and simple contrasts for anova

Im wondering if anyone can help me. Im trying to do a 2x16 repeated measures ANOVA with two conditions across 16 timepoints. The main effect of time came out as significant and I was interested in ...
37 views

### How to report orthogonal contrast codes?

In my linear mixed effects model, I had a significant interaction, I followed up the interaction with orthogonal contrast codes to see where the difference was. How do I report my findings, other ...
22 views

### Contrast coding for 2x3 interaction coefficients

I'm using a Bayesian Poisson ANOVA to estimate the strength of interaction between a 2-level and 3-level variable. I'd like to report a single contrast if possible, but I'm not sure how to design the ...
110 views

### Logic of forward or backward difference coding

Two systems of contrast coding for ordinal data are forward difference coding and backward difference coding. I will focus on the latter system here because it seems to be more commonly used, but my ...
41 views

### Can you conduct contrast analyses when interaction effect is non-significant?

I ran a 2 (factor A: A1 vs. A2) X 2 (factor B: B1 vs. B2) between-subjects design experiment. I had an a priori prediction that the effect of factor B (i.e. the difference between B1 vs. B2) would ...
92 views

### Effect size for contrasts tests in ezANOVA

My case: R user. I'm conducting 3-way ANOVA with 1 within and 2 between factors using "ez" library. N = 120, balanced-design. I would like to conduct contrasts tests with corresponding Cohen's D ...
2k views

### Should I be concerned about the warning message in model.matrix.default() - non-list contrasts argument ignored?

I am running a GAMM (mgcv package) with percentage/proportion as the dependent variable and a mixture of categorical and continuous variables, after running most of my models, this is the warning ...
14 views

### Can contrasts that test differences between predictor levels be negative?

I am trying to find a set on contrasts that identify differences between both the type and the time of the predictor. The predictor is set up as follows: A- Temp, 5 Sec B - Temp, 10 sec C- Temp, 15 ...
58 views

### Reporting results of a GLMM with Helmert contrast in fixed effects

I would like help deciding how to report my results. I am looking at whether different demonstrations affect performance in a forced-choice binary task. Demonstrations were done either by a puppet or ...
26 views

### Need of p-value adjustment when analyzing all possible pairs of factor levels in linear model

I have a nominal (not ordinal) variable with $K$ levels (these are actualy some groups of patients) and I run linear model in which: this nominal variable is one of IV's (others are age, sex and so ...
92 views

### How to interpret coefficients obtained from an ordinal variable in a linear regression?

I'm following this example https://stats.idre.ucla.edu/r/library/r-library-contrast-coding-systems-for-categorical-variables/ I was wondering what is the correct interpretation of the coefficients ...
18 views

### between group contrasts using effect coded dummy variables in regression

I was taught a technique for doing this but can no longer figure out why this works, though using a simple data set I am able to prove it. I will go through that proof here as I think it's the ...
46 views

### R - using contrasts to compare all levels of a variable?

I am doing a statistical analysis in R. I made a lmer() model, in which a variable has 4 levels (1,2,3,4). The script sets up a contrast matrix for these levels. Basically, The main hypothesis is set ...
55 views

### Fixed/Mixed effects models - emmeans, contrasts, etc

I'm taking a GLMM course and working through some homework that conceptually isn't that difficult, but is very challenging with respect to implementation in R. The dataset is composed of ...
45 views

### How to compare approximate Bayes Factors (BIC) with glm.nb? (R stats)

I have a situation where I would like to write up an analysis where the statistical significance is non-significant. I wanted to be able to accept the null hypothesis instead of merely 'failing to ...
12 views

### How to set up contrasts in a linear regression models that involve averaging over levels of another factor?

For simplicity, assume we have a linear model which looks like this: Outcome = beta0 + beta1*Treatment + beta2*Time + beta3*Treatment*Time + error where ...
53 views

### Planned Contrasts in Mixed models: group with 3 levels

This analysis is based on data from https://stats.idre.ucla.edu/r/seminars/repeated-measures-analysis-with-r/ with some modifications. Pulse measurements were made at 3 time points (1,2,3) for study ...
57 views

### difference between interaction with anova and contrast functions

I'm trying to understand the difference between the interaction with the anova function and the interaction with the contrast ...
89 views

### Can planned contrasts in ANOVA be one tailed tests?

I have an experiment with 3 within-subject conditions: A, B and C. My dependent variable is reaction time. I am interested in comparing A to B and A to C. Using aov() on R I run an one way ANOVA with ...
13 views

### Scheffe's S Method - help with finding the absolute value of l

I am trying to understand Scheffe's S Method and how the absolute value of l is found. In the example I am reading, the absolute value of l is |-.836| but I have absolutely no idea how this value was ...
242 views

### treatment and sum contrasts, inconsistent results

I am fitting a linear mixed effect models with two factors (mPair with 6 levels, and spd_des with 3 levels) and their ...
227 views

### R - Linear Regression with parameters constraint - contr.sum contrast

I am facing a problem with running a simple OLS regression with two categorical independent variable. I would like to impose that the sum of the coefficients referred to one variable (x in the ...
682 views

### When is deviation coding useful?

After many years of learning about contrasts in linear models I am curious about the relative usefulness of deviation coding, as it is defined by this website. I would appreciate someone filling me in ...
198 views

### How to calculate (standardized) orthogonal contrast coding in R?

I want to determine efficient fractional factorial designs and blocked designs for factorial surveys and am using the R library AlgDesign. The criteria I'm using to determine if a design is efficient ...
536 views

### Difference between Within-Subject Contrasts and Pairwise Comparisons in a Repeated Measures ANOVA

I'm running a two way repeated measures ANOVA, and I'm having trouble finding what is the appropriate output to report (Contrasts vs Pairwise Comparisons). I have a 2x5 design. Lets say I have ...
18 views

### Stratify phylogeny based on variables - e.g. which ST are represented by high % males

So I have tree file and metadata. Metadata includes sequence type ST (clusters that correspond in most part to the phylogeny), but also some patient data, age, sex etc. I am trying to identify which ...
7 views

### Can and should you avoid implicit pretesting for differences in group means?

Suppose I have a population with four (or more) disjoint sub-populations which differ from one another by traitishness, the union of which is the whole population. I have an outcome measure on the ...
58 views

### Simple effects in mixed design with R [closed]

My experiment consists of two factors, one between and one within subject. Time is the between-subjects factor and hold two levels: (low and high). Times is the within-subject factors and hold three ...
198 views

### Problem with Tuckey correction for planned contrasts with emmeans and pairs() in R

I tried to post my question in Stack Overflow but they suggest me to ask to the statistic expert (you), so here I am! I have a mixed design with 1 between factor (Group: ASD, CTR) and three within ...