Calculating area under the curve for glucose responses over time

Hi,
I'm completely new to MatLab having recently downloaded it to create Bland Altman and Clarke error grid analysis.
We recently performed a randomised, open-label, four-period crossover trial consisting of 23-hour inpatient phases in a medically supervised clinical research facility. On each visit, participants administered either a regular (100%) or reduced (50%) dose (100%; 5.1±2.4 versus 50%; 2.6±1.2 IU, p<0.001) of individualised IAsp one hour before and after a 45-minute bout of evening semi-recumbent cycling.
I would like to plot area under the curve at various aspects of these trials i.e. in response to meals/exercise/insulin doses. I have my raw excel data with the glucose cocnentrations of each person and the time gap inbetween each concentration.
Would someone be able to help me understand how best I can do this please? I have read that the integral AUC would be most appropriate when dealing with glucose. if someone has any experience with how to create the graphical data to support this it would be very helpful.
Any help would be greatly appreciated.
Kind regards,
Olivia

9 Commenti

I have no idea what you’re doing, however I have done clinical reseearch in this area and am reasonably proficient in MATLAB. Please post your data, along with the study protocol. (I do not do private consulting.)
Hi Star,
Thanks for trying to help. I've attached the excel file of the data. Alpha, Beta Gamma and Delta refer to the four trials we performed. The venous and sensor derived glucose concentrations for each person and the time in hours between each point is included. For exercise the time is in minutes.
Does this help ?
Olivia
It helps.
I downloaded and opened the file in MATLAB, and looked at it in Excel. I’m confused by it and the organisation. What do you want to do? What parts of each page in the file do you want to plot?
So the same 16 people completed four seperate 23 hour experiemental visits (ALPHA, BETA, GAMMA DELTA). We measured they're glucose (and other hormones) from the vein and from a sensor over the 23 hours.
As part of a secondary analysis I just want to calculate (and plot) the mean AUC for each trial on one graphical display. Using the venous blood data in one graph and the CGM data in another.
For example the attached graph shows the mean venous glucose responses in each of the four trials in response to exercise, or insulin alterations or feeding, but it doesnt not give the AUC.
I would like to know the AUC of each trial and how to display it in a graph.
Thanks
Sorry just to clarify I would like to plot the;
Total AUC
The AUC during exercise
The AUC following the first insulin injection
The AUC following the second insulin injection
and whether these differ between the four trials
I don’t understand. Everything appears to be labelled ‘AUC’ of some description.
What columns do you want to plot?
Where are the insulin injections and the rest annotated?
Colum A is the participant ID (there were 16 participants), each participant had 16 samples taken over 23 hours in each trial (16 in alpha, 16 in beta, 16 in gamma, 16 in delta). Hence there are 16 rows for each person.
Column B is the time ID of the sample i.e. when the sample was taken
Column C is the time in hours.
Column D is the glucose concentration.
Column N is the participant number
Column E is the AUC method I attempted to calculate myself - I have no idea is this is correct.
Colum O is the total venous area for each individual person from the calculation I used in Colum E (if you look at the bold number in Column E it is the same as the one in column O). Colum P is the total sensor area under the curve based on the calculations from K. Again I have now idea if colums E or K are correct.
The first meal-time bolus Insulin manipulation was performed at time 'minus 105'.
Exercise started at minus 45.
Exercise ended at Zero.
The second meal-time bolus insulin manipulation was performed at Insulin was administered again at plus 60.
As I understand it then you want to know if ‘E’ and ‘K’ are correct.
What data did you use to calculate them?
What assumptions did you use? Is the baseline 0 mmol/L or the concentration at the start of each study?
How did you calculate them?
Yes, and then I can treat these statistically to see whether they differ between the trials.
If you click on the square you can see the formular used. It's the trapzeoid methodology
The baseline is the start of each study i.e. The first glucose value of each participant next to the 'breakfast' row.

Accedi per commentare.

Risposte (1)

Looks like your trapezoidal integration is correct. I checked your Excel formula and didn't find anything wrong, and I did the following and got your same numbers for the Delta, patient 4, Venous BG AUC.
xx = [0,3,6,9,10,10.75,11.25,11.5,12.5,13.5,14.5,15.5,17.5,19.5,21.5,22.5]
yy = [10.9,7.2,7.7,6.41,11.4,6.63,7.85,8.92,14.17,15.43,12.01,15.67,15.78,13.42,12.46,9.99];
aa = cumtrapz(xx,yy);
for bb = 2:length(xx)
cc(bb) = aa(bb) - aa(bb-1);
end
disp(cc)
If you're asking to check each integration then that will be a little more work. But as it stands, it looks like your calculations are correct for area under the curve using trapezoidal integration.

3 Commenti

Hi Cameron,
Thank you SO much for checking that and confirming that the methodology is correct.
Can I ask your advise - if I want to generate the mean AUC for ALL participants in delta not just number 4, do I simply enter each person's value in one long row within the yy bracket and do the same for the xx row ?
Thanks so much for helping
[file,path] = uigetfile('.xlsx');
cd(path)
[ALPHAdata,~,~]= xlsread(file,1);
[BETAdata,~,~]= xlsread(file,2);
[GAMMAdata,~,~]= xlsread(file,3);
[DELTAdata,~,~]= xlsread(file,4);
mm = 1;
for startval = 1:16:241
[albg,~] = fillmissing(ALPHAdata(startval:startval+15,4),'linear','SamplePoints',ALPHAdata(startval:startval+15,3));
[alsens,~] = fillmissing(ALPHAdata(startval:startval+15,10),'linear','SamplePoints',ALPHAdata(startval:startval+15,9));
alphabg(mm,1) = trapz(ALPHAdata(startval:startval+15,3),albg);
alphasens(mm,1) = trapz(ALPHAdata(startval:startval+15,9),alsens);
[bebg,~] = fillmissing(BETAdata(startval:startval+15,4),'linear','SamplePoints',BETAdata(startval:startval+15,3));
[besens,~] = fillmissing(BETAdata(startval:startval+15,10),'linear','SamplePoints',BETAdata(startval:startval+15,9));
betabg(mm,1) = trapz(BETAdata(startval:startval+15,3),bebg);
betasens(mm,1) = trapz(BETAdata(startval:startval+15,9),besens);
[gmbg,~] = fillmissing(GAMMAdata(startval:startval+15,4),'linear','SamplePoints',GAMMAdata(startval:startval+15,3));
[gmsens,~] = fillmissing(GAMMAdata(startval:startval+15,10),'linear','SamplePoints',GAMMAdata(startval:startval+15,9));
gammabg(mm,1) = trapz(GAMMAdata(startval:startval+15,3),gmbg);
gammasens(mm,1) = trapz(GAMMAdata(startval:startval+15,9),gmsens);
[debg,~] = fillmissing(DELTAdata(startval:startval+15,4),'linear','SamplePoints',DELTAdata(startval:startval+15,3));
[desens,~] = fillmissing(DELTAdata(startval:startval+15,10),'linear','SamplePoints',DELTAdata(startval:startval+15,9));
deltabg(mm,1) = trapz(DELTAdata(startval:startval+15,3),debg);
deltasens(mm,1) = trapz(DELTAdata(startval:startval+15,9),desens);
mm = mm + 1;
end
The above code should do the interpolation for all the patients in all four trials. Open the AUC MATLAB.xlsx file and your results should be in the alphabg, alphasens, betabg, betasens, gammabg, gammasense, deltabg, and deltasens variables. Upon further inspection of your Excel code, I did notice an error. This comes up when you have a blank spot in your y data which is denoted by a red cell. The code above linearly interpolates the values that do not exist in your spreadsheet. If you do not do that, then it will give you the wrong value. It looks like the exercise data is correct, but I did not verify that. I'll also attach a "fixed" version of your Excel workbook. The results from this should be the same as the MATLAB script. I took out your trapezoidal integration when there were no readings so it should be correct now.
Honestly, I can't thank you enough for helping me with this. It's greatly appreciated. I'll follow your instructions now in MATLAB.
Thanks again
Olivia

Accedi per commentare.

Categorie

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by