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
0answers
10 views

Pairing conditions to run lmer

I have six conditions and would like to create three pairs of conditions, so that when I run lmer it compares conditions 1 & 4, 2 & 3, and 5 & 6. Here's what I have at the moment: ...
1
vote
1answer
20 views

Generating a full rank model matrix in R

For a particular tool I need a model matrix which allows me to build desired contrasts and which is a full rank, i.e. no columns are linear combinations of other columns. The experimental design ...
1
vote
0answers
12 views

Validity of setting Singular=1 in proc GLM Contrast statement (SAS)

I am running a proc GLM in SAS with specific contrasts, one of which is included in the code below. With the following code, all my contrasts are always unestimable: ...
2
votes
1answer
48 views

Why do my results regression results change when I change my contrasts?

I have the following dataset ...
0
votes
0answers
9 views

Which SPSS method should I use to conduct my analysis?

I am new statistics and I need to describe a study and then do some analyses using SPSS. I have two groups and I want to ask a dichotomous categorical question, then provide further information and ...
0
votes
0answers
12 views

Estimability of Pararmeteric Functions and Elementary Contrasts

Why do we say that a linear parametric function is estimable when it is in form of an elementary contrasts? I understand that a parametric function is estimable when E(l'Y)= c'β where l=(l1,l2...ln)' ...
0
votes
1answer
25 views

Sum contrast model intercept for multiple factors

How is the intercept calculated for a linear model with multiple factors using contr.sum. From what I've read the intercept is equal to the "grand mean", which as ...
1
vote
1answer
18 views

Contrasts in a Completely Randomized Design (Unbalanced)

Four catalysts that may affect the concentration of one component in a three-component liquid mixture are being investigated. Consider a completely randomized experiment, where $n_1 = 5$, $n_2 = 4$, $...
2
votes
0answers
49 views

Manually give numeric contrast vector for two or more variables (with both deviation and dummy coding) in GLM

I need to manually define contrast in a GLM model implemented in DESeq2 model which performs differential expression analysis on read count data of genes using GLM. I would like to examine which ...
1
vote
1answer
21 views

Why is it necessary to “ignore” a level when applying sum contrasts?

I am confused about how sum contrasts are set up. As I understand, if I have some $K$-leveled factor, I can use sum contrasts to compare each level to the grand mean ($M_G$), effectively testing ...
0
votes
0answers
8 views

Use predict function for average over all levels with contrast.sum

I have a model with Machine as factorial variable. The contrast is set to "contr.sum". ...
1
vote
1answer
51 views

How to compute custom contrasts for linear quantile mixed model from lqmm

I would like to get custom pairwise contrasts and Holm adjustment for a linear quantile mixed model generated using the lqmm and glht functions, but my attempt generates an error. For comparison, I ...
0
votes
0answers
21 views

What is the equivalent contrast to one-way ANOVA

I am working in edgeR, an R package for differential expression analyses of read counts arising from RNA-sequencing. I need to conduct an ANOVA-like test in which the null hypothesis is that all means ...
0
votes
1answer
30 views

How to compute contrats between levels of a parameter in bayesian mixed-effects models and produce bayes factors in R?

I would like to compute contrats between different levels of a parameter from my bayesian mixed-effects models in R, and produce bayes factors. My outcome (Jud) is binary (1=Yes/In synch, 0=No/Out of ...
0
votes
0answers
17 views

Two-way repeated ANOVA in R, got stuck in a case

I am currently doing some two-way ANOVA in Rsutdio. I downloaded a dataset from an article along with its result of ANOVA so that I can check my own result. Here is the head of this dataset and a ...
1
vote
1answer
24 views

R utility for pulling out parameters for individual variable in lm when there are effect modifiers (interactions with categorical variables)

NOTE: I think the emmeans package may be what I'm looking for. Still welcome any input! Suppose I have a regression model $y = \beta_0 + \beta_1 x_1 + \beta_2 x_2 + \beta_3 x_1 x_2$, where $x_1$ is ...
0
votes
0answers
40 views

How to correctly interpret results of logistics regression in R?

I ran a logistics regression on my data where I am trying to predict the affect state using the emotions. I am trying to predict SelfReport State (factors are "FLOW" and "NOFLOW") using the values of ...
1
vote
1answer
76 views

Does a balanced design have to be connected?

Under a general block design setup, consider $v$ treatments allocated to $b$ blocks. Let $r_i$ and $k_j$ be the replication number of the $i$th treatment and $j$ the block respectively. We define $n_{...
1
vote
1answer
19 views

contr.Sum and standard error in R

I want to fit a linear model in R with a categorical variable that takes 3 possible levels. My goal is to check the effect of each level against a global mean, therefore I use contr.sum as contrasts. ...
1
vote
0answers
17 views

R: Why does type III ANOVA require contrasts that sum to zero?

The explanation offered here is "over parameterization" of the multi-way ANOVA model, but I don't understand this statement. In my own fiddling with 2-way, binary factor ANOVA, I can see that the ...
0
votes
0answers
20 views

design a contrast matrix (R) for comparing each levels with the rest

Based on the discussion in this post I wanted to implement a contrast matrix where I am able to compare each level of a factor variable with the average of all others. If I have 3 levels (I am ...
0
votes
1answer
97 views

In emmeans package, how to exclude certain uninteresting contrasts from pairwise comparisons

Let's say I run the following contrast: ...
1
vote
1answer
86 views

Address unequal variance between groups before applying contrasts for a linear model? (r)

My Goal: I have an ordinal factor variable (5 levels) to which I would like to apply contrasts to test for a linear trend. However, the factor groups have heterogeneity of variance. What I've done: ...
0
votes
0answers
15 views

Multiple logistic regression using Helmert contrast in R

I hope someone of you will be able to help me with my multiple logistic regression analysis. So I have a dataset, from which I would like to predict the probability for choosing a certain car based ...
0
votes
0answers
35 views

Confusing result from post-hoc analysis using mixed linear model

I am fitting a mixed model: ...
0
votes
0answers
20 views

Finding Mutually Orthogonal Contrasts

We're given that Contrast 1 is $ ψ_1 = τ_1 - τ_2$ $ ψ_2 = τ_1 + τ_2 - τ_3 - τ_4$ We're suppose to find contrast $ ψ_3 $ such that its mutually orthogonal to $ψ_1$ & $ψ_2 $ given that our ...
1
vote
1answer
51 views

Combining customized contrasts + nested ANOVA (?)

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 ...
0
votes
1answer
94 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 ...
2
votes
1answer
41 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-...
1
vote
0answers
9 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 ...
0
votes
0answers
23 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 ...
1
vote
0answers
34 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 ...
1
vote
1answer
45 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) ...
0
votes
0answers
10 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 ...
0
votes
0answers
6 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 ...
0
votes
0answers
4 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. ...
2
votes
0answers
37 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 ...
1
vote
1answer
88 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 ...
0
votes
0answers
24 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) ...
0
votes
0answers
9 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 ...
0
votes
1answer
55 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 ...
0
votes
1answer
23 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: ...
3
votes
1answer
121 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. ...
0
votes
0answers
78 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 ...
1
vote
1answer
19 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 ...
1
vote
0answers
69 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 ...
1
vote
1answer
92 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 ...
0
votes
0answers
34 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 ...
1
vote
0answers
228 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 ...
0
votes
0answers
58 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 ...

1
2 3 4 5 6