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

0
votes
0answers
22 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 ...
0
votes
0answers
35 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 ...
0
votes
0answers
10 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 ...
0
votes
0answers
13 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 ...
0
votes
0answers
27 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 ...
0
votes
0answers
22 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 ...
2
votes
0answers
8 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 ...
2
votes
0answers
32 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 ...
0
votes
1answer
39 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 ...
1
vote
0answers
27 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 ...
0
votes
0answers
12 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 ...
1
vote
1answer
118 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 ...
1
vote
0answers
112 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 ...
4
votes
1answer
202 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 ...
5
votes
1answer
106 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 ...
0
votes
1answer
203 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 ...
0
votes
0answers
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 ...
1
vote
0answers
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 ...
2
votes
0answers
52 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 ...
0
votes
1answer
98 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 ...
0
votes
0answers
48 views

Are conditional effects the same as main effects when using orthogonal contrast codes for categorical predictors?

I ran into a presentation discussing the difference between conditional (or simple) effects and main effects when interpreting regression output in the presence of interaction terms. http://www.lrdc....
0
votes
1answer
95 views

Setting up contrasts in lmer?

0 I have 139 subjects (ID), with measurements taken at two time points (Time1, Time2), at 148 brain regions, a dependent measure called volume, and a covariate called thickness. Each subject has 148 ...
0
votes
1answer
62 views

Use contrasts in a 2x2 ANOVA to test directional hypotheses

I think I have a rather simple question. I have a 2x2 ANOVA and I am both interested in the main effects and their interaction. Usually, I'd simply run the ANOVA (type 3) to see whether main effects ...
1
vote
1answer
63 views

changing the coding system from helmert coding to difference coding changes regression results?

EDIT: I think I have mistaken the names of the coding systems, so I changed it (in bold). The content has not changed at all, though, so I would still appreciate any answer. END EDIT I'm running ...
0
votes
1answer
42 views

Orthogonal contrasts, ANOVA, why are there only as many contrasts there are degrees of freedom?

For example, if I have the data $$ \begin{array}{l|l|l|l|l|l|l} A & low & & medium & & high & \\ \hline B & standard & new & ...
0
votes
0answers
20 views

Predictor removed because of rank-deficiency in “lmer” model? [duplicate]

In my current research project, I am looking at the impact of different within-subject experimental manipulations on distance perception. The experiment comprised 40 subjects each providing 144 ...
2
votes
2answers
79 views

How to model repeated measurements with mixed effect models - lme4

I have a dataset of temperature measurements within a day 6 am, 6 pm, for two groups of patients health and flue, There are repeated measurements on the same patient and same timepoint - measurements ...
0
votes
0answers
19 views

How to analyze contrasts? (Factorial and One-way ANOVA)

I have a statistics exam soon. I've been plowing through all kinds of statistical tests but I'm blocking hard on one "process" relevant to ANOVA's. I just don't understand, and I will give you one ...
0
votes
1answer
30 views

How to break down a 2-way factorial interaction into an interaction contrast

Assume the following dataset: ...
0
votes
0answers
59 views

Negative variance of linear combination of regression coefficients

I'm going crazy over this so I hope someone can help me.. First a presentation of my case: I have a complex multiple regression model with 4 predictors (some terms that don't concern this issue are ...
0
votes
1answer
19 views

Is it okay to combine dummy coding and sequence coding?

I have a model with two categorical variables. Each one has three levels. Iv1 has a natural reference category so I would like to use dummy coding, and compare level 2 to level 1, and level 3 to level ...
1
vote
1answer
690 views

Differences between Simple Effects, Pairwise Comparisons, and planned/post hoc comparisons?

I am very confused as to the differences between simple effects, pairwise comparisons, and planned/post hoc comparisons. From what I understand, after running an ANOVA, you would use one of these to ...
1
vote
2answers
55 views

Significant main effects lost during ANCOVA due to interaction terms. Is type III the way to go?

I have some experimental data which I am analysing using step wise multiple regression (ANCOVA) in R using the step function. The response data (wp) is the leaf ...
1
vote
0answers
129 views

What's special about orthogonal contrasts?

In my Design and Analysis class we talked about orthogonal contrasts when it comes to running an ANOVA for one factor of several levels. I understand what it means for two contrasts to be orthogonal. ...
1
vote
1answer
63 views

Combining successive and treatment contrasts in lmer

I am running a lmer mixed effects model with three fixed effects parameters, each having multiple levels: predic1: HH LR RR LD (4 levels) predic3: L1 L2 L3 L4 (4 levels) predic2: A B C D E F (5 ...
1
vote
1answer
22 views

Does it make sense to do a polynomial contrast on a continuous time variable?

I tried running a few polynomial contrasts in SAS for a continuous time variable for linear, quadratic, cubic and quartic contrasts and the F values for each were the same. When I used categorical ...
1
vote
1answer
129 views

Dummy coding versus contrasts: which compares treatment with control?

I have a data set where I want to compare different treatments with a certain baseline. So I basically have a linear model (ANOVA) like this: outcome = b_0 + sum_i(b_i * x_i) with b_i the fitted ...
1
vote
0answers
39 views

Fit GLM using part of the data

I have a single-cell RNA-seq experiment with five different treatments. The treatments are likely to result in different cell types, although this isn't known at this stage of the analysis. Regardless,...
0
votes
1answer
230 views

significance of slope (different than zero) in triple interaction (with factors) for mixed model

I have the following mixed model (package {lme4} in R) : ...
0
votes
0answers
144 views

How to perform general linear hypothesis test on fitted model with treatment contrasts in R?

How should I perform a general linear hypothesis test in R on the coefficients of a fitted model that are represented by treatment contrasts? In particular with regard to the differences between the ...
1
vote
0answers
16 views

Multiple contrasts [closed]

We are currently doing 2 contrasts for a condition variable (3 levels) ...
1
vote
0answers
101 views

Custom contrasts in lmer - reference group?

I am a student working on data and am very confused about custom contrasts in a linear mixed model. I have tried it two ways. Method 1 (inverse contrast matrices): ...
0
votes
0answers
24 views

Means and standard deviation of factor levels in mixed models

I have a response variable (ovs.m <-number of UV-reflecting scales on a lizard individual) and a factor with five levels (Morph: o, ow, w, y, yo). Using Rmisc, I can summarise the mean, sample size,...
1
vote
1answer
106 views

Specifying contrasts using afex

I would like to understand how to specify a contrast in a follow-up analysis using the afex package. Below I included code from the documentation and explain why I ...
2
votes
0answers
227 views

How to perform post-hoc tests with the package emmeans [closed]

After running a generalised linear mixed effect model I have estimated the logit probability by using "emtrends" from emmeans package. The variable Condition is a factor with 3 levels(old,lure,new), ...
0
votes
1answer
228 views

Post-hoc testing in emmeans for mixed-effects models (lme4) with interactions in R

I have a linear mixed effects model (say AxBxC), where all of the 2-way interactions are significant but the 3 way interaction is not, and I want to perform post hoc contrasts on the 2 way ...
0
votes
0answers
48 views

reporting means and standard errors of multiple categories based on lm output

Lets say I have a variable that I model based on two categorical predictors. Here is code to generate data in R: ...
0
votes
0answers
189 views

Please help me understand my contrasts in an lmer model?

I have subjects in four groups and want to compare their scores on a measure called LD. The groups are called DD, DE, GD and GE. At the moment I'm only interested in the contrasts DE versus DE, and GD ...
2
votes
0answers
72 views

Linear mixed model: Setting custom contrasts for interactions and main effects with glht in R

I am currently learning statistics with R, and I am a bit confused about how to set custom contrasts for interaction effects. I tried removing the intercept from my model: ...
5
votes
3answers
877 views

Specify contrasts for lme with interactions

I have used lme to generate a mixed effect model of the response of cells to a certain stimulus. The stimulus is applied 3 times in a row (coded by the Exposure ...