Skip to main content

A fractional differential equation model for continuous glucose monitoring data


The main aim of this research was to test if fractional-order differential equation models could give better fits than integer-order models to continuous glucose monitoring (CGM) data from subjects with type 1 diabetes. In this research, real continuous glucose monitoring (CGM) data was analyzed by three mathematical models, namely, a deterministic first-order differential equation model, a stochastic first-order differential equation model with Brownian motion, and a deterministic fractional-order model. CGM data was analyzed to find optimal values of parameters by using ordinary least squares fitting or maximum likelihood estimation using a kernel-density approximation. Matlab and R programs have been developed for each model to find optimal values of the parameters to fit observed data and to test the usefulness of each model. The fractional-order model giving the best fit has been estimated for each subject. Although our results show that fractional-order models can give better fits to the data than integer-order models in some cases, it is clear that the models need further improvement before they can give satisfactory fits.


Insulin and glucagon are hormones that are produced in the pancreas and which control the level of glucose in the blood (see, e.g., [13]). If blood glucose is high, the pancreas secretes insulin into the bloodstream to decrease glucose level. If blood glucose is low, glucagon stimulates breakdown of glycogen and synthesis of glucose from circulating precursors to increase glucose level. A model of the insulin-glucose system is shown in Figure 1.

Figure 1

A model of the insulin-glucose system [ 1 ].

Diabetes Mellitus, or diabetes, is a disease which occurs when there is a malfunction in the insulin-glucose system.

There are two main types of diabetes [4], type 1 and type 2. Type 1 is sometimes known as insulin-dependent diabetes. In this type, the pancreas does not produce insulin. It is thought to be an auto-immune disease in which the immune system attacks the cells of the pancreas. Patients will need to take insulin injections throughout their life to control blood glucose level.

Type 2 is sometimes called non-insulin-dependent or adult-onset diabetes. In this type, the pancreas either produces insufficient insulin with respect to the heightened demands of relatively insulin-resistant peripheral tissues or the cells of the body do not react to insulin. This type normally occurs in older people and is more common in people who are overweight and physically inactive.

In this paper, we concentrate on type 1 diabetes. People with type 1 diabetes can wear a continuous glucose monitor (CGM) [5] as shown in Figure 2 to help them control their glucose level. However, it is also recommended that they check the accuracy of the CGM measurements with a finger-stick test (see, e.g., [6]). A CGM [5] is a device that measures blood glucose levels every 5 minutes. The glucose sensor has a tiny needle to measure glucose levels in tissue fluid, and the information is then sent to the monitoring device. If glucose levels are abnormal, it will give an alarm to the wearer. The CGM can also be combined with an insulin pump that will inject insulin if the glucose levels become too high. An example of observed CGM data for a subject with type 1 diabetes is shown in Figure 3.

Figure 2

Examples of a CGM device [ 5 ].

Figure 3

Example of observed CGM data [ 5 ].

A survey of the successes, challenges and opportunities of CGM has recently been given by Rodbard [7, 8] (see also Khatri [9]). Among the problems mentioned by Rodbard for CGM are the errors in CGM measurements of approximately \({\pm}10\%\) and day-to-day variability in glycemic patterns of individuals. As a result of these types of problems, mathematical modeling of CGM data has proved to be very difficult. As far as the present authors are aware, there have been no satisfactory mathematical models of the changes in glucose level of people with type 1 diabetes, and there have been no previous attempts to develop fractional-order models.

In this paper, we consider observed CGM data for six subjects and analyze the data with three different mathematical models using R and Matlab programs to find optimal values of the model parameters to fit the observed data. The three models are: (1) a deterministic first-order differential equation model, (2) a stochastic first-order differential equation model, and (3) a fractional-order deterministic differential equation model. For these three models, we show that best fits are obtained from a fractional-order model with fractional orders in the range 1.5 to 2.5.

First-order differential equation models

Deterministic model

For the purpose of this model, we consider that insulinemia (insulin in the blood) is constant.

$$ dG = \bigl(k_{GX}-k_{XG}G(t)\bigr)\, dt, \qquad G(0)=G_{b}, $$

where \(G(t)\) (mM) is a state variable of glucose concentration in the blood at time t, \(k_{XG}\) (min−1) is a constant rate of glucose elimination from the blood into the external environment, represented by X. \(k_{GX}\) (mM/min) is a constant rate of glucose entering the blood from the external environment. \(G_{b}\) is basal glycemia (resting glycemia). The solution of equation (1) is as follows:

$$ G(t) = G^{*}+\bigl( G_{b}-G^{*}\bigr)e^{-k_{XG}(t-t_{0})}, \quad G^{*} = \frac{k_{GX}}{k_{XG}}. $$

\(G^{*}\) is the steady-state solution and \(G(t_{0})=G_{b}\), where \(G_{b}\) is called the basal glucose level.

The parameters to be estimated are the basal glycemia \(G_{b}\) and the rate constants \(k_{GX}\) and \(k_{XG}\). The parameter \(\theta^{T}=[G_{b},k_{GX},k_{XG}]\) can be obtained by optimization, minimizing the ordinary least squares (OLS) loss [10].

$$ l(\theta) = \sum_{i=1}^{N} \bigl(G_{i}-\hat{G}_{i}(\theta)\bigr)^{2}, $$

where \(\hat{G}_{i}(\theta)=\hat{G}(t_{i},\theta)\) is obtained either from the exact solution in equation (2) or by numerical integration of equation (1), e.g., with an Euler or fourth-order Runge-Kutta method (RK4).

Stochastic model

We can also modify model (1) by introducing a stochastic component with fixed volatility \(\sigma_{G}\), representing on the one hand variable food intake, and on the other, variable glucose consumption due to activity, like exercise etc. We consider a Wiener process (Brownian motion) for the stochastic term.

$$ dG = (k_{GX}-k_{XG}G)\, dt+ \sigma_{G}\, dW, \qquad G(0)=G_{b}, $$

where the parameter estimation is for \(\theta^{T}=[G_{b},k_{GX},k_{XG},\sigma_{G}]\). The stochastic term \(\sigma_{G} dW\) represents the differential of a scaled Wiener process (see, e.g., [11]).

The model can be integrated by the Euler-Maruyama method [11]: let \(\{t_{0},t_{1},\ldots,t_{n}\}\) be a sequence of times at which the numerically integrated solution is desired, then

$$ \begin{aligned} &\hat{G}(t_{0}) = G(0)=G_{b}, \\ &\hat{G}(t_{i}) = \hat{G}(t_{i-1})+\hat{f}(t_{i-1}) \Delta(t_{i})+\sigma_{G}z_{i}, \\ &\hat{f}(t_{i-1}) = k_{GX}-k_{XG} \hat{G}(t_{i-1}),\qquad \Delta(t_{i}) = t_{i}-t_{i-1}, \qquad z_{i} \sim \mathcal{N}\bigl(0,\Delta(t_{i})\bigr), \end{aligned} $$

where \(\mathcal{N}(\mu,\sigma^{2})\) is the normal distribution with mean μ and standard deviation σ.

Parameter estimation can be carried out either by ordinary least squares or by Markovian maximum likelihood (MLE) [12] approximated by kernel density estimation (KDE) [13], maximizing with respect to the following quantity:

$$ \begin{aligned} &\widetilde{l}(\theta) = \sum _{i=1}^{n} \widetilde{l}_{i}(\theta),\quad \mbox{with } \widetilde{l_{i}} (\theta)= \widetilde{p_{i}}(G_{i}| \theta), \\ &\widetilde{p_{i}}(x|\theta) = \frac{1}{n}\sum _{j=1}^{n} \frac{1}{h\sqrt{2\pi}}e^{-\frac{1}{2}(\frac{x-\hat{G}^{j}_{i}}{h})^{2}},\quad h=1.06\sigma_{G}\sqrt[5]{n}, n = 100, \end{aligned} $$

and where

$$ \hat{G}_{i}^{j} = \hat{G}^{j}(t_{i}) = \hat{G}^{j}(t_{i-1})+\hat{f}^{j}(t_{i-1}) \Delta(t_{i})+\sigma_{G}z_{i}^{j}, $$

as given in equation (5).

Notice that to every realization j of \(z_{i}^{j}\), there corresponds a different \(\hat{G}_{i}^{j}\), \(j=1,2,\ldots,n\).

Results of fitting first-order models

We have written R programs to test the first-order deterministic and stochastic models. We have found the following:

First-order deterministic model

  1. 1.

    The fit using ordinary least-squares gives a constant value for \(G(t)\) and an estimate for the ratio of parameter values \(\frac{k_{GX}}{k_{XG}}\) and not separate values for \(k_{GX}\) and \(k_{XG}\), i.e., it gives the steady-state solution of equation (1).

  2. 2.

    This model does not give a good fit to the data.

First-order stochastic model

  1. 1.

    For numerical stability, numerical solution using the Euler-Maruyama method requires a step size that is much smaller than the time (5 minutes) between measurements in the CGM data.

  2. 2.

    The choice of step size in the Brownian motion term causes problems. If the step size between CGM measurements (5 minutes) is used in the Euler-Maruyama method, the solution is unstable. If the step size for stability of the Euler-Maruyama method is used, then the Brownian motion term is very small.

  3. 3.

    The fit using the KDE approximation method gives very small values for the variation parameter \(\sigma_{G}\) and fits close to the deterministic model.

  4. 4.

    The first-order models do not give a good fit to the CGM data. However, they have been useful for developing R-programs and testing some of the algorithms to be used in the stochastic fractional differential equation models.

Fractional differential equation models

Because the first-order models do not fit the data, we look at higher-order models. To obtain the observed periodic behavior, our aim is to consider, in general, both deterministic and stochastic models with fractional orders in the range from approximately 1.5 to 3, with the fractional order chosen by fitting the CGM data. However, in this paper we will describe and give detailed results only for the deterministic fractional-order model.

Deterministic model

For \(\alpha \in \mathbb{R}\), we consider the deterministic fractional differential equation with the Caputo fractional derivative [14, 15],

$$ D_{t_{0}}^{\alpha}G = f\bigl(t,G(t)\bigr)\, dt^{\alpha}=\bigl(k_{GX}-k_{XG}G(t)\bigr)\, dt^{\alpha}, $$

with the initial conditions

$$ \frac{d^{k} G}{dt^{k}}\bigg|_{t_{0}} = G_{0}^{(k)},\quad k=0,1,\ldots,m-1=\lfloor \alpha \rfloor, $$

where \(D_{t_{0}}^{\alpha}G\) is a Caputo fractional derivative of order α, \(\lfloor \alpha \rfloor\) is the maximum integer less than or equal to α, and \(G^{(k)}\) indicates the kth time derivative of \(G(t)\), \(k \in \mathbb{N}\), i.e.,

$$ G^{(0)} = G(t), \qquad G^{(k)} = \frac{d^{k} G(t)}{dt^{k}}, \quad k=1,2,\ldots,m-1. $$

To obtain an interpretation of the Caputo differential equation that can be used to compute solutions and in order to prove that the stated initial conditions are correct, it is necessary to convert the differential equation (7) into an integral equation form. Following the methods of previous authors (see, e.g., [14, 15]), we have converted equation (7) into the Volterra integral equation (8).

$$ G(t)= \Biggl(\sum_{k=0}^{m-1} G_{0}^{(k)} \frac{(t-t_{0})^{k}}{k!} \Biggr)+\frac{1}{\Gamma(\alpha)} \int_{t_{0}}^{t} (t-u)^{\alpha-1}f\bigl(u,G(u) \bigr)\, du, $$

where \(\Gamma(\alpha)\) is the gamma function of order α. In our calculations, we have considered values of the fractional order α in the range \(1 < \alpha \leq 3\). For \(1 < \alpha \leq 2\), the initial conditions required to uniquely specify the solution are the initial glucose level \(G_{0}^{(0)}\) and the initial value of the first derivative \(G^{(1)}(0)\). For \(2 < \alpha \leq 3\), the initial value of the second derivative \(G^{(2)}(0)\) is also required to uniquely specify the solution.

Numerical solution of deterministic model

In general, it is necessary to use numerical methods to solve equation (8). We use the one-step Adams-Moulton predictor-corrector method (see, e.g., [1618]) for numerical integration of (8).

Let \({t_{0},t_{1},\ldots,t_{N}}\) be an equispaced partition of the desired time interval, \((t_{n}-t_{n-1})\equiv h = \frac{(t_{N}-t_{0})}{N}\), then define the coefficients for the predictor method as

$$ b_{j,n+1} = \frac{h^{\alpha}}{\alpha} \bigl[(n+1-j)^{\alpha}-(n-j)^{\alpha}\bigr], $$

and the coefficients for the corrector method as

$$ a_{j,n+1} = \textstyle\begin{cases} n^{\alpha+1}-(n-\alpha)(n+1)^{\alpha}&\mbox{if } j=0, \\ (n-j+2)^{\alpha+1}+(n-j)^{\alpha+1}-2(n-j+1)^{\alpha+1}&\mbox{if } 1\leq j\leq n, \\ 1&\mbox{if } j=n+1. \end{cases} $$

Note: The predictor coefficients are obtained by approximating the integral in (8) over time step \([t_{j},t_{j+1}]\) by

$$\begin{aligned} \int_{t_{j}}^{t_{j+1}} (t-u)^{\alpha-1}f\bigl(u,G(u) \bigr)\, du \approx &f\bigl(t_{j},G(t_{j})\bigr) \int_{t_{j}}^{t_{j+1}} (t-u)^{\alpha-1}\, du \\ =& \frac{f(t_{j},G(t_{j}))}{\alpha} \bigl((t-t_{j})^{\alpha}-(t-t_{j+1})^{\alpha} \bigr). \end{aligned}$$

The corrector coefficients are obtained by using the approximation

$$ \int_{t_{j}}^{t_{j+1}} (t-u)^{\alpha-1}f\bigl(u,G(u) \bigr)\, du \approx \frac{1}{2}\bigl(f\bigl(t_{j},G(t_{j}) \bigr)+f\bigl(t_{j+1},G(t_{j+1})\bigr)\bigr) \int_{t_{j}}^{t_{j+1}} (t-u)^{\alpha-1}\, du. $$

Using the predictor coefficients in (9), we obtain the predictor formula

$$ G^{P}(t_{n+1})=\sum_{k=0}^{m-1} \frac{(t_{n+1}-t_{0})^{k}}{k!}G_{0}^{(k)}+\frac{1}{ \Gamma(\alpha)}\sum _{j=0}^{n}b_{j,n+1}f\bigl(t_{j},G(t_{j}) \bigr), $$

with \(G(t_{j})\) the numerically computed value of G at a previous time point \(t_{j}\). Using the corrector coefficients in (10), we obtain the corrector formula with the initial guess from the predictor formula of \(G(t_{n+1})= G^{P}(t_{n+1})\) in the form

$$\begin{aligned} G(t_{n+1}) =& \sum_{k=0}^{m-1} \frac{(t_{n+1}-t_{0})^{k}}{k!}G_{0}^{(k)} +\frac{h^{\alpha}}{\Gamma(\alpha+2)}\sum _{j=0}^{n}a_{j,n+1}f\bigl(t_{j},G (t_{j})\bigr) \\ &{}+\frac{h^{\alpha}}{\Gamma(\alpha+2)}f\bigl(t_{n+1},G^{P}(t_{n+1}) \bigr). \end{aligned}$$

We used least squares to find the best fits for a range of values of the fractional order α in the range 1.5 to 2 for the parameters \(k_{GX}\), \(k_{XG}\), \(G(0)\), \(G^{\prime}(0)\) and for the range \(2 < \alpha \leq 3\) for the parameters \(k_{GX}\), \(k_{XG}\), \(G(0)\), \(G^{\prime}(0)\) and \(G^{\prime\prime}(0)\). The results for each subject are shown in Tables 1-6. Plots showing the best fit for each subject are shown in Figures 4-6.

Figure 4

Plot of best fits for subjects 1 and 2.

Figure 5

Plot of best fits for subjects 3 and 4.

Figure 6

Plot of best fits for subjects 5 and 6.

Table 1 Best least squares fits for fractional alpha model for subject 1 CGM data
Table 2 Best least squares fits for fractional alpha model for subject 2 CGM data
Table 3 Best least squares fits for fractional alpha model for subject 3 CGM data
Table 4 Best least squares fits for fractional alpha model for subject 4 CGM data
Table 5 Best least squares fits for fractional alpha model for subject 5 CGM data
Table 6 Best least squares fits for fractional alpha model for subject 6 CGM data


The first-order deterministic and Brownian motion models do not fit the CGM data. Although the deterministic higher-order integer and fractional-order models give much better fits to the observed data than the first-order models, they also do not give satisfactory fits. One reason is that the deterministic solutions give medium-term averages for the data and cannot match the short-term spikes and falls in the measured data.

For physiologic plausibility, the rate of movement of glucose from the blood into the environment should be in the range 0.01 to 0.05 min−1. In the deterministic models, the parameter \(k_{XG}\) is associated with movement from the blood into the environment. As an approximation, time scales for the fractional-order equations suggest that the conversion from the model variable t to real time can be modeled by using \((k_{XG})^{1/\alpha}\) as a rate of movement of glucose from the blood giving values in the range 0.007 to 0.02 min−1 which appear reasonable.

In order to model effects such as eating a meal or physical activity, which can occur at random times, we will introduce stochastic terms into the model. From preliminary calculations with first-order and fractional-order stochastic fits, we find that if a Wiener (Brownian motion) term is used for the stochastic term, then the KDE approximation method gives variances \(\sigma_{G}\) that are very small and fits that are close to the deterministic model fits.

If, after further investigation, we find that Wiener processes are not satisfactory, we might consider Lévy jump processes (see, e.g., [19]) because these processes are designed to model larger external shocks than Wiener processes. The model we have considered in this paper does not include deterministic changes in glucose levels resulting from eating a meal or exercise or from a large injection of insulin. Inclusion of these changes should greatly improve future models.


  1. 1.

    World Health Organization. (2016). Accessed 23 Mar 2016

  2. 2.

    Chee, F, Fernando, T: Closed-Loop Control of Blood Glucose. Springer, Berlin (2007)

    MATH  Google Scholar 

  3. 3.

    American Diabetes Association. (2016). Accessed 5 Apr 2016

  4. 4.

    Medical News Today. (2016). Accessed 25 Mar 2016

  5. 5.

    Medtronic. (2016). Accessed 23 Mar 2016

  6. 6.

    Sentry Health Monitors. (2016). Accessed 5 Apr 2016

  7. 7.

    Rodbard, D: The challenges of measuring glycemic variability. J. Diabetes Sci. Technol. 6(3), 712-715 (2012)

    Article  Google Scholar 

  8. 8.

    Rodbard, D: Continuous glucose mornitoring: a review of successes, challenges, and opportunities. Diabetes Technol. Ther. 18(suppl. 2), S3-S12 (2016)

    Article  Google Scholar 

  9. 9.

    Khatri, A: Automated Processing of Continuous Glucose Monitoring (CGM) Data to Study Onset of Diabetes. MSc thesis, University of Alabama at Birmingham (2015)

  10. 10.

    Wolfram Math World. (2016). Accessed 18 Apr 2016

  11. 11.

    Peter, EK, Eckhard, P, Henri, S: Numerical Solution of SDE Through Computer Experiments. Springer, Berlin (1994)

    MATH  Google Scholar 

  12. 12.

    PennState Eberly College of Science. (2016). Accessed 1 Apr 2016

  13. 13.

    Wikipedia. (2016). Accessed 1 Apr 2016

  14. 14.

    Shantanu, D: Functional Fractional Calculus for System Identification and Control. Springer, Berlin (2008)

    MATH  Google Scholar 

  15. 15.

    Tomás̆, K: Fractional Differential Equations and Their Applications. Diploma thesis, Brno University of Technology (2008)

  16. 16.

    Kai, DJ, Neville, JF, Alan, DF: A predictor-corrector approach for the numerical solution of fractional differential equations. Nonlinear Dyn. 29(1-4), 3-22 (2002). Special issue: Fractional Order Calculus and its Applications, Tenreiro-Machado, JA (ed.)

    MathSciNet  MATH  Google Scholar 

  17. 17.

    Kai, DJ, Neville, JF, Alan, DF: Detailed error analysis for fractional Adams method. Numer. Algorithms 1(36), 31-52 (2004)

    MathSciNet  MATH  Google Scholar 

  18. 18.

    Kai, DJ, Neville, JF, Alan, DF, Yuri, FL: Algorithms for the fractional calculus: a selection of numerical methods. Comput. Methods Appl. Mech. Eng. 194(6-8), 743-773 (2005)

    MathSciNet  Article  Google Scholar 

  19. 19.

    Dave, A: Lévy processes: from probability to finance and quantum groups. Not. Am. Math. Soc. 51(11), 1336-1347 (2004)

    MATH  Google Scholar 

Download references


This research is supported by the Centre of Excellence in Mathematics, the Commission on Higher Education, Thailand.

Author information



Corresponding author

Correspondence to Elvin J Moore.

Additional information

Competing interests

The authors declare that they have no competing interests.

Authors’ contributions

All authors contributed equally to the writing of this paper. All authors read and approved the final manuscript.

Publisher’s Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (, which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Sakulrang, S., Moore, E.J., Sungnul, S. et al. A fractional differential equation model for continuous glucose monitoring data. Adv Differ Equ 2017, 150 (2017).

Download citation


  • type 1 diabetes
  • CGM data
  • fractional differential equation
  • Brownian motion
  • R programs