Can I include random slope for a fixed effect if I only have 1 sample from a few subject ID's

This is my first post here at Cross Validated. Im new to both R-programming and statistics and I have a few questions regarding the statistics of a clinical study I'm currently working on that relate to the use of random slopes in regression modeling. To start things off, I feel like I need to briefly explain our study for my question the make sense later.

I'm currently working on a study where the goal is to research if 2 samples drawn in a series from a patient is affect by repositioning of the patient between the two samples or not.

My data consist of 160 observations over 50 subjects. Each observation consist of 2 samples taken 10 minutes after one another with the patient having been randomised to repositioning (1) or not (0) between the samples. Our goal is then to see if the sample results are different between the first and second sample, and if repositioning affect this difference.

Now, for this part we're looking at the number of white blood cells (WBC) in each sample. The difference (in absolute terms) that is possible to observe between samples should in some way depend on how many WBC's there are in the first sample. It stands to reason that if there are 1000 WBC's in the first sample it allows for a greater difference (again, in absolute terms) compared to if there is 1 WBC in the first sample.

# WBC1 = WBCs in first sample
# WBC2 = WBCs in second sample.

x$$diffWBC <- x$$WBC2-x\$WBC1

mod1 <- lmer(diffWBC ~ WBC1 + Repositioned + (1|PatientID), data=x)
mod2 <- lmer(diffWBC ~ WBC1 + Repositioned + (1+WBC1|PatientID), data=x)


The problem is that the patients in our study that have been randomized to repositioning between samples have higher WBC1 compare to the group that has not been randomized to repositioning.

Since WBC1 is higher in repositioned=1 group, I want to make sure that the correlation diffWBC~Repositioned is just not because WBC1 is higher in Repositioned=1 and that the correlation is in the actual repositioning of the patient.

Now to my problem and question: In mod1 I include WBC1 as a fixed effect and I let the intercept vary for each PatientID. Looking at the data, there consist a lot of variation between patients, thus I want to vary the slope for WBC1 as well (mod2). The problem is that some patients only have 1 observation while others have several. Is it possible to vary the slope of a variable for each patient if some patients only have 1 observation? In my mind, random slope only allows for a varying slope (or estimate) for that variable for each patient if there indeed is one. However, I felt I needed to check with people more versed in this since my supervisor who is rather adept at statistics and R-programming wasn't sure I could do it this way.

The results from our modelling become quite different depending on if a random slope is used or not.

The p-values for the fixed effects vary significantly between mod1 and mod2. Where mod1 suggests that only WBC1 is correlated with diffWBC and mod2 suggests that it's indeed repositioning, not WBC1, that correlates with diffWBC.

Thanks in advance and sorry for a wall of text. It's my first post and I'm not sure exactly how much information I had to include. I thought it would be easier to use the exact examples from my data and our study instead of coming up with metaphors. If there are any additional questions or information that I need to answer or supply I'll gladly do so.

*Edited to make the post more focused on the main point.

• (+1) The question is a good one, but I would recommend editing this to focus on the main point. It is a bit longer than necessary and therefore perhaps less likely to attract an answer than it should be. – mkt - Reinstate Monica Jul 17 at 12:39
• +1. Your actual models are more like the last set -- looking at diffWBC rather than relWBC -- correct? Also, did you try (1 + WBC1|PatientID) in this context? I believe your mod2 is implying that the slope and intercept are not correlated, when slopes and intercepts often are. (As a side-note, I believe mod2 could be (1 + WBC1 || PatientID) if you actually did want non-correlation.) – Wayne Jul 17 at 12:46
• All models are relevant for us I believe. It's just that in the last models the difference in p-values is striking depending on if I use random slopes or not. Thanks for the tip, the difference between mod1 and mod2 is still as big, but slightly different. (1+WBC1|PatientID) should indeed be what I'm after. – Marcus Bådholm Jul 17 at 12:52