Fixed Effects or Mixed Effects? Assume I have the following model.
lm(DV = BetweenSubjects1 + WithinSubjects1 + Control1 + Control2 + SubjectID, data = df).

BetweenSubjects1 is a binary variable for which of the two groups in an experiment a subject is in.
WithinSubjects1 is a binary variable with four observations equal to zero and four equal to one for each subject. There are about 400 subjects, so about 3200 observations.
Right now when I run this in R I'm told my SubjectID has 3 linearly dependent SubjectIDs. My understanding is that it is doing this because the SubjectID columns are linearly dependent on the BetweenSubjects1 column (which accounts for 2 of the linearly dependent columns). The remaining linearly dependent column is dropped, I presume, because a column always needs to be dropped when using a factor variable as an independent variable.
My question is: Is it okay to use a fixed effects model here, such as the model above, rather than a mixed effects model? If I should run a mixed effects model instead, is that because I have a both a within subjects and between-subjects variable, or for some other reason?
 A: There are other options, notably in the ANOVA framework, but a mixed effects model is the best regression-based option available to get an estimate of the treatment effect you are interested in.
require(lme4)
m1 <- lmer(DV ~ BetweenSubjects1 + WithinSubjects1 + Control1 + Control2 + (1|SubjectID), df)

The above model adjusts for the repeated measures of DV within subjects through the random intercept for SubjectID (lmer reports a variance and standard deviation for the distribution of these intercepts in the random effects output). But the key is that in the mixed modeling framework, the dependent variable is partitioned into within-subjects and between-subjects variance. Between-level predictors only influence between-subjects variance in the DV whereas within-subjects predictors influence both within- and between-subjects variance.
A fixed effects model, on the other hand, only can explain within-subjects variance in the DV. Any between-subjects predictors are perfectly collinear with the subjectID column, as you noted.
