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
1
vote
0answers
28 views

emmeans: compare treatment effect across two levels of a category

I want to compare the difference between treatment and placebo across two levels of a factor, lets say gender. This, to answer the question whether there is a significant difference in treatment ...
0
votes
0answers
18 views

Multiple comparison when testing one planned hypothesis

I am running one logit model containing an interaction: logit dv year contract_type yearXcontract+Z where contract_type and year are dummies with 4 levels. After ...
1
vote
2answers
58 views

Prove two orthogonal contrasts are statistically independent

Linear combination $C=\sum_{i=1}^{n} a_i \bar{X}_i$ is called a (estimated) contrast if $\sum_{i=1}^{n} a_i=0$. Two contrasts are called orthogonal if $\sum_{i=1}^{n} a_i b_i = 0$; simplest example ...
2
votes
2answers
30 views

Contrast coding and scaled estimates using emmeans / lmer

I am trying to analyse subgroups of a mixed-effects model using custom contrasts. I have 2 factors F1 and F2, each with 3 levels. My interest is in comparing the groups like this: F1_group1 vs. ...
0
votes
1answer
77 views

Must interacting dichotomous categorical predictors be treated as factors?

If examining the main effects of dichotomous categorical variables, the levels of which are binary and absolute (present/absent), must they be treated as factors rather than numerics? Would the answer ...
4
votes
2answers
113 views

Questions concerning visualizing model results with the R-package visreg

Following some discussions with colleagues, I'm seeking for clarification on how to visualize an ANCOVA with visreg, and what the visualization actually shows. I would like to run the following ANCOVA ...
0
votes
0answers
6 views

Planned contrasts in split-plot experiment

In a split-plot experiment, is it appropriate to use contrasts to compare mainplot-subplot combination treatments? And if so, how might I calculate the standard error of the contrast?
0
votes
0answers
10 views

sum contrasts in R

Can someone help me how to interpret the results from a linear model with the sum contrast in R? I'm working on the data "normtemp" in the R packet "UsingR" I have this result: ...
1
vote
1answer
30 views

calculating selected contrasts with emmeans within treatment

I have a dataset that has data collected at 8 different timepoints and in 5 different treatment groups, and want to do multiple pairwise comparisons. However, I want to run comparisons only between ...
1
vote
0answers
18 views

How do we calculate Standard Errors for effect-coded variables?

I'm a beginner following this UCLA tutorial to figure out how to interpret coefficients for effect-coded categorical predictors and have a couple of questions regarding their regression table below, ...
3
votes
2answers
58 views

Is it preferable to subset data to test specific hypotheses or specify a full model and run contrasts?

Let's say I have a 2x2 design where participants are either in condition A or condition B and, within each condition, either get exposed to exposure C or exposure D. First, I want to test whether ...
0
votes
1answer
37 views

Categorical variable more than two levels

Say for the sake of argument I have a categorical variable called race. The variable has white, black, and Asian levels. I make two dummies (dummy variables) White and Asian (for variable white if 1 ...
0
votes
1answer
35 views

Is it appropriate to only specify the contrasts you are interested in?

I am running some contrasts in R using emmeans, and when I specify my contrasts like this: ...
0
votes
0answers
25 views

Design of contrast for GLM in voxel-wise analysis

I'm attempting voxel-wise analysis of biomedical imaging (DWI-MRI) using FSLs GLM GUI (https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/GLM) but got confused when designing more complex experimental designs. ...
0
votes
1answer
166 views

Contrasts in logistic regression using R

I am trying to use contrasts in a logistic regression using the lme4 package. I have two between-subject categorical variables (both with 2 levels). The first distinguishes between groups 1 and 2; the ...
0
votes
1answer
31 views

Contrasts in linear mixed model with repeated measurements in SPSS

I am currently building a linear mixed model with repeated measurements in SPSS. My syntax is: MIXED measurement BY female mediansplit time WITH age /CRITERIA=DFMETHOD(SATTERTHWAITE) CIN(95) MXITER(...
0
votes
1answer
40 views

Contrast post-hoc test on non-significant factor levels

Is it meaningful to interpret the contrast result from a post-hoc test on factor levels that have non-significant coefficients in the fitted mixed model regression? I'm using a contrast test using <...
0
votes
0answers
12 views

different contrasts gee poisson

I'm running the following gee poisson model on my dependent variable (Counts) with between subject variable "PlayOrder" having 2 levels(PlayOrder1 and PlayOrder2) and within subject variable ...
0
votes
1answer
15 views

Will the number of contrasts in orthogonal contrasts always be number of levels of the factors minus 1?

(I'm working in R) If I want to run a linear model on a dependent variable as a function of a categorical variable with 3 levels (l=3), and I want to use orthogonal contrasts, will I always have to ...
0
votes
0answers
12 views

Contrasts in LMER, one IV

I am performing my first LME. In my data set, I have one fixed factor, “Consistency” (3 levels: con, inc, pro). Subject, Passage, and Stim_set are random effects (stim set just contains a particular ...
2
votes
0answers
53 views

Confidence interval for difference between regression lines

Assume two linear regression models $$ Y_{b} = \beta_{0b} + x\beta_{1b} + \varepsilon_b \qquad \text{with} \qquad \varepsilon_b \sim N(0, \sigma_b^2) \\ Y_{r} = \beta_{0r} + x\beta_{1r} + \...
0
votes
1answer
17 views

Recovering factor level estimates from contrast estimates

Using R I have fit some data to a model of the form y~A*B where A is a factor with levels A1, A2, ..., A5 and similarly with B. I am using a different contrast than the default, so the results do not ...
2
votes
1answer
26 views

How ti specify contrasts for lmer model

I am using lmer in R to check the effect of treatment and a group on some result (y). In my data (dat), there are 3 categorical variables and a continuous response variable: 1 id 1 treatment variable ...
0
votes
0answers
13 views

Why contrast in ANOVA has one degree of freedom?

I thought I understood the degree of freedom after reading Wikipedia explanation, but came across the sum of squares for contrasts $\{c_i\}$ $$SS_C = \frac{(\sum_i {c_i \bar{y_i}})^2}{\sum_i c_i^2 /...
3
votes
0answers
23 views

How does R's aov function 'work better' with orthogonal contrasts?

The help page for R's aov function states: The default ‘contrasts’ in R are not orthogonal contrasts, and aov and its helper functions will work better with such ...
0
votes
1answer
26 views

How do I test that there's a main effect and no interaction with one contrast?

Suppose there's a treatment applied to a cell culture to see if there's an effect on gene expression. The measurements are performed at two time points: 10 and 20 days after treatment. For the sake of ...
0
votes
1answer
127 views

How to test assumptions with a categorical predictor (planned contrasts) in linear regression?

I am using regression with planned contrasts and would like to test statistical assumptions. Assumptions are normally tested on the residuals of the regression model, but in this case, I don't know if ...
0
votes
0answers
30 views

Is there any reason to prefer nested models to pairwise comparisons? Or vice-versa?

I have a 2x2 design, where I am only really interested in one comparison. One level of one condition (let's call it A) effectively serves as a baseline and I am interested in the difference between ...
0
votes
0answers
9 views

Anova results for contrasts in a linear model

I have created contrasts for the qualitative predictors: lmod1 <- lm(Y ~., train.df1, contrasts = list(X6 = contr.treatment, X7 = contr.treatment)) I'm able to ...
0
votes
0answers
132 views

Restricted Cubic Splines - Test Non-linearity in SAS

In SAS, I am having a very difficult time performing a formal test of non-linearity for the effect of one continuous variable estimated using restricted cubic splines. Yes, I know this is easy to ...
1
vote
0answers
101 views

Is it possible to extract confidence intervals for non-reference levels in a lm() model in R? Is there a multiple comparison issue?

I've got a dataset with two categorical predictors (v and m) and a continuous predictor (s). I'm modeling the response with an interaction between the continuous predictor and one of the categorical ...
0
votes
0answers
14 views

Generating Contrasts and F-tests for Multiple Predictors

As far as I am concerned, the weights of the contrasts should be weighted to zero in total. However, there are three examples that I could not construct: ...
0
votes
0answers
31 views

Predefined contrasts with lme4

in my current project I'm interested in setting certain contrasts ahead of analysis. I have five experimental groups, the control one (A), two groups with low dose (B and C) of chemical and two with ...
0
votes
0answers
43 views

Contrast coding for lmer/brms with unbalanced design (R)

I am trying to set up contrasts for a model in lmer/brm for my experiment, which has two factors: a three-level factor number of items (1,2 and 3) and a two level factor similarity between items (sim ...
1
vote
0answers
31 views

Contrasts in ANOVA - need intuitions to understand its sum of squares and its degree of freedom

I have two questions about contrasts in ANOVA for testing the hypothesis that $\sum_i c_i y_i = 0$. How is the sum of squares for contrasts $\{c_i\}$, $SS_C = \frac{(\sum_i {c_i \bar{y_i}})^2}{\sum_i ...
0
votes
0answers
50 views

Wald tests for survival analysis: Contrast matrix for adjacent contrasts

I have an ordinal variable containing 6 categories of risk. I want to compare members of group 1 to 2, 2 to 3, 3 to 4, etc. and assess whether the hazard ratio between adjacent levels is 1.1 or more (...
3
votes
0answers
34 views

How do polynomial contrasts work in ANOVA?

I'm struggling to understand contrasts in the context of ANOVA generally and repeated measures ANOVA specifically. I have experimental data where each subject did a task with 4 levels of difficulty: 1 ...
0
votes
0answers
16 views

How do you interpret the values of the t-statistic in Polynomial contrasts?

I have a predictor variable with 4 levels in an ANOVA design, whose levels are equally spaced apart. I wish to apply apriori polynomial contrasts of the linear, quadratic and cubic kind to find trends ...
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
1answer
53 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
19 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
151 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 ...
1
vote
0answers
44 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
75 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
403 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
170 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
35 views

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

My data looks something like this: ...
0
votes
1answer
112 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
44 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
72 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 ...

1
2 3 4 5
7