How to test if a variable is a confounder in a repeated-measures design? I would like to test is a given variable is associated with both the dependent and the independent variables (and therefore a potential confounder) in a repeated-measures design.
My model has a continuous dependent variable and two independent variables: a within-subject factor with 6 levels and a between-subject factor with 2 levels. I also have a continuous independent variable that is statistically associated with my between-subject factor (tested using a 2 sample t-test).
How should I test the association between this continuous variable and the dependent variable?
(1) adding this variable to my original model and check the effect of this extra variable?
or
(2) fitting a new model with only my within-subject factor and this extra variable (i.e. without the between-subject factor)?
 A: There is no test for confounding. A pre-treatment variable could be associated both with treatment and with the outcome and it might still not be a confounder; for example, it may be a collider, in which case controlling for it would bias your treatment effect estimate. You cannot use a collapsibility test (i.e., testing whether the treatment effect varies based on whether you control for the variable in question), because controlling for a collider would also change the treatment effect estimate. You need to rely on a causal model to determine whether a variable is a confounder or not, not a statistical test. If the causal model is justified and consistent with the data, causal definitions of confounders can be used to determine if the variable is a confounder.
A: I have been reading up on different ways to operationalize the idea of confounding, particularly in my own repeated measures data which has the added twist of being binary outcomes. In my situation, there are three points in time for each person (I believe some people call that a 3-level "within subject" time effect) and two groups (my 2-level between subjects effect). My potential confounder is each person's age, the mean ages differ between my two groups.
What I settled on was a particularly Epidemiological viewpoint on confounding. My effect measure is the difference in outcome between groups, at each point in time, adjusting for age. The technique I found allows me to look at that effect estimate from a model with age being adjusted and then calculate what those estimates would be without adjusting for that possible confounder. The idea is that "confounding" is the degree to which a putative confounder influences my effect measure. 
I'm not able to provide a succinct and confident description of the method I used. If yo are interested, you can get this concept of confounding from Section 2.3 of this paper 
https://cdn1.sph.harvard.edu/wp-content/uploads/sites/343/2013/03/Confounding_and_collapsibility.pdf
And a method for computing the muA0, muA1, muB0, muB1 components is given in this paper (here's the abstract, at least)
https://www.ncbi.nlm.nih.gov/pubmed/24603316
