Hello, I've been trying to run lmer using the code below:
model <- lmer(brain_volume_change ~ blood_leakage_volume + (1 + blood_leakage_volume|SubjectID), data = data_pruned)
I keep getting an error message that says: "Error: number of levels of each grouping factor must be < number of observations (problems: SubjectID)"
Additional info:
- Data was collected at 2-timepoints: baseline and 1-year.
- The variable "blood_leakage_volume" is only data at baseline; "brain_volume_change" was calculated by subtracting the brain volume at 1-year from baseline.
- This study is a repeated-measures design, but I am not sure if the data is structured correctly to use 'lmer'.
I've included a snippet of my dataset below (note: this is my first time trying to place an example of my data in this form. I just followed the instructions in the FAQ. I apologise if this is not how it is supposed to look like!).
I've searched the internet for solutions (and asked ChatGPT), but my problem remains unresolved. Any help would be appreciated.
###---- Sample data
[1] "structure(list(SubjectID = c(23560, 23902, 24189, 24486, 24491, "
[2] "24572, 24623, 24624, 24625, 24677), blood_leakage_volume = c(0.07529, "
[3] "0.00958, NA, 0.03959, 0.04452, 0.07956, 0.0312, 0.02196, 0.07932, "
[4] "0.02943), brain_volume_change = c(-0.370184, 0.3404705, 0.1664023, "
[5] "-0.9712265, NA, -0.933692, -0.970152, -0.8035145, -0.9277315, "
[6] "0.1027567)), row.names = c(NA, -10L), class = c("tbl_df", "tbl", "
[7] ""data.frame"))"