Dear experts,
I wish to calculate the within-individual longitudinal coefficient of variation (CV) of HbA1c results in a large patient database.
I have used
to generate the variance and the population mean accounting for random effects, then calculated CV as within-individual SD/population mean.
But I would like to calculate the CV as within-individual SD/ within-individual mean.
An example of my data is below, with each time the practice_patient_id being repeated meaning there is a repeat measurement. I have hidden a lot of other patient data variables for clarity eg demographic details and prescriptions. idnum is a simplified patient identifier and measnum is the number of repeat measurements for that patient.
I have been able to calculate CV with a within-individual mean using the collapse command, but this loses a lot of ancillary data.
Is there another method of calculating the CV as a within-individual SD/within-individual mean without using the collapse command?
practice_patient_id HbA1c idnum measnum
a6629_001S 6.08564 7 6
a6629_001S 6.81748 7 6
a6629_001S 6.17712 7 6
a6629_001S 6.36008 7 6
a6629_001S 6.17712 7 6
a6629_001S 6.36008 7 6
a6629_001c 9.28744 10 13
a6629_001c 9.56188 10 13
a6629_001c 12.39776 10 13
a6629_001c 8.37264 10 13
a6629_001c 8.18968 10 13
a6629_001c 7.82376 10 13
a6629_001c 8.5556 10 13
a6629_001c 9.013 10 13
a6629_001c 8.18968 10 13
a6629_001c 7.91524 10 13
a6629_001c 10.11076 10 13
a6629_001c 9.56188 10 13
a6629_001c 11.39148 10 13
a6629_002G 6.81748 12 9
a6629_002G 11.84888 12 9
a6629_002G 7.54932 12 9
a6629_002G 6.2686 12 9
a6629_002G 7.09192 12 9
a6629_002G 6.17712 12 9
a6629_002G 7.54932 12 9
a6629_002G 6.63452 12 9
a6629_002G 6.36008 12 9
a6629_002O 5.71972 14 5
a6629_002O 5.99416 14 5
a6629_002O 5.8112 14 5
a6629_002O 6.54304 14 5
a6629_002O 11.02556 14 5
I wish to calculate the within-individual longitudinal coefficient of variation (CV) of HbA1c results in a large patient database.
I have used
Code:
mixed NGSP || practice_patient_id : , reml
But I would like to calculate the CV as within-individual SD/ within-individual mean.
An example of my data is below, with each time the practice_patient_id being repeated meaning there is a repeat measurement. I have hidden a lot of other patient data variables for clarity eg demographic details and prescriptions. idnum is a simplified patient identifier and measnum is the number of repeat measurements for that patient.
I have been able to calculate CV with a within-individual mean using the collapse command, but this loses a lot of ancillary data.
Is there another method of calculating the CV as a within-individual SD/within-individual mean without using the collapse command?
practice_patient_id HbA1c idnum measnum
a6629_001S 6.08564 7 6
a6629_001S 6.81748 7 6
a6629_001S 6.17712 7 6
a6629_001S 6.36008 7 6
a6629_001S 6.17712 7 6
a6629_001S 6.36008 7 6
a6629_001c 9.28744 10 13
a6629_001c 9.56188 10 13
a6629_001c 12.39776 10 13
a6629_001c 8.37264 10 13
a6629_001c 8.18968 10 13
a6629_001c 7.82376 10 13
a6629_001c 8.5556 10 13
a6629_001c 9.013 10 13
a6629_001c 8.18968 10 13
a6629_001c 7.91524 10 13
a6629_001c 10.11076 10 13
a6629_001c 9.56188 10 13
a6629_001c 11.39148 10 13
a6629_002G 6.81748 12 9
a6629_002G 11.84888 12 9
a6629_002G 7.54932 12 9
a6629_002G 6.2686 12 9
a6629_002G 7.09192 12 9
a6629_002G 6.17712 12 9
a6629_002G 7.54932 12 9
a6629_002G 6.63452 12 9
a6629_002G 6.36008 12 9
a6629_002O 5.71972 14 5
a6629_002O 5.99416 14 5
a6629_002O 5.8112 14 5
a6629_002O 6.54304 14 5
a6629_002O 11.02556 14 5
Comment