97 Appendix D Programs for running the IRM ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ function par = initparameters global time_exp gluc_exp insul_exp A P InitialValues SecRate %This program can be run by itself to simulate a single parameter set %(A(28)=0) or be called by aFit.m (A(28)~=0). %P="0", Tells the function of model equations "MMODEw_gut.m", %that its is being called for a single simulation. %=========================================================================== % Control parameters %=========================================================================== Iglag=0; Res=.1; A(30)=0; %Defines A(28), If A(28) not already defined, then it sets it equal to zero. A(18)=0;%index used for counting number of returns to function. %=========================================================================== %Length of time interval for Stand-alone run. %=========================================================================== Minutes = 18; %=========================================================================== %Parameters assumed to be constants %FOR PARAMETER DEFINITIONS SEE TOP OF "MMODEw_gut.m". %That is to find out that A(1)=p1. %=========================================================================== A(1)=.6 ;A(3)=.001 ;A(5)=219.56 ;A(7)=1300;A(11)=.0001 ;A(14)=5.5;A(19)=75; %=========================================================================== %Parameters not actually used: %=========================================================================== A(20)=20; %for parabolic gluc input %=========================================================================== %Parameters that probably vary %=========================================================================== A(4)=.0008 ;A(8)=63;A(2)=84.2 ; %=========================================================================== %Parameters used to describe or measure nature of the desease(diabetes) %=========================================================================== A(6)=.0413 ;A(10)=7.7;A(12)=.0003 ; %=========================================================================== %Set initial values from different data sets, load values from best run %"A(27)=0" allows model to run with the pre-release compartment held constant % ADDITIONAL LINE SET OFF BY %% ARE PARAMETER SETS OF UNKNOWN VALUE %=========================================================================== %A(28)=0; %use if problems occur in clearing the global "A". (After crashes) if A(28)==0;A(28)=1;P=0; %For stand-alone run. A(28) must be set equal to the data set you wish to use end;if A(28)==1;%This is Anderson' IVGTT data with Ig held constant diabtezdataIVGTT;InitialValues=[y12(1,1) 1300 y12(2,1) 216 0];%ivgtt1 A(27)=0;A(3)=.0005 ;A(4)=4.4654;A(6)=.0855 ;A(9)=y12(2,1);A(12)=.0012; end;if A(28)==2;%Sorensen's OGTT data, with Ig compartment held constant diabtezdataOGTT;InitialValues=[y12(1,1) 1300 y12(2,1) 216 0]; A(27)=0;A(3)=.0006 ;A(4)=.0006;A(6)=.038 ;A(9)=y12(2,1);A(10)=6.13; A(12)=.0002; end;if A(28)==3;%This is an unknown data set for the IVGTT. 98 %not fit, will run with default values tgi=LoadData;InitialValues=[tgi(1,2) 1300 tgi(1,3) 216 0]; end;if A(28)==4;%This is an unknown data set for the OGTT. Data=getData;A(27)=0;InitialValues=[Data(2,1) 1300 Data(3,1) 216 0]; A(9)=y12(2,1);A(4)=.0003;A(6)=.036 ;A(9)=y12(2,1);A(10)=8;A(12)=.0006 ; end;if A(28)==5;%This is Anderson' IVGTT data, Ig dynamic. diabtezdataIVGTT;InitialValues=[y12(1,1) 850 7 216*1.2 0]; Iglag=.0001;A(17)=Iglag; A(27)=1;A(1)=.5185 ;A(3)=.0032;A(4)=.0024;A(6)=.038 ;A(9)=8;A(10)=0; A(12)=.0011 ;A(15)=0;A(20)=0; end;if A(28)==6;%Sorensens OGTT1 data, Ig dynamic. diabtezdataOGTT;InitialValues=[y12(1,1) 1300 y12(2,1) 216 0]; A(27)=1;A(3)=.0006 ;A(4)=.0006;A(6)=.038 ;A(9)=y12(2,1);A(10)=6.13; A(12)=.0002 end;if A(28)==7;%Cobelli's OGTT data CobelliDataOGTT;InitialValues=[Gluc_Ins(1,1) 1300 Gluc_Ins(2,1) 216 0]; A(27)=1;A(3)=.0019 ;A(4)=.0005;A(6)=.0135 ;A(9)=y12(2,1);A(10)=4.527; A(12)=.0003 ; end; %=========================================================================== %the best previous parameter set for desired data is loaded in "A" %If used as a guess for "aFit.m" the P=[the parameter numbers to be varied] %The statement below puts those initial parameter values into "par" %=========================================================================== if P~=0;for n=1:length(P);par(n)=A(P(n));end;end %=========================================================================== %For stand-alone run of best parameter set %=========================================================================== if P==0;ODErunNplot;%Call to "ODErunNplot.m" SecRate=[0,0];A(28)=0;%reset global variables End ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ function v = MMODEw_Gut(t,y,par);%With New parameters %global time_exp gluc_exp insul_exp A P SecRate global A P SecRate %=========================================================================== % If being used by aFitMM.m (P~=0), then set test parameter values %=========================================================================== if P~=0;for n=1:length(P);A(P(n))=par(n);end;end %=========================================================================== % set values for easy reading %=========================================================================== G = y(1); Ig = y(2); Ip=y(3);Ir=y(4); p1=A(1); h=A(2); p2=A(3); p3=A(4); IrTop=A(5); S1=A(6); IgTop=A(7);Gb=A(8);Ib=A(9);food=A(10); K1=A(11); K2=A(12); Kabs=A(14);Iglag=A(17);A1=A(15);D_=A(19);ForMinutes=A(20); %========================================================================== %remove negative compartment values(Does not seem necessary) %=========================================================================== %for indx=1:4;if y(indx)<0;y(indx)=0;end;end %=========================================================================== % For using a delay, and running with dde23, no lag => no delay assumed %=========================================================================== Z=y;%remove any lag, Z(1) is a current or a past glucose concentration if t<Iglag;zz=A(8);end;if t>=Iglag;zz=Z(1);end; 99 %Yes is the heaviside function, gdiff is the pos reflection Yes=(zz>h); gdiff=Yes*(zz-h); %=========================================================================== % If compartments Ig or Ir are full, then no more can be added %=========================================================================== if Ig>A(7);p1=0;end; if Ir>A(5);p2=0;end; %must set v, and A(18) is the index on the matrix = number of returns v = zeros(length(y),1); A(18)=A(18)+1; %=========================================================================== %When running stand alone (p=0), displays occasional time values. %=========================================================================== if P==0;if A(18)/20==floor(A(18)/60); disp(t); end;end; %=========================================================================== % Set transfer amounts. %=========================================================================== Ir_in =Ig*p2*(IrTop>Ir) ; %Ir_in => from Ig and into Ir. Ip_in =p3*Ir*gdiff; %Ip_in => from Ir and into Ip %=========================================================================== % for parabolic glucose input. Simple test fitting %=========================================================================== %inlag=8;meal=food*(t>inlag)*(t<ForMinutes+inlag)*(ForMinutes+inlag-t); %=========================================================================== % Natucci's gut compartment. That is, oral glucose infusion from the gut. % For IVGTT data set A(10)=food equal to zero %=========================================================================== Ggut=y(5); Rge = D_*(.014*1.23)*exp(-(.014*t)^1.23);meal = food*(Kabs*Ggut)/1.7 ; dGgut = Rge - Kabs*Ggut;v(5)=dGgut; %if A(20)>=5;meal=17*18*(t<ForMinutes)+(t>=ForMinutes)*3*18;end %=========================================================================== % IRM (To hold Ig constant set A(27)=0, results in a three compartment model) %=========================================================================== dG_dt = ((-S1*(G-Gb) - K1*Ip*G + meal));%Blood glucose concentration dIg_dt = A(27)*((IgTop-Ig)*Yes*p1-Ir_in);%Pre-release insulin compartment dIp_dt = Ip_in - K2*G*(Ip-Ib) ; %Blood insulin concentration dIr_dt = Ir_in - Ip_in ; %Ready-to-release compartment %=========================================================================== % v is function return vector %=========================================================================== v(1) =dG_dt ; v(2)=dIg_dt ;v(3)=dIp_dt ; v(4)=dIr_dt ; %=========================================================================== % Save insulin secretion rate values %=========================================================================== SecRate(A(18),:)=[t,Ip_in + K2*G*Ib]; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %ODErunNplot.m % %Script. Runs the IRM and graphs it %===================================================================== options = odeset('RelTol',1e-5,'MaxStep',Res); 100 %function time interval initial values options [x ,y] = ode45('MMODEw_gut', [0, Minutes], InitialValues, options);x=x';y=y'; %===================================================================== %Plots results %===================================================================== plotMelosh(x,y);%Call ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %plotMelosh: graphs the IRM function v = plotMelosh(x,y); global A SecRate P %===================================================================== %Choose the correct data set for evaluating the model's fit to the data %===================================================================== if A(28)==1;diabtezdataIVGTT;y12(3,:)=y12(2,:);y12(2,:)=y12(1,:);end; if A(28)==2;diabtezdataOGTT;y12(3,:)=y12(2,:);y12(2,:)=y12(1,:);end; if A(28)==3;tgi=LoadData;x12=tgi(:,1);y12(2,:)=tgi(:,2)';y12(3,:)=tgi(:,3)';end; if A(28)==4;tgi=getData;x12=tgi(1,:);y12(2,:)=tgi(2,:);y12(3,:)=tgi(3,:);end; if A(28)==5;diabtezdataIVGTT;y12(3,:)=y12(2,:);y12(2,:)=y12(1,:);end; if A(28)==6;diabtezdataOGTT;y12(3,:)=y12(2,:);y12(2,:)=y12(1,:);end; if A(28)==7;CobelliDataOGTT;y12(3,:)=Gluc_Ins(2,:);y12(2,:)=Gluc_Ins(1,:); x12=Time;end; Igran=y(2,:);Iplasma=y(3,:); %===================================================================== %Plots all compartments and the secretion rate. %===================================================================== figure(1);plot(x,y(1,:),'b-',x12,y12(2,:),'r--'); title('Blood Glucose Concentration, red is data'); figure(2);plot(x,Igran);title('Pre-release insulin'); figure(3);plot(x,Iplasma,'b-',x12,y12(3,:),'r--'); title('Blood Insulin Concentration, red is data'); figure(4);plot(x,y(4,:),'b-');title('Ready-to-release Insulin'); figure(5);plot(x,y(5,:)); xlabel('time (min)'); ylabel('Glucose in Gut (uU/ml)'); legend('model data', 'model simulation'); if P==0; figure(6);plot(SecRate(:,1),SecRate(:,2)); title('Insulin Secretion Rate');axis([0 65 0 150]); end %EvaluateCloseness(x,y);%%Call %======================================================================= % Clear global variables= %======================================================================= if P==0; A=0;time_exp=0;gluc_exp=0;insul_exp=0;InitialValues=0;SecRate=[0,0]; end 101 Appendix E Programs for running the IPM (Overgaard’s and proposed) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ function par = initparameters global time_exp InsSec_exp A P InitialValues GStep SecRate %This program can be run by itself to simulate a single parameter set %(A(28)=0) or be called by aFit.m (A(28)~=0). %P="0", Tells the function of the IPM model equations "RMM.m", %that its is being called for a single simulation. %=========================================================================== % Control parameters %=========================================================================== Iglag=0; Res=.1; A(40)=0; %Defines A(28)----> % If A(28) not already defined,then it sets it equal to zero. A(10)=1;%index used for counting number of returns to function. %=========================================================================== %Length of time interval for Stand-alone run. %=========================================================================== Minutes = 180; SecRate=[0,0]; %=========================================================================== %Set initial parameter values using Rune Overgaard's estimated parameter set % then stores in values the global variable A %=========================================================================== % Kpeak Ksteady t2=6; t3=60; p2=7; gama=.038; gstar=12.5; G=7.5; Kp=240; Ks=25;Gmax=20;Gmin=5; p1=gama*gstar*t3*1;p3=1/(gstar*t3);p3b=p3*100;p4=1/t2;p5=Ks;Gstart=.1;GInt=50; Ig0=0; A(1)=p1; A(2)=p2; A(3)=p3; A(4)=p4; A(5)=p5; A(6)=p3b;A(9)=Gmin; A(10)=0; A(11)=Ig0;A(12)=Kp;A(13)=Ks; A(18)=Gstart;A(19)=GInt;A(20)=Gmax; InitialValues=[ A(11) A(12) A(13) ]; A(7)=100;A(8)=10;%Parameters created as a conversion factors from the data to %that of the similation %=========================================================================== %Options: A(27)=2=>RMM_2_compartment, A(27)=3=> RMM_3_compartment %For the 2 comnpartment ignore the Ir graph %=========================================================================== A(27)=3; Minutes = 60; Res=.1; Iglag=.000001;%used for dde23 %=========================================================================== %Set initial values from different data sets, load parameter values from %best run. A used to transfer global parameter values %=========================================================================== %A(28)=0; %use if problems occur in clearing the global "A". (After crashes) if A(28)==0;A(28)=2;P=1; %For stand-alone run. A(28) must = data set # that you wish to fit. end;if A(28)==1;% Fit to StraubDataFig2; 102 A(1)=45.8*8;A(3)=p3*4;A(4)=p4; A(6)=p3b;A(7)=1;A(8)=1;A(9)=3;A(11)=000; A(12)=185;A(13)=Ks;A(18)=16;A(19)=38;A(20)=16.7;%figure 4.3.2 InitialValues=[ A(11) A(12) A(13) ]; end;if A(28)==2;% Fit to BratanovaDataFig2;; A(1)=45.8;A(9)=3;A(11)=4600;A(12)=139;A(13)=Ks;A(18)=8;A(19)=50;A(20)=15; A(7)=1;A(8)=1;A(18)=7;A(19)=30;%figure Anulo_graph InitialValues=[ A(11) A(12) A(13) ]; end;if A(28)==3;% Fit to AnullosDataFig3A; A(1)=45.8;A(7)=1;A(8)=1;A(9)=3;A(11)=4600;A(12)=143;A(13)=Ks;A(18)=8; A(19)=50;A(20)=15;A(7)=100;A(8)=10;A(18)=4.6;A(19)=30;%figure Anulo_graph InitialValues=[ A(11) A(12) A(13) ]; end;if A(28)==4;% **NOT Done, Fit to BratanovaDataFig4; %A(1)=p1; A(2)=p2; A(3)=p3; A(4)=p4; A(5)=p5; A(6)=p3b; A(9)=2; A(10)=0; %A(11)=1300;A(12)=219;A(13)=Ks;A(18)=1;A(19)=59;A(20)=30;A(7)=.1;A(8)=10; InitialValues=[ A(11) A(12) A(13) ]; end;if A(28)==5;%**NOT Done, Fit to BratanovaDataFig5; %A(1)=p1; A(2)=p2; A(3)=p3; A(4)=p4; A(5)=p5;A(6)=p3b; A(6)=p3b; A(9)=Gmin; %A(10)=0;A(11)=Ig0;A(12)=Kp;A(13)=Ks;A(18)=Gstart;A(19)=GInt;A(20)=Gmax; InitialValues=[ A(11) A(12) A(13) ]; %-------------------------------------------%A(28)>6 fits the new proposed IPM to data %The following parameter sets, are fit using %the porposed IPM equarions. %-------------------------------------------end;;if A(28)==6;% Fit to AnullosDataFig3A; A(1)=45.8;A(3)=p3*8;A(6)=p3b;A(7)=1;A(8)=1;A(9)=3;A(11)=4600;A(12)=140; A(13)=Ks;A(15)=0;A(18)=5;A(19)=28;A(20)=15;A(31)=150;A(32)=4600; InitialValues=[ A(11) A(12) A(13) ]; end;;if A(28)==7;% Fit to StraubDataFig2 A(1)=.458;A(3)=p3*1.5;A(4)=p4; A(6)=p3b/2;A(7)=1;A(8)=1;A(9)=3; A(11)=0;A(12)=190;A(13)=.1*Ks;A(18)=16;A(19)=50;A(20)=17;A(31)=150;A(32)=46000; InitialValues=[ A(11) A(12) A(13) ];%figure 4.3.2 end;;if A(28)==8;%BratanovaFigure 5 A(1)=45.8*.01;A(3)=p3*.5;A(4)=p4; A(6)=p3b/6;A(7)=3;A(8)=-10;A(9)=2; A(11)=4000;A(12)=100;A(13)=Ks;A(18)=9;A(19)=5;A(20)=30;A(31)=150;A(32)=4600; InitialValues=[ A(11) A(12) A(13) ]; end; %=========================================================================== %If P~=0 or 1, then P=[parameter numbers to be varied] and this program is %being called by "aFit.m" %=========================================================================== if P~=0;if P~=1; for n=1:length(P); par(n)=A(P(n)); end;end; end; %=========================================================================== %Run the numerical solver (if run as a stand-alone program) %=========================================================================== if P==1;% Conditional A options = odeset('RelTol',1e-5,'MaxStep',Res); [t, y] = ode23('RMM',[0 Minutes],InitialValues,options) ;%Call RMM.m = IPM %=========================================================================== %Prepare for graphing (if run as a stand-alone program) %=========================================================================== y=y'; Ig = y(1,:); Ir=y(2,:); Ip=y(3,:); %=========================================================================== %Choose data for secretion rate graph 103 %=========================================================================== if A(28)==1;StraubDataFig2;InsSec=A(7)*InsSec+A(8);tgi=[Time;InsSec]';end; if A(28)==2;BratanovaDataFig2;InsSec=A(7)*InsSec+A(8);tgi=[Time;InsSec]';end; if A(28)==3;AnullosDataFig3A;tgi=[Time;InsSec]';end; if A(28)==4;BratanovaDataFig4;InsSec=A(7)*InsSec+A(8);tgi=[Time;InsSec]';end; if A(28)==5;BratanovaDataFig5;InsSec=A(7)*InsSec+A(8);tgi=[Time;InsSec]';end; if A(28)==6;AnullosDataFig3A;InsSec=A(7)*InsSec+A(8);tgi=[Time;InsSec]';end; if A(28)==7;StraubDataFig2;InsSec=A(7)*InsSec+A(8);tgi=[Time;InsSec]';end; if A(28)==8;BratanovaDataFig5;InsSec=A(7)*InsSec+A(8);tgi=[Time;InsSec]';end; %----------------------------------------figure(1);plot(t,y(1,:),'b-');xlabel('time');ylabel('I_g','Rotation',0.0); title('prerelease-granular insulin'); figure(2);plot(t,y(2,:),'b-');xlabel('time');ylabel('I_r','Rotation',0.0); title('ready to release insulin'); figure(3);plot(t,y(3,:),'b-');xlabel('time');ylabel('I_p','Rotation',0.0); title('blood insulin conc'); figure(4);plot(SecRate(:,1),SecRate(:,2),'b-',Time,InsSec,'r-');xlabel('time'); ylabel('ISR','Rotation',0.0);title('insulin secretion rate'); %----------------------------------------%garph combined plots %----------------------------------------A(29)=2; if A(29)==3 figure(5); subplot(2,2,1);plot(t,y(1,:),'b-');xlabel('time');ylabel('I_g','Rotation',0.0); title('prerelease-granular insulin'); subplot(2,2,2);plot(t,y(2,:),'b-');xlabel('time');ylabel('I_r','Rotation',0.0); title('ready to release insulin'); subplot(2,2,3);plot(t,y(3,:),'b-');xlabel('time');ylabel('I_p','Rotation',0.0); title('blood insulin conc'); subplot(2,2,4);plot(t,ISR,'b-');xlabel('time');ylabel('ISR','Rotation',0.0); title('insulin secretion rate'); end %=========================================================================== %Clear global variables (if run as a stand-alone program) %=========================================================================== SecRate=[0,0];A=0; end;% Conditional A ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ function v = RMM(t,y,par);; global A P SecRate; %=========================================================================== % If being used by aFitMM.m (P~=0), then set test parameter values %=========================================================================== if P~=0;if P~=1;for n=1:length(P);A(P(n))=par(n);end;end;end; %=========================================================================== %For monitoring progress, counting returns, displaying time. %=========================================================================== A(10)=A(10)+1;p=A(10); %if (p-1)/100==floor((p-1)/100); disp(t); end; %=========================================================================== %Covnvert global values for easy reading %=========================================================================== Ig = y(1); Ir=y(2); Ip=y(3); p1=A(1); p2=A(2); p3=A(3); p4=A(4); p5=A(5);p3b=A(6);Gmin=A(9);A15=A(15); GStart=A(18);GInt=A(19);Gmax=A(20);IrTop=A(31);IgTop=A(32); 104 %=========================================================================== %Determine the glucose concentration, Glucose step, desired. %=========================================================================== gluc_step %=========================================================================== %Prepare for differential equation %=========================================================================== v = zeros(length(y),1); Yes=G>p2; gdiff=Yes*(G-p2); %=========================================================================== % Choose Overgaard's IPM (A(28) < 6)or the propsed IPM (A(28) >= 6) %=========================================================================== if A(28)<6; %Overgaard's IPM Ir_in = p3*gdiff*Ig; Ip_in = p3b*gdiff*Ir; dIg_dt = Yes*p1 - Ir_in; %Pre-release insulin compartment dIr_dt = Ir_in - Ip_in; %Ready-to-release insulin compartment dIp_dt = Ip_in - p4*(Ip-p5); end; if A(28)>=6; %Proposed IPM Ir_in =Ig*p3*(IrTop>Ir); %Ir_in => from Ig and into Ir. Ip_in =p3b*Ir*gdiff; dIg_dt = (IgTop-Ig)*Yes*p1 - Ir_in ; %Pre-release insulin compartment dIr_dt = Ir_in - Ip_in ; %Ready-to-release insulin compartment dIp_dt = Ip_in - p4*(Ip-p5) ; end; %return v v(1)=dIg_dt; v(2)=dIr_dt;v(3)=dIp_dt;SecRate(A(10),:)=[t,Ip_in + p4*p5]; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %gluc_step ISR if t<=GStart;G=Gmin;;end; if t>GStart;G=Gmax;;end; if t>=GStart+GInt;G=Gmin;;end; %For repeated glucose steps if A(28)==8;% the only data that has repeated glucose steps Gstart2=30; if t>=Gstart2;G=Gmax;;end; if t>Gstart2+ GInt;G=Gmin;;end; end 105 Appendix F Programs for fitting a system to clinical data ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ function EXpar = aFitMM global time_exp gluc_exp insul_exp A P InitialValues close all; %=================================================================================== % Choose output options, parameters to be varied, and the data set to be fit. %=================================================================================== %Show graph updates during process, 0=>no then it runs faster Graph=0;A(29)=Graph;%(Used in MMFunct line 38) % choose parameters to be varied (by parmeter index in global variable A) P=[4 11 12]; %Choose the data set to be fit %1=>OGTT(IVGTT-Anderson), 2=>OGTT(OGTT-Sorrensen), 3=> OGTT("Load data"),4=>OGTT("getData") %5=>NBRM(IVGTT-Anderson),6=>add Ig compartment+OGTT sorensen, 7=>Ig + OGTT cobelli's data A(28)=5; %=================================================================================== %Load data set chosen above %time (minutes) glucose level (mg/dl) insulin level (uU/ml) %---------------------------------------------------------------------------------------if A(28)==1;diabtezdataIVGTT;tgi=[x12;y12]';end; if A(28)==2;diabtezdataOGTT;tgi=[x12;y12]';end;%Sorensens data if A(28)==3;tgi=LoadData;end;%Morris's data if A(28)==4;Data=getData;tgi=Data';end;%data from unknow recorded source if A(28)==5;diabtezdataIVGTT;tgi=[x12;y12]';end;%Anderson's data if A(28)==6;diabtezdataOGTT;tgi=[x12;y12]';end;%Sorensens data if A(28)==7;CobelliDataOGTT;tgi=[Time;Gluc_Ins]';end;%Sorensens data time_exp = tgi(:,1); gluc_exp = tgi(:,2); insul_exp = tgi(:,3); %=================================================================================== % Set optimizer options %=================================================================================== opts = optimset('Display','iter','TolFun', 1e-4,...%'iter' default: 1e-4 'TolX',1e-5,... %default: 1e-4 'MaxFunEvals' , [],... %800 default: 'LevenbergMarquardt','on',... %default: on 'LargeScale','on'); %default: on lb = []; ub = []; %=================================================================================== % Apply optimizer (Returns optimal parameter set "EXpar") %=================================================================================== Guess = initparameters;%Call [EXpar,J,RESIDUAL,exitflag,OUTPUT,LAMBDA,Jacobian]=mylsqnonlin(@MMFunc,Guess,lb,ub,opts); %Call %=================================================================================== % Evaluate solution with optimal parameters (Runs numerical solver with "EXpar") %=================================================================================== options = [];[t,x] = ode45(@MMODEw_gut,time_exp,InitialValues,options,EXpar); plotMelosh(t',x');%Call %=================================================================================== 106 % Output optimized parameter values %=================================================================================== %values=A % If used this line will display entire array of values for parameters and constants for n=1:length(P);A(P(n))=EXpar(n);Disp=[P(n),EXpar(n)] ;end %Will display only new optimized parameter values %=================================================================================== % Clear global variables %---------------------------------------------------------------------------------------A=0;P=0;time_exp=0; gluc_exp=0; insul_exp=0;InitialValues=0;SecRate=[0,0]; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ function D = MMFunc(par) global time_exp gluc_exp insul_exp A InitialValues %This function called by "mylsqnonlin(@MMFunc,Guess,lb,ub,opts);" in % aFit.m returns the residual values when model simulation is compared % to a clinical data set. "mylsqnonlin.m" not included in the appendix % since it is an unaltered matlab tool box program. %=========================================================================== % Weighting scheme %=========================================================================== w1 = 10*ones(size(gluc_exp)); %relative weights for glucose data %w1(1:4) = [10 25 25 25 ]; %w1(15:size(gluc_exp))=10;%sensor first 2 samples w2 = 10*ones(size(insul_exp)); %relative weights for insulin data %w2(1:12) = [10 40 50 50 50 50 50 40 25 25 25 25 ]; %omit from criterion w = [w1; w2]; %=========================================================================== % Run model with test values %=========================================================================== options = []; [t,y] = ode45(@MMODEw_gut,time_exp,InitialValues,options,par);%Call %=========================================================================== % Measure + weigh residuals %=========================================================================== %The following avoids crashes caused by dde23 when data vectors don't match up, %results in throwing out the set of parameter values. if length(y(:,1))==length(gluc_exp);%A if length(gluc_exp)==length(y(:,3));%B glucdif = y(:,1)-gluc_exp; insudif = y(:,3)-insul_exp; D = [glucdif; insudif]; D = w.*D; %=========================================================================== % Show update %=========================================================================== if A(29)==1; %C show update during estimation process N=length(time_exp); set(gcf,'doublebuffer','on'); figure(2); subplot(2,1,1); plot(time_exp(1:N),y(1:N,1),'b',time_exp(1:N),gluc_exp(1:N),'or'); 107 xlabel('time (min)');ylabel('glucose (mg/dl)'); legend('model simulation', 'model data'); drawnow; subplot(2,1,2); plot(time_exp(1:N),y(1:N,3),'b',time_exp(1:N),insul_exp(1:N),'or'); xlabel('time (min)');ylabel('insulin (uU/ml)'); legend('model simulation', 'model data'); drawnow; end;end;end;%all conditionals: A,B, C ended. %The following avoids crashes caused by dde23 when data vectors don't match up, % results in throwing out the set of parameter values. if length(y(:,1))~=length(gluc_exp) for n=1:length(gluc_exp);y(n,1)=10000*n;y(n,2)=1000000*n;end D=[1000000,1000000]; end 108 Appendix G Programs for Clinical Data Sets Clinical Data for Diabetes Tests: IVGTT, OGTT ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %diabtezdataIVGTT % [Anderson] units: gluc=>mg/ml, insulin=>mu/dl x12=[ 2.5 4 5 10 12 13 15 20 22.5 27.5 31 40 51 61 71 80 90 102 123 140 160 175]; y12=[350 283 250 217 212 205 195 192 173 165 140 125 103 89 82 75 70 70 70 71 80 87.5 25 132 85 50 49 42 40 30 30 26 29 20 13 13 11 10 7 10 6.5 7.5 7.5 6.5]; x12=x12-2.5; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %diabtezdataOGTT file "Hipzer master thesis Sorensen"(a web shortcut in favorites/thesis) units: gluc=>mg/ml, insulin=>mu/dl x112=[60 70 080 088 100 110 119 130 138 148 158 168 178 188 197 206 216 227 237 246 256 267 278 286 295]; y12 =[80 88 109 122 123 118 113 105 099 093 091 090 085 082 080 084 076 070 066 064 061 061 061 061 063; 18 30 069 087 095 096 098 096 091 085 080 078 072 068 060 053 048 041 036 031 027 024 021 019 017]; for n=1:length(x112);x12(n)=x112(n)-60;end %for n=3:4; y12(n,:)=y12(2,:);end; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ function tgi = LoadData tgi = [ 0 92 11 2 350 26 4 287 130 6 251 85 8 240 51 10 216 49 12 211 45 14 205 41 16 196 35 19 192 30 22 172 30 27 163 27 32 142 30 42 124 22 52 105 15 62 92 15 72 84 11 82 77 10 92 82 8 102 81 11 122 82 7 142 82 8 162 85 8 182 90 7]; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %getData %data Data3x21(t;G;I); function Data=getData()%from file "OGTT4 has data not printed.pdf" units: gluc=> mmol/L, insulin=>pmol/L Data=[ 000 05 10 15 20 030 040 050 060 075 090 120 150 180 210 240 260 280 300 360 420; 49 49 51 61 75 88 88 84.5 78 71.5 68 58 51 49 48 49 49 49 49 49 48; 109 20 36 60 158 280 445 330 270 280 230 230 140 115 70 50 54 45 41 40 24 20 ]; for m=1:21;Data(2,m)=18*Data(2,m)/10;Data(3,m)=Data(3,m)/6;end ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Clinical Data on insulin secretion ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %BratanovaDataFig2 %Insulin Secretion rate %y = IRI[secretion by percent of content/min], x=time[minutes] %y = 128*IRI[secretion by % of content /min] is the approximate granule release rate /min., Time= [0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30]; InsSec = [ .1 .1 .1 1.2 1.3 .5 .51 .5 .49 .52 .47 .49 .5 .52 .58 .51 ]; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %BratanovaDataFig4 %Insulin Secretion rate %y = IRI[pg/chamber/min], x=time[minutes] Time= [ 0 4 9 15 20 25 30 35 40 45 50 55 60 65 70 75 80]; InsSec = 100*[11 57 30 29 28.5 28 27 26 25 24 23 22 21 15 10 10 09 ]; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %BratanovaDataFig5 %Insulin Secretion rate %Note the 1st 5 min of data was removed averaged about 8 %y = IRI[pg/chamber/min], x=time[minutes] Time= [ 0 5 10 15 20 25 30 35 40 45 50]; InsSec = [ 6 6 22 7 05 05 20 8 5 05 4.8]; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %AnullosDataFig3A.m %Insulin Secretion rate %y = IRI[secretion by percent of content/min], x=time[minutes] %y = 128*IRI[secretion by % of content /min] is the approximate granule release rate /min., Time= [ 0 3 4.6 7 10 13 16 18 20 23 25 28 30 33 35 38 40 43 45]; InsSec = [ 10 10 153 81 55 50 50 48 47 50 53 58 52 44 21 17 10 9 9.5]; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %StraubDataFig2 %Insulin Secretion rate %y = IRI[secretion by percent of content/min], x=time[minutes] %y = 128*IRI[secretion by % of content /min] is the approximate granule release rate /min., Time= 0:2:50; % 12 20 30 40 50 InsSec = [ 3 3 3 3 3 3 3 45 205 108 50 80 98 105 130 150 168 186 204 222 240 258 285 302 300 308]; 110 Appendix H Local Definitions In order to make the paper less wordy some concepts will be given words to refer to them. Thus, the following definitions are used only in this project. Driving terms: A term in a differential equation which directs, pushes or drives to equation to some value. It may do it directly or only in concert with some other equations. In the second case it will be referred to as global driving. Driving terms usually drive the equation to basal values. Basalizing term: A driving term that drives its equation to basal value. Data based function: A function written to create a continuous function that contains all the data points, and is somehow smoothed in between the points. There are different ways to do this, one way is to connect the points by line segments creating a piecewise defined function consisting of linear subfunctions (see subfunction below). Subfunction: A function that is a part of, or included in, a larger function. Repeatability: After running a simulation does a model reset by itself to an equilibrium point such that, if challenged a second time, it can respond in a way comparable to its response to the first challenge. Equilibrium Point: A point, or set of compartment values, which if entered as initial values, will result in the compartments remaining constant. Designed Equilibrium Point: Since driving terms drive, or push, an equation to a specific value, it is possible to write the equations such that they all push to a certain set of compartment values, called a point. If that point is intended to be an equilibrium point then it will be referred to as the designed equilibrium point. It may not actually be an equilibrium point at all. 111 Bibliography Anello, Marcello, Patrick Gilon and Jean-Claude Henquin. "Alterations of Insulin Secretion From Mouse Islets Treated With Sulphonylureas: Perturbations of Ca2+ Regulation Prevail Over Changes in Insulin Content," British Journal of Pharmacology. Stockton Press. 1999. Anderson, K. E., and Højbjerrem, M. "A Bayesian Approach to Bergman’s Minimal Model." 2003. [Retrieved from http://research.microsoft.com/conferences/aistats2003/ proceedings/183.pdf] Barg, Sebastian. "Mechanisms of Exocytosis in Insulin Secreting Beta-Cells and Glucagon Secreting A-Cells," Pharmacology and Toxicology, 92: 3-13. Lund, Sweden: Department of Molecular and Cellular Physiology Department of Physical Sciences, Lund University. 2003. Berglund O. "Lack of Glucose-induced Priming of Insulin Release in the Perfused Mouse Pancreas. J Endocrinology. 114: 185–189. 1987. Bergman, R. N., Ider, Z., Bowden, C., and Cobelli, C. "Quantitative Estimation of Insulin Sensitivity. Journal of Clinical Investigation, 236(6): E667–E676. 1979. Bergman, R. N., Phillips, L. S., and Cobelli, C. "Physiologic Evaluation of Factors Controlling Glucose Tolerance in Man: Measurement of Insulin Sensitivity and Beta Cell Glucose Sensitivity from the Response to Intravenous Glucose." Journal of Clinical Investigation, 68(6): 1456–1467. 1981. Betram, R., and Pernarowski, M. "Glucose Diffusion in Pancreatic Islets of Langerhans." Biophysical Journal, 74: 1729. 1998. Boghosian, B. (2003), "Linearization Stability and Equilibrium." 2003. [Retrieved from http://www.tufts.edu/as/math_38/LectureNotes/linearizationSta…7/1/ 2003] Bratonova-Tochkova, T. K., Cheng, H., Daniel, S., et al. "Triggering and Augmentation Mechanisms, Granule Pools, and Biphasic Insulin Secretion." Diabetes, 51(Suppl. 1): S83–S90. 2002. Breda, Elena, et al. "Oral Glucose Tolerance Test Minimal Model Indexes of Cell Function and Insulin Sensitivity" September 9, 2000. Diabetes, vol 50. Padova, Italy: Department of Electronics and Informatics (E.B., G.T., C.C.), University of Padova. 2001. Caumo, Andrea, and Luzi, Livio . "First Phas Secretion: Does it Exist in Real Life?" American Journal of Physiology-Endocrinology and Metabolism, 387: E371 - E385. 2004. [http://www.the-aps.org/ ] 112 Caumo, Andrea, Bergman, R. N,, and Cobelli, C. "Insulin Sensitivity from Meal Tolerance Tests in Normal Subjects: A Minimal Model Index." The Journal of Clinical Endocrinology & Metabolism, 85, No. 11U.S.A.: The Endocrine Society. 2002. Dalla Man, Chiara, Caumo, A and Cobelli, C. "The Oral Glucose Minimal Model: Estimation of Insulin Sensitivity From a Meal Test," Engineering, Vol. 49, No. 5, Padova, Italy: Biomedical Department of Electronics and Informatics, University of Padova. 2002. Dalla Man, Chiara, et al. "Insulin Sensitivity by Oral Glucose Minimal Models: Validation Against Clamp." (Final Accepted Version E-00076-2005.R2), Articles in PresS. American Journal of Physiology Endocrinology Metabolism (July 12). 2005. Dalla Man, Chiara, et al. "Measurement of Selective Effect of Insulin on Glucose Disposal from Labeled Glucose Oral Test Minimal Model." (Final Accepted Version. E00299-2004.R2). Articles in PresS. American Journal of Physiology Endocrinology Metabolism (June). 2005. Daniel, Samira, et al, Identification of the Docked Granules Pool Responsible for the First Phase of Glucose Stimulated Insulin Secretion, Diabetes, Vol. 48, September 1999 Department of Molecular Medicine, College of Veterinary Medicine, Cornell University, Ithaca, NY. http://www.diabetes.org/diabetes, 1999. Defronzo, R.A., et al. "Glucose Clamp Technique: a Method for Quantifying Insulin Secretion and Resistance." American Journal of Physiology, 237: E214–E223. 1979. Deng, B. "Glucose-induced Period-doubling Cascade in the Electrical Activity of Pancreatic B-cells." Journal of Mathematical Biology, 38: 21–78. 1999. De Gaetano, A. "Some Considerations on the Mathematical Modeling of the Intravenous Glucose Tolerance Test." and "Mathematical Modeling of IVGTT." Journal of Mathematical Biology, Roma, Italia: 2000. Glendenning, P. Stability, Instability and Chaos: an Introduction to the Theory of Nonlinear Differential Equations. New York: Cambridge University Press. 1994. Giugliano, M., Bove, M., and Grattarola, M. (2004). "Insulin Release at the Molecular Level: Metabolic-electrophysiological Modeling of the Pancreatic Beta Cells. 2004. [Retrieved from http://www.cns.unibe.ch/~michi/pub/gbg00.pdf] Hipszer, B. R. "A Type 1 Diabetes Model." Unpublished master's dissertation) p.40. Drexel University. 2001. [Retrieved from http://dspace.library.drexel.edu/retrieve/85/ hipszer_thesis.pdf] 113 Henquin, J. C., Ishiyama, N., Nenquin, M., Ravier, M. A., and Jonas, J. C. (2002). "Signals and Pools Underlying Biphasic Insulin Secretion." Diabetes, 51(Suppl. 1): S60– S67. 2002. Laino, C. "Artificial Pancreas on the Horizon." WebMD. 2004. [Retrieved from http://my.webmd.com/content/Article/81/96942.htm?pagenumber=1.] Li, J., Kuang, Y., and Li, B. "Analysis of IVGTT Glucose-insulin Interaction Models with Time Delay." Discrete and Continuous Dynamical Systems: Series B, 1(1): 103– 124. 2001. Low, R. B. "Endocrine Physiology: Pancreas." 2003. [Retrieved from http://physioweb.med.uvm.edu/Endocrine/] Nagle, R. K., Saff, E. B., and Snider, A. D. Fundamentals of Differential Equations, 5th ed. Boston, Massachusetts: Addison-Wesley. 1999. Natalucci, from Di Nardo, Staffalani, P., De Marzi, C., Morosini, P. and Burattini, R. "Glucose Absorbtion and Insulin Sensitivity from Oral Glucose Tolerance Test." Dept. of Electronics and Atomatics, Polytechnic University of Marches, Ancona Italy. From proceedings of the 25th Annual International Conference of the IEE EMBS Mexico September 17-21. 2003. Peterson, G. L., and Sochacki, J. S. Linear Algebra and Differential Equations. Boston, Massachusetts: Addison-Wesley. 2002. Pillonetto, G., Sparacino, G., and Cobelli, C. "Numerical Non-identifiability Regions of the Minimal Model of Glucose Kinetics: Superiority of Bayesian Estimation." Mathematical Biosciences, 184(1): 53–67. 2003. Pillonetto, G., Sparacino, G., Magni, P., Bellazzi, R., and Cobelli, C. "Minimal Model SI = 0 Problem in NIDDM Subjects: Nonzero Bayesian Estimates with Credible Confidence Intervals." American Journal of Physiology – Endocrinology and Metabolism, 282(3): E564–E573. 2002. Rorsman1, P. (1997). "The Pancreatic Beta Cell as a Fuel Sensor: an Electrologist's Viewpoint." Diabetologia, 40(5): 487–495. 1997. Rorsman2, P., and Renström, E. (2003). "Insulin Granule Dynamics in Pancreatic Beta Cells." Diabetologia, 46(8): 1029–1045. 2003. Overgaard, Rune, V. I. "Modeling the Insulin Secretory System." Technical University of Denmark. 2000. [Retrieved from http://www.imm.dtu.dk/~rvo/IPM.pdf] 114 Safonov, L. A., Tomer, E., Strygin, V. V., Ashkenazy, Y., and Havlin, S. "Multifractal Chaotic Attractors in a System of Delay-differential Equations Modeling Road Traffic." Chaos: An Interdisciplinary Journal of Nonlinear Science, 12(4): 1006–1014. 2000. Jörg Schirra, et al. "Gastric Emptying and Release of Incretin Hormones after Glucose Ingestion in Humans."The American Society for Clinical Investigation, 97,1: 92–103. 1996. Straub S. G., Shanmugam G., Sharp G. W. "Stimulation of Insulin Release by Glucose Is Associated With an Increase in the Number of Docked Granules in the Cells of Rat Pancreatic Islets," Diabetes, Vol. 53. 2004. Shiel, W. C. Jr., and Mathur, R. (2003). "Diabetes Mellitus." 2003. [Retrieved from http://www.medicinenet.com/Diabetes_Mellitus/article.htm] Topp, B., Promislow, K., de Vries, G., Miura, R. M., and Finegood, D. T. "A Model of Beta-cell Mass, Insulin, and Glucose Kinetics: Pathways to Diabetes." Journal of Theoretical Biology, 206: 605–619. 2000. Troitza K. Bratonova-Tochkova, et al. "Triggering and Augmentation Mechanisms, Manual Pools, and Biphasic Insulin Secretion," Diabetes, Vol. 51, (Suppl. 1). Ithaca, N. Y. Cornell University Department of Molecular Medicine. 2002. Zijlstra, E. "Estimation of Glucose Kinetics and Insulin Sensitivity from an Oral Glucose Tolerance Test and Use of Two Glucose Tracers with a Compartmental Modelling Approach." Eindhoven University of Technology, Department of Biomedical, Engineering,Department of Electrical Engineering. 2002. Unknown Author, Details of Insulin and Glucagon Secretion. Internet-- copy on CD ROM