# How to Calculate ANCOVA

By Paul Dohrman

Analysis of covariance (ANCOVA) is a more sophisticated form of analysis of variance. It accounts for a shared variable between populations that may be explaining variation. For example, three groups may receive three treatments. Variations between group survivals may be driven by age differences; therefore, controlling for the effect of age by including it as a variable could improve the model's explanatory power.

## Graphical Explanation

### Step 1

Determine the independent and dependent variables, including the covariate. In the above example, the two dependent variables are the covariate, age and which treatment the group received. The covariate should be continuous. Beyond avoiding empty cells, the benefit of this will become clear in the following steps.

### Step 2

Determine the linear regression for each group. In our example, age is an independent variable, survival time is an independent variable and each group has its own line of regression. Age has therefore been accounted for.

### Step 3

Reject the null hypothesis (that the treatments are the same, i.e., that the treatment coefficient is zero) if the difference between slopes is statistically significant.

### Step 4

Determine whether the intercepts are the same if the slopes were not found to be statistically different.

### Step 5

Reject the null hypothesis if the intercepts are significantly different. If the three lines of regression have the same slope but their intercepts are significantly different, then their parallel nature means they won't meet anywhere and the treatments are different.