I'm analyzing results from an experiment with a hierarchical structure. There are two groups A and B, multiple subjects within each group, and multiple measurements within each subject. The treatment was applied to subjects, so individual measurements are just replicates of the same condition within each subject. No subject got both treatments A and B. I'm interested in finding out, whether the main effect (A vs B) is significant. I've attempted to achieve this using a mixed linear model with measurement being the dependent variable, A vs B being a fixed effect, and subject being a random effect.
It looks like the random effect subject is accounting for variance that should belong to the main effect treatment instead. It's "syphoning away" variance from the treatment. Accordingly, my main effect appears to have barely any effect. What made me come to this conclusion? When I run a simple t-test with marginal means (took averages from each subject), my main effect comes out significant.
Am I doing something fundamentally wrong here? If not, is there something I can do to overcome this issue? I was thinking if there was a way to force the random factor to only account for variance unexplained by the fixed effect.
I highly appreciate help in any format.