It is still not clear to me how to test for intra-patient variability test in R, and I wish to receive some help again.
I have some subjects and each of them has been measured for drug concentration (continuous variable, repeated measurements) and outcome (binary variable Y/N, repeated measurements). Concentration and outcome data vary within an individual on different days. I hypothesize that there is a drug concentration-outcome relationship. I would like to test the effect of intra-patient drug concentration variability on the outcome. My model is:
model1 <- glmer(outcome ~ drug_concen + (drug_concen | patient ID), family = binomial(), data = data1)
It was suggested to me to test for the clustering effect (whether intra-patient variability is zero) via a likelihood ratio test, or compare the AIC values. But I am wondering if my control model should be as follows:
model2 <- glm(outcome ~ drug_concen, family = binomial(), data = data1)
anova(model1, model2)