how to analyse a dataset with both repeated measures and independent measures I am doing a research project looking at the impact of noise on fish behaviour. I have two experimental groups, with one doing a task in the control (silence) condition and the other doing it under noise.
Due to unforeseen circumstances, we did not have the expected sample size of fish to test on so decided to retest 11 of the fish that were already trialled under the opposite conditions. This meant 5 fish were trialled with noise first then silence and 6 fish were trialled with silence first and then noise.
This compares to 18 fish that have only undergone the testing once. Of the 18 fish that underwent testing once, 7 were trialled under silence only and 11 were trialled under noise conditions only.
I was going to do a t-test to compare the performance of the fish under the two conditions but now I am unsure what to do about the mix of repeated measures/independent sampling and wondered if anyone could advise?
 A: This can in principle be handled by a mixed linear model, but you will need to make assumptions about a potential learning effect in the second test. Be prepared to justify your assumptions to a skeptical reviewer.
Use one row of data for each trial, with the outcome, test condition (Silence/Noise), session number (first or second for the fish), and the fish ID noted. That would give you 40 rows of data (29 for all fish at session 1, 11 for the fish additionally tested at session 2).
Then you could use the following model with the R lme4 package (assuming that you have continuous outcome values, like a performance time):
lmer(outcome ~ condition + session + (1|ID), data = yourData)

The model assumes that there is a fixed difference (potentially 0) in expected outcome between the first and second sessions after the condition is taken into account, regardless of the order of presenting conditions. It treats the intercept (estimated outcome at reference) as a Gaussian random effect among the fish.
If that's consistent with your understanding of fish behavior, good. If there's reason to believe that testing first in Silence will have a different effect on subsequent testing in Noise than testing first in Noise will have on subsequent testing in Silence, you would have to modify the model to take that possibility into account.
How much that will help depends a lot on the details of your data. You started with 13 fish tested in Silence and 16 in Noise at the first session. If outcomes are distributed normally with the same SD within each group, you have 80% power (at p < 0.05) to find a difference in means of about 1.09 SD. If you added 5 independent fish tested in Silence and 6 in Noise, that wouldn't increase your power a lot: 80% power for a difference of 0.91 SD.
Re-testing some of the same fish requires estimating an additional coefficient for the session and also estimating the variance of the fish random effect. Needing to estimate more coefficients can reduce your power for the main Silence/Noise effect of interest. The pairing within retested fish might, however, improve your power similarly to how a paired t-test can help. It depends on your data.
