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
1answer
11 views

Isn't “contrast coding” just a weird way to write a mixture model?

My background is in CS and ML, so I am quite familiar with hierarchical Bayesian models -- and probabilistic programming. But I do not have much experience with traditional statistical methods. This ...
1
vote
0answers
13 views

Orthogonal contrasts and the family-wise error rate

I recently read about contrasts and how to code them. Contrasts can be orthogonal which means that they are independent and the statistical tests for them are not correlated. Normally, when doing ...
0
votes
0answers
7 views

How to create contrast matrix model manually from GAM output

I have run a general additive mixed model and would now like to see if the levels of the two factor variables are statistically different from one another. An example of my data and code for this ...
1
vote
1answer
20 views

Analysing SPSS two-way ANOVA output: Tests of Within-Subjects Contrasts

I used SPSS to run a two-way within subjects ANOVA (IV1 and IV2). The IV1 * IV2 interaction was not significant but main effects of both IV1 and IV2 were. I would like to know if the trends followed a ...
0
votes
0answers
8 views

Contr.sums and contr.poly question?

I know that contr.poly creates orthogonal polynomials of degree 1, 2, etc. so that you can determine if there is a particularly mathematical pattern (e.g., linear, ...
0
votes
0answers
49 views

Contrasts Coding - Using contr.sum on many variables in regression - interpretation of variables in R

In short, my understanding of using contr.sum on categorial variables in regression allows one to specify the reference level of the estimate (coefficient) to the grand mean of all other levels in the ...
7
votes
1answer
385 views

Statistics Help: Difference between Differences?

I don't know that this is really the right forum to be asking this, but I'm hoping for some statistics help. I have 4 conditions: A, B, C, D. I'm looking to determine whether the difference between A ...
4
votes
1answer
60 views

Controlling for baseline in pre-post between design: using $\Delta(T_2-T_1)$ or controlling for T1 in the regression model (or both)? [duplicate]

I have a mixed between-within design, with three groups and Pre (T1) and Post (T2) measurements. I'm hesitating on the right statistical analyses to do, but I would like to compare each group to the ...
4
votes
1answer
30 views

How do I approach a linear mixed effects model with a 2-level group?

My data looks something like this: ...
0
votes
1answer
26 views

Is the “mvt” (using the multivariate t distribution) accepted way of adjusting for multiple comparisons when reporting to journals?

I use the awesome package multcomp and emmeans in R. These are the places I heard about the "mvt" method for the first time. And, however, it is what it's actually done in the Dunnett or ...
0
votes
0answers
22 views

Why do contrasts influence singular fits with mixed models?

I've fit a linear mixed effects model to some data in R with afex::mixed. I'm interested in the fixed effect and have no expectations for the random effects ...
1
vote
0answers
28 views

Contrasts for distributional parameters in a shifted log normal distrbution

I’m playing around with shifted log normal distributions in brms (for reaction time data), trying to get my head around the parameter estimates and also how to do contrasts with them using the emmeans ...
0
votes
0answers
10 views

Difference in Difference Contrasts for Experiments : Application in R

Note this is different (pun intended) from differences in differences models for observational data. I have the following setting . I have two categories.Say Male and Female. Each category can be ...
3
votes
2answers
40 views

Unfamiliar with 'contrast' function

Stata has a 'contrast' function after using a regression on a categorical variable. What this essentially does is compare each level of the categorical variable to the mean of the dependent variable. ...
0
votes
0answers
16 views

Transforming contrast estimates to mean differences - how do SEs and 95%CIs change?

When we use Helmert contrasts (or any contrasts) in R, we get an output like this: ...
0
votes
0answers
21 views

Interpreting differences in categorical parameter estimates bayesian model

I've built a model using brms to describe ln-transformed gut length in fishes as predicted by diet, ln-transformed body length, the method used to measure the gut, and a couple of random variables (...
0
votes
0answers
14 views

Can I use Helmert coding for two level categorical variables?

When I use Helmert contrast in R for two level categorical variables it codes the levels as -1 and 1. This is fine with me but I was not sure if I am doing this wrong because generally Helmert coding ...
1
vote
0answers
36 views

Effect size for contrasts in mixed model

I was wondering on how to compute effect sizes for planned contrasts in (generalized) linear mixed effects models. First, I set up multiple models with main effects and interactions and compared them ...
1
vote
0answers
14 views

LRT signficiant but not planned contrasts (mixed model)

I set up multiple models (each model adding a main effect and an interaction) with glmerfrom the R package lme4. Conducting a ...
1
vote
1answer
38 views

Can contrasts and interaction contrasts be identical in linear mixed model?

I have a doubt with respect to the estimated marginal means of a linear mixed model. I performed a mixed model like the one in the example below: ...
4
votes
1answer
65 views

Why Helmert coding in R divides subsequent differences

This question is about a weird behavior of Helmert coding in R as implemented in the standard contr.helmert function. First of ...
0
votes
0answers
18 views

How contrast coefficients are computed in linear trend analysis

I am teaching myself trend analysis. I mostly learned from the following two sources. (1) The book "Designing experiments and analyzing data" by Harold D. Delaney and Scott E. Maxwell. I ...
0
votes
0answers
12 views

Set up and analyse planned contrasts in lmer() from lme4

I would like to analyse planned contrasts in my lmer() model from the lme4package. I have three factors: group (levels: trt, ...
0
votes
0answers
4 views

ANOVA with Treatment Constrasts when utilizing Parsnip

I have a minimal example below: ...
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: ...
2
votes
1answer
77 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
10 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
20 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
32 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
20 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$, $...
3
votes
0answers
70 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
26 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
110 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
25 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
55 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
20 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
38 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
41 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
93 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
36 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
35 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
25 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 ...
1
vote
1answer
320 views

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

Let's say I run the following contrast: ...
1
vote
1answer
132 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
47 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
37 views

Confusing result from post-hoc analysis using mixed linear model

I am fitting a mixed model: ...
0
votes
0answers
29 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
2 3 4 5
7