# Time-weighted averages using trapezoid rule

#### CassR

##### New Member
I am completing my dissertation with kids with type 1 diabetes. I have clinical data available (a blood test) about general diabetes control. Each kid will have different time periods between blood draws as well as different number of total time this is being monitored. I have seen in other research publications that it might be possible to calculate a time-weighted average using the trapezoid rule from all the different data points I have. Do you know if this is possible in SPSS? If not, how would I go about it manually?

Below you can see a sample of the data

As you can see, there is significant variability between the number of values each participant has as well as the length of time between each value. I was thinking that I could plot the data and estimate the area under the curve, but unsure how to weight each case for time.

#### hlsmith

##### Not a robit
For clarification, you want an overall A1c average not averages for each child, correct? And you want to control for time (time span followed)?

Just curious, A1c's represent an approximate 3 month average of glycated hemoglobin. Are you expecting time trend changes in these patients (worsing, etc.) or did they receive any type of study intervention to influence metrics. Also, do you need to control for age differences between patients? I have seen in some diseases better adherence in younger individuals (under parental control) compared to more autonomous youth not as diligent in medication use?

Last edited:

#### CassR

##### New Member
For clarification, you want an overall A1c average not averages for each child, correct? And you want to control for time (time span followed)?

Just curious, A1c's represent an approximate 3 month average of glycated hemoglobin. Are you expecting time trend changes in these patients (worsing, etc.) or did they receive any type of study intervention to influence metrics. Also, do you need to control for age differences between patients? I have seen in some diseases better adherence in younger individuals (under parental control) compared to more autonomous youth not as diligent in medication use?
Thank you for your reply! I am hoping to get time weighted averages for each child to use as a predictor for my outcomes (performance on cognitive assessment). Yes, I am expecting some change over time, and did not provide any intervention. Regarding controlling for age, I am not sure. HbA1c was not correlated with age in my sample, though length of diagnosis was.

#### hlsmith

##### Not a robit
Well telling us this was a potential predictor in a model is important. What is your sample size and do you expect to control for any other variables? Also, how will the dependent variable be format (what scale will it be on)?

#### CassR

##### New Member
Yes, you are right. This is my first time posting on forums, so I thank you for your patience. For the time-weighted HbA1c, I don't think I will need to control for anything else. Thank you!

#### CassR

##### New Member
My sample size is 36 participants and the dependent scale is scaled scores (norm mean=10), standard score (norm mean=100), or seconds top complete a task.

#### hlsmith

##### Not a robit
Do you have a link to the trapezoid rule you reference?

#### hlsmith

##### Not a robit
Hmm, I will have to looking into that. Though, I will note it comes down to what your hypothesized relationship is. If you think high A1cs are associated with poor cognition - you are using just an average A1c which may not take into account it being really high for awhile causing I guess some type of acute encephalitis and is that worse than chronic low-level elevated A1cs? I don't know but would assume not. I finding these dynamic questions to be tedious. Also, can you convert it to time with an elevated A1c or percentage of time. Maybe run it a couple of ways - exploratory / hypothesis generating. Or is there a proxy to time-series values such as vascular damage in the eye, which may better define disease sequela?

Last edited:

#### CassR

##### New Member
Thank you for your help. I think the % of time with elevated A1c would be useful, and way less difficult. In terms of vascular damage, my study is in children and none of them have these complications yet. I really appreciate your time!