My data is a series of repeated measures in time (14 measures). I am trying to model the variable HbA1c
which is a blood test performed at each visit to measure the global blood glucose level. Other predictors are recorded at each visit are BMI, age, insulin dose, and insulin type, etc....
By looking at the data in facetted (per Patient ID) scatter plots ($Y$: parameters, i.e. BMI, age, insulin dose and insulin type; $X$: Visit NR), I see different intercepts and slopes for the included parameters in the model.
So is this the model I am looking for?
HbA1cfit <- lmer(HbA1c ~ VisitNR + BMI + Age + Insulindose + ... +
(1|PatientId) + (BMI|PatientId) + (Age|PatientId) + (...|PatientId),
data=type2diabetes ,REML=F)
The plot of the fitted values vs. the residuals shows a normal distribution with no clear trend. The anova(HbA1cfit1, HbA1cfit2 [or more, each time model + extra parameter])
is significantly better every time.
The scatter plots (y=HbA1cRAW, x=visitNR)
and (y=fitted(HbA1cfit), x=visitNR)
look very similar to me.
One more question: how should I order the parameters in the hierarchy of significance in their determining power towards HbA1c
?
Let me rephrase the whole problem:
Data set:
PatientID Sex VisitNr Age Insulindose Insulintype C-peptide PO-drugs HbA1c
1 f 1 35 50 2 1.5 1 65
1 f 2 36 55 2 1.6 1 66
...
1 f 14 42 60 3 0.2 2 70
2 m 1 60 50 4 2.5 2 80
...
2 m 14 67 40 4 1.3 3 75
...
485 m 1 50 20 3 2.5 2 50
...
485 m 14 57 30 3 2.5 3 55
So data for 485 patients, most of them for 14 visits, if not completed: marked af missing data.
Variables :
PatientId : 1 to 485
Sex : categorical : f or m
Visit nr : 1 to 14
Age : continuous integer, visits are typical 6 months appart , so age goes up with about 7 years from visit 1 to visit 14
Insulinedose: continuous integer
Insulintype: factorial ordened : 1 = 1xlongacting , 2 = 2xmix , 3 = 3xmix, 4 = basal-bolus
C-peptide: continuous double
PO-drugs : factorial ordened : 1 = none, 2 = 1 drug, 3 = 2 drugs, 4= 3 drugs
HbA1c : continuous integer
Questions to solve:
which factors determine the outcome : HbA1c ? Time ? (as visit Nr ?) , Age, Others ??? In what order : most to least to not significant ? Is HbA1c going up or down in time significantly ?
Since there are missing values all over the database and since I am dealing clearly with repeated measures, I tought it might be adressed by lmer in R.
Everything seems to be nested in PtientId , only F or m stays the same in all visits, the other values can all change and do clearly not group the data.
My effort to model this (if appropriate at all) is on top of this post.
Please help , the more I read about lmer the more I get confused.
Jan