# Assign a random factor to multiple observations in a factor level, rather than across factor levels?

Assume you have a longitudinal repeated measures dataset from patients whose heartrate is measured while running at two different speeds. Ideally each patient would be measured once a day, but often a patient is not available. You therefore abandon the idea of observing the day-to-day improvement and instead you group the days into weeks (week1, week2, week3, ...). So instead on a few datasamples per day, you have a larger sample with more subjects per week.

Say that for the time being you don't want to compare the weeks, but look seperately in each week onto the difference in heartrate between the slow and the fast speed.

Now, what to do with those patients who made it more than once a week to your study? Is it legitimate to leave their observations in and adress the issue by assigning the subject ID to a random factor?

# week1: w1 = subset(data, week == "1") lme4::lmer(heartrate ~ speed + (1|ID), w1)

Or do you have to crop your dataset so that you have indeed only one observation per subject and proceed with a classical analysis of variance? aov(heartrate ~ speed, data)

Of course, leaving all datasets in increases your sample size, but is it legitimate? Note that here the random factor does NOT model slopes over different levels of a factor (e.g. factor week) as would be usual!

• Can I rephrase your question as "Should I worry if the subjects with repeated measures differ systematically from the subjects with a single measure?" (Eg, non-stationarity of the the response, or different mean response, or different within-subject variance?) In that case, it seems clear that downsampling will not help this concern. Commented Nov 5, 2015 at 19:18
• There might of course be a biasing reason why some attended multiple times and others did not. But assuming this is not the case: would it be ok to have more observations from one subject than from another? And is the right way to adress this to assign a random factor ID? Commented Nov 5, 2015 at 19:24