I have a repeated measures dataset with provider-level data (i.e., provider's responds to questionnaires on a scale) and patient outcomes. The providers are nested within clinics and the clinics are nested within regions, and I have four follow-ups up to 24 months (baseline, 6 months, 18 months, 24 months). I am trying to model how well patients do (outcome), with the scores of the providers as the input.
The dataset has over 5000 lines, but here is a sample of what it looks like:
df <- data.frame (patient_outcome= c(46, 80, 63, 63, 40),
patient_ID= c(1, 1, 2, 3, 4),
time= c("baseline", "six_months", "baseline", "baseline", "baseline")
clinic = c(1, 1, 2, 2, 1),
region = c(1, 1, 1, 3, 4),
provider_score=c(1, 3, 4, 2, 1))
I tried to run the following multilevel model to model the effect of the provider score on the patient outcome, accounting for nesting by 1) time, 2) clinic, 3) region.
lmer(patient_outcome~ provider_score+(time|clinic)+ (time|region)+
(time|| patient_ID) , data=df)
However, I keep getting this error message:
Error in eval_f(x, ...) : Downdated VtV is not positive definite
Does anyone have any ideas how I could fix the code?