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']
449 questions
2
votes
1
answer
115
views
How do I estimate the linear effect for a factor so that my estimate doesn't depend on the sample size?
I’m trying to use the R poly() function with degree 1 to force glm to interpret a factor linearly. I’m puzzled by the fact that the size of the sample seems to increase the coefficient of the ...
0
votes
0
answers
16
views
Would a nested contrast work to look at the effects of a variable that has only some values specified and the rest are NA?
I have a dataframe where I'm studying the effects of a variable, say Word Type (with levels A,B,C,D) on reaction times (RTs). I have manually set treatment contrasts that compare each of these levels ...
2
votes
1
answer
314
views
Why are ordinal variable levels not kept in order in glm?
I've been following the method illustrated here: Polynomial contrasts for regression to transform the results .L, .Q, .C, etc. of a glm ordinal factor regression in the values for each of the levels ...
0
votes
1
answer
65
views
Testing Linear Trend in Ordered Factors Under Unbalanced Group Sizes
I am fitting a linear model, y ~ sex + age_group, to test whether y exhibits a strong linear trend across ...
0
votes
1
answer
82
views
Estimate the changepoint where two marginal predictions converge
I have a dataset of participants performing a maximum work task at various loads, under two conditions c("A", "B"). I would like to estimate at what load work becomes the same in ...
0
votes
0
answers
70
views
Is it possible for a GLM emmeans contrast to be significant if CLs contain 0?
Is it possible for a GLM emmeans contrast to be significant if CLs contain 0 ?
I am running this model
...
2
votes
1
answer
79
views
Adjusting p-values for single post-hoc comparison
I have a linear model in R
my_lm <- lm(Measurement ~ Group, my_df)
where 'Group' has 3 levels (UHR, CC, HC).
I use treatment contrasts to do the following ...
2
votes
1
answer
94
views
Could you make a contrast coding scheme that just compares each level to the previous one?
From what I can tell, Helmert coding seems to be the default coding scheme for ordinal variables in linear regression, where you compare each level to the mean of previous levels.
Would it be valid to ...
1
vote
0
answers
41
views
Custom contrast specification output not consistent with main effects of emmeans [closed]
I have a mixed effects model specified as
complex1.model <- glmer(rt~ mental + alert + (1|subj_id), data = rt.df, family = Gamma(link = "inverse"))
I ...
0
votes
0
answers
35
views
Obtain centered Regressors from `lm` object in R or via transformation
This is to some degree a software and to some degree a purely stats question. I have a design matrix $X$ with categorial and continuous variables. The first column contains only ones. For a given ...
7
votes
2
answers
528
views
Are p-values in summary(lm(...)) in R corrected for multiple comparisons in dummy coding?
When using dummy coding (e.g., contr.treatment) for a categorical predictor in a linear model in R:
...
2
votes
1
answer
99
views
polynomial contrasts in survival models
I have been trying to understand a bit better polynomial contrasts using this resource/example : https://library.virginia.edu/data/articles/understanding-ordered-factors-in-a-linear-model
I know this ...
2
votes
1
answer
82
views
Logistic regression with different contrast specification for Y variable
I am trying to understand how specifying a different contrast for the outcome variable affects the results in proportional odds logistic regression models in R using the polr function. To illustrate ...
1
vote
0
answers
147
views
Contrasts in one-way anova
I am watching one lecture about ANOVA and lecturer gave 3 examples for possible hypothesis for the data:
For hypothesis 3 ($\mu_2 = \mu_1 - 3*\mu_3$) coefficients for contrast don't sum up to zero $(-...
2
votes
1
answer
113
views
How can I compare one group to the mean of all other groups in a longitudinal mixed-effects regression?
I have a longitudinal mixed-effects regression comparing change in depression between two timepoints across 12 groups. I'd like to know if the control group is significantly less effective in reducing ...