Analysis of covariance (ANCOVA) is a general linear model which blends ANOVA and regression. ANCOVA evaluates whether population means of a dependent variable (DV) are equal across levels of a categorical independent variable (IV) often called a treatment, while statistically controlling for the effects of other continuous variables that are not of primary interest, known as covariates (CV).
Determine main effect while correcting for covariate
1 dependent variable
1 or more independent variables
1 or more covariates
A covariate is a variable that can be a confounding variable biasing your results. By adding a covariate, we reduce error/residual in the model.
Assumptions
Same as ANOVA
Independence of the covariate and treatment effect §13.4.1.
No difference on ANOVA with covar and independent variable
Matching experimental groups on the covariate
Homogeneity of regression slopes §13.4.2.
Visual: scatterplot dep var * covar per condition
Testing: interaction indep. var * covar
Independence of the covariate and treatment effect
Data example
We want to test the difference in national extraversion but want to also account for openness to experience.
Dependent variable: Extraversion
Independent variabele: Nationality
Dutch
German
Belgian
Covariate: Openness to experience
Simulate data
# Simulate datan <-20k <-3nationality <-round(runif(n,1,k),0)nationality <-factor(nationality)levels(nationality) <-c("Dutch", "German", "Belgian")mu.covar <-8sigma.covar <-1openness <-round(rnorm(n,mu.covar,sigma.covar),2)# Create dummy variablesdummy.1<-ifelse(nationality =="German", 1, 0)dummy.2<-ifelse(nationality =="Belgian", 1, 0)# Set parametersb.0<-15# initial value for group 1b.1<-3# difference between group 1 and 2b.2<-4# difference between group 1 and 3b.3<-3# Weight for covariate# Create errorerror <-rnorm(n,0,1)
Power becomes quite abstract when we increase the complexity (i.e., number of predictors) of our models. We can make an F-distribution that symbolizes the alternative distribution by shifting the distribution more to the right (although the interpretability becomes pretty murky..) ::: {.cell} ::: {.cell-output-display} ::: :::
Adjusted/marginal means
Marginal means are estimated group means, while keeping the covariate equal across the groups
These are then the means that are used for follow-up tests, such as contrasts and post hoc tests