# ANCOVA in within-subject design

I have two questions regarding an ANCOVA analysis in SPSS in a within-subject (i.e., repeated measures) design (e.g., an experiment with 3 measurement timepoints):

1. when checking ANCOVA assumptions, the covariate (e.g., age) needs to be correlated with the outcome variable (e.g., cognition). Do I need to correlate the covariate with the outcome variable at each of the three timepoints (e.g., 3 correlation analyses) or correlate the covariate with the mean of the outcome?

2. Although centering continous covariates workes quite well, how can I apply some form of centering/demeaning in binary categorical variables (e.g., gender)? When I tried to use (un-)weighted effect coding instead of the dummy coding, SPSS is not able to estimate the marginal means and any effects (e.g., within x covariate interaction) anymore?

Thank you for your help!!!

• Can you share the source of the assumption in (1)? It does not make much sense. Oct 19, 2023 at 8:40
• what do you mean exactly? The covariate needs to be correlated with the outcome variable (y) in order to explain some of the error variance (to my knowledge the reduction of error variance is the purpose of conducting an ANCOVA). So they need to somehow influence the outcome (see: statisticsbyjim.com/anova/ancova). You can also find a variety of research papers addressing this assumption. Oct 19, 2023 at 9:26
• As AdamO nicely explained, that is not a statistical assumption. And it is not listed under the assumptions in the link you posted. Oct 19, 2023 at 15:03

## 1 Answer

1. The assumption that age is correlated with cognition is not a statistical assumption, but rather a scientific assumption and there's no need to prove it in a given analysis. It's one thing if the actual null hypothesis concerns this correlation (but why would this even be of interest?), but as an adjustment or blocking variable in analysis no relationship is required or guaranateed to exist. Consider that if you adjust for mediating variables - such as markers of age-related cognitive decline, i.e. tau tangles and beta-plaques, telomere length, etc., you might ameliorate the age effect entirely as evidenced by a non-significant test for the age effect in a multivariate model.

2. In my experience, it's rarely necessary to provide so many post-hoc estimates from a single multivariable model. If the analyst understands and can interpret the model effects, then there should be no need to marginalize or use LSMEANS. That said, categorical variables are typically encoded using an orthogonal contrast where the intercept corresponds to the grand mean of the response for the first categorical variable, and subsequent terms are expected differences. If you rather use the ANOVA contrasts, the intercept term is ablated and you have terms for grand means in each category.

• Thank you for your reply. Can you please elaborate a bit regarding the first question. Even if it is not considered a statistical ssumption, I'd still like to know if the covaraite should be correlated to the mean of the outcome (averaged over the 3 measurement timepoints) or correlated to each single timepoint (e.g., 3 separate correlation analyses) [consider it a scientific assumption] Oct 20, 2023 at 7:45