## Figures

## Abstract

The mathematical modelling of biological systems has historically followed one of two approaches: comprehensive and minimal. In comprehensive models, the involved biological pathways are modelled independently, then brought together as an ensemble of equations that represents the system being studied, most often in the form of a large system of coupled differential equations. This approach often contains a very large number of tuneable parameters (> 100) where each describes some physical or biochemical subproperty. As a result, such models scale very poorly when assimilation of real world data is needed. Furthermore, condensing model results into simple indicators is challenging, an important difficulty in scenarios where medical diagnosis is required. In this paper, we develop a minimal model of glucose homeostasis with the potential to yield diagnostics for pre-diabetes. We model glucose homeostasis as a closed control system containing a self-feedback mechanism that describes the collective effects of the physiological components involved. The model is analyzed as a planar dynamical system, then tested and verified using data collected with continuous glucose monitors (CGMs) from healthy individuals in four separate studies. We show that, although the model has only a small number (3) of tunable parameters, their distributions are consistent across subjects and studies both for hyperglycemic and for hypoglycemic episodes.

## Author summary

We present a model of glucose homeostasis that consists of an equation of the mass-action-kinetics type for glucose levels and a closed propotional-integral control loop. The control loop models the aggregate effect of all physiological components of homeostasis, such as the production and uptake of insulin and glucagon. We study the model as a smooth, planar, dynamical system and show that its solutions are bounded for parameter values that correspond to healthy individuals. We then fit the model parameters to datasets obtained with continuous glucose monitors in four different studies, and show that they have structured distributions for individuals across a healthy population.

**Citation: **Ng E, Kaufman JM, van Veen L, Fossat Y (2022) A parsimonious model of blood glucose homeostasis. PLOS Digit Health 1(7):
e0000072.
https://doi.org/10.1371/journal.pdig.0000072

**Editor: **Henry Horng-Shing Lu,
National Yang Ming Chiao Tung University, TAIWAN

**Received: **October 20, 2021; **Accepted: **May 30, 2022; **Published: ** July 14, 2022

**Copyright: ** © 2022 Ng et al. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.

**Data Availability: **All blood glucose data used in this study are publicly available. Data in the Klick Pilot Study and Klick Follow-up Studies can be accessed through sections S1 and S2 Data respectively. The data of the Stanford study can be obtained via the following URL: https://doi.org/10.1371/journal.pbio.2005143.s010.

**Funding: **This research is jointly funded by Klick Applied Sciences and Mitacs Accelerate program (IT17808) for EN and JMK as a collaboration between Ontario Tech University and Klick Applied Sciences. Mitacs had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript.

**Competing interests: ** Lennaert van Veen and Yan Fossat are co-inventors of the patent "System and Method for Evaluating Glucose Homeostasis" used in part for this research. The patent is filed by Klick Inc. to Patent Cooperation Treaty (PCT) pending application approval (PCT/CA2020/051497).

## Introduction

In the 1920s, Walter Cannon condensed a plethora of observations and ideas of early physiologists into the concept of *homeostasis*, i.e. the automated regulation of conditions of the human body, such as temperature, blood pressure and heart rate [1, 2]. This regulation serves to counteract disturbances from outside the body and keep its internal conditions in their safe operating range. While a monumental leap forwards philosophically, the concept remained largely qualitative in nature. Cannon carefully based his reasoning on observational evidence, but the latter is often anecdotal or derived from very small-scale experiments with Cannon himself or members of his lab as subjects. Nonetheless, his hypotheses on homeostasis were tantalizingly close to a quantitative description. For instance, he posed that “If a state remains steady it does so because any tendency towards change is automatically met by increased effectiveness of the factor or factors which resist the change”—a notion begging to be translated into a mathematical model. It was not until the 1940s, however, that a connection was made to the theory of feedback control. Particularly prolific in making this connection was Norbert Wiener, who devoted multiple sections of his book on Cybernetics to feedback control in human physiology [3]. From similarities between physiological and servo-mechanical feedback control, Wiener derived several interesting ideas on the mechanism of homeostasis and how its breakdown is associated with pathological states such as involuntary tremors. Over the two decades after the publication of Wiener’s book, the study of homeostasis became more firmly grounded in mathematics and experiment. Examples include the work of Corson *et al.* [4] on body water regulation, that of Stolwijk and Hardy [5] on body temperature and that of Powell [6] on plasma calcium regulation. Probably the most active topic of research, however, was the regulation of the blood glucose concentration. The malfunction of this particular feedback subsystem is associated with diabetes. The incidence of type-2 diabetes in the USA doubled in the 1960s [7] and this rapid rise likely explains the research focus of many physiologists, physicists and biochemical engineers entering the new field of homeostasis modelling. The quest to gain a better understanding of glucose homeostasis is ever more urgent, as diabetes now affects more than 30 million people in the USA alone (over 9% of the population), while another 84 million Americans have prediabetes [7, 8].

The steady progress in glucose homeostasis modelling, from reasoning by analogy to quantitative, predictive theory, can be explained in terms of major advancements in three directions. First is the gathering of data. Experiments were designed to unveil the interplay of glucose and regulatory hormones like insulin and glucagon, both in humans and in other mammals. An example of early work is that by Metz [9], who measured the production of insulin in response to artificially increased or reduced glucose levels in dogs. A few years later, Burns *et al.* [10] was one of several groups to design a continuous blood glucose monitor that could be used for a number of hours on a human subject in clinical setting. They used the data to model the oral glucose challenge, in which a subject drinks a calibrated amount of glucose after fasting, and the recovery of normal blood glucose levels is monitored.

Second is the formulation of mathematical models. Informed by the data that were becoming available, various models, both of the innate glucose dynamics and of the feedback through hormones, were formulated and tested. Initially, mostly linear models were considered, for instance by Bolie [11], who used the data of Metz [9] to estimate parameters such as the rate constants of glucose removal and insulin production. Similar results were obtained by Ackeman *et al.* [12], who focused on the oral glucose challenge. Apparently frustrated by the sparsity of available data, they revisited the parameter fitting a few years later, finding good agreement with continuous glucose measurements as well [13]. Bergman *et al.* [14] systematically compared several linear and nonlinear models, the nonlinearity appearing in the interaction of insulin and glucose. They concluded that the action of insulin on elevated glucose levels is best described by a product of the respective concentrations, akin to mass-action kinetics. This feedback mechanism is now widely used in glucose control models, including ours presented in this paper.

Third is the availability of digital computers. While, in the early 1960s, Bolie [11] built his own analogue computer especially for the purpose of producing numerical predictions with his model, aptly called the “Hormone Computer”, a decade later digital computers were rapidly becoming more accessible and useful, as demonstrated, for instance, by the work of Ceresa *et al.* [15] and Gatewood *et al.* [13]. Even by the standards of 1970s digital computing, time-stepping glucose homeostasis models in the form of small systems of ordinary differential equations was a light task. The difficulty lay in the computational cost of systematically exploring parameter space to find physiologically sound behaviour—a process called conformation by Gatewood *et al.* [13] that would today be considered a form of data assimilation. Indeed, the number of simulations one needs to run to gain a comprehensive overview of model behaviours grows exponentially with the number of parameters to be tuned, such as rate constants and baseline glucose and hormone concentrations. For a model with two variables and four parameters, like Bergman’s preferred minimal model [14], we can estimate that conformation of a single peak in glucose concentration must have cost at least one hour on the equipment available at the time, like the IBM System/360 Model 50 used by Ličko and Silvers [16].

In summary, by the 1980s various models glucose homeostasis had been developed and tuned to measured data with the aid of computational algorithms. As a result, much insight was gained in the hormonal regulation of blood glucose and quantitative estimates of, for instance, insulin sensitivity [14] and disappearance rate constants of glucose and insulin [16] were obtained. A more ambitious goal, formulated already by Gatewood *et al.* [13] is to use the tuned parameters as diagnostic tools. Since the model parameters quantify the regulation mechanism itself, rather than the glucose levels it produces, they could conceivably provide an indication of where a test subject stands on the scale from healthy to pre-diabetic and fully diabetic. While not feasible with the data acquisition and processing techniques of the 1970s, in recent years this goal has come within reach because of rapid progress in the three directions discussed above.

Most importantly, continuous glucose monitors (CGMs) were developed. CGMs consist of a tiny needle, inserted in the upper arm and connected to a lightweight electronic device that is held in place with adhesive tape. Measurements are taken at fixed intervals and can be read wirelessly by a hand-held receiver. The needle usually causes little or no discomfort and can be worn during every day activities. Thus, we can now observe the complete feedback system at work. The modelling of these data requires a closed-loop control approach. In contrast, the models mentioned above are open-loop in the sense that, rather than a two-way interaction between glucose and regulatory hormones—or a proxy for those—they contain input terms that represent the injection of glucose or regulatory hormones in clamp or bolus experiments. One might say that pioneers like Bolie, Ackerman and Bergman approached the problem like an electrical engineer would probe a component of an electrical circuit: they isolate it and present it with a series of controlled inputs and measure the response. Closed feedback modelling is more similar to observing the component as it is playing its part in the circuit, unable to manipulate its input yet assuming it is, in part, determined by its output. Finally, comformation of mathematical models can now be done on the fly on a device as small as a smart watch so that diagnostics may be presented immediately upon the appearance of irregularities. Various authors have recently explored the use of mathematical models conformed to CGM data, often focusing on type-2 diabetes patients (Goel *et al.* [17], Gaynanova *et al.* [18] and Bartlette *et al.* [19]).

The model we present and validate here can be considered, in the words of Wiener, a “white box” model. It is designed to reproduce the correct output, i.e. blood glucose concentration, for given input, in this case glucose released from digestion of food. It comprises only two variables: the deviation of the glucose concentration from a set point and a proxy for all control mechanisms. Thus, we do not model any specific pathway of control or hormone, only their aggregate effect. This idea is similar to that of “reign control” by Saunders *et al.* [20], who presented a closed-loop model in which insulin and glucagon concetrations are modelled separately. Our control variable is determined both by the instantaneous glucose concentration and by its recent history, the weight of past glucose concentrations decreasing exponentially with the delay. This “distributed delay” approach was proposed by Palumbo and De Gaetano [21]. Thus, our model contains three tunable parameters: the coefficients of the contributions of the instanteneous and the past glucose concentrations and the time scale of the distributed delay. To the best of our knowledge, this model is the most parsimonious among closed feedback models—Saunders *et al.* [20], for instance, included three variables and six parameters while Palumbo and De Gaetano [21] included four variables and six parameters and Goel *et al.* [17] use two variables and seven parameters.

Since our model takes the form of a mildly nonlinear, planar dynamical system, it is susceptible to standard analysis. The first goal of this work is to establish that our model has the following desirable properties for physiologically admissible parameter values:

- It has a unique equilibrium solution which is asymptotically stable. This equilibrium can be though of as the target of the homeostatic control and it has a glucose concentration within the safe operating range.
- No time-periodic solutions can arise for constant input. Such solutions would correspond to potentially damaging, sustained oscillations of the blood glucose level.
- For variable input within reasonable bounds, the model glucose concentration and control variable remain bounded and the maximal glucose concentration lies at the high end of the safe operating range.

Thus, our model has the properties one expects from a healthy homeostatic control system.

The second goal of this work is to validate the model with CGM data of healthy individuals from three different studies using two different glucose monitors.

- Klick Pilot Study. This study was conducted at Klick Health and had 42 subjects, recruited locally in Toronto, Canada [22]. Preliminary results from this study were reported in van Veen
*et al.*[23]. - Klick Follow-up Studies. These studies were conducted at various sites in India and had 146 subjects in total [24, 25].
- Stanford Study. Results from this study were reported by Hall
*et al.*[26] and the CGM data for 36 subjects were made publically available.

All Klick studies use the Freestyle Libre Flash Glucose Monitoring System (Abbott Laboratories) while the Stanford study used the Dexcom G4. We will establish, that the parameters of the tuned models are consistent across the different study groups, in the sense that they fall under distributions that appear to be Gaussian and independent of the equipment used or demographics of the test subjects.

Thirdly, we will investigate data and model results for hypoglycemic episodes, i.e. excursions to glucose levels below the baseline. This is an extension of the model used by van Veen *et al.* [23], which only describes excursions above the base line. Hypoglycemic episodes have received relatively little attention in the literature. Palumbo and De Gaetano [21] simulated hypoglycemic conditions in their closed-loop model but did not conform the it to measured data. Data-based approaches have mostly been statistical in nature and aimed at type-2 diabetes patients, e.g. Yang *et al.* [27].

Finally we will demonstrate that, owing to the parsimony of the model, the conformation of parameters to segments of CGM data can be performed in seconds on a mid-range laptop computer. The inputs to this procedure are the raw CGM data, often with missing and corrupted measurements, and the output is a list of tuned parameters, one set for each detected peak or trough. While, in the current work, we focus on the validation of our model for healthy subjects, this pipeline of data acquisition, feature extraction and parameter conformation has the potential grow into a cheap, non-invasive, online diagnostic tool once the impact of early-onset diabetes on the model parameters is known.

## Methods and data

### Glucose homeostasis as a control system

The dynamics of blood glucose homeostasis and its regulating feedback system are modelled by a system of coupled differential and integral equations. We assume that there are three components contributing to variations in glucose deviation: 1) Base metabolic rate—the rate that glucose is consumed during rest to maintain basic bodily functions, 2) A negative feedback mechanism that regulates blood glucose concentration as it deviates from normal levels, and 3) an input function that describes the external intake of glucose such as those received by eating a meal. The equation is
(1)
where *e* is the excess glucose concentration from some set value . The base metabolic rate *A*_{3} is assumed constant, and *F*(*t*) models the external glucose sources (i.e. food intake) and sinks (such as vigorous exercise). The control variable *u* represents the collective effects of the active mechanisms that promote returning blood glucose levels to normal. The aggregate effect is modelled using a proportional-integral strategy and is described by the equation
(2)

The coefficients of proportional and integral response are *A*_{1} and *A*_{2} respectively, and 1/λ is the time scale of the delays in the feedback mechanism. Finally, the feedback term *ϕ* takes a different form for positive and negative deviations *e*.

For positive deviations (hyperglycemia), the main feedback mechanism involves the excretion of insulin and the uptake of a fraction of the total glucose concentration per time unit. This mechanism is modelled by mass action kinetics, resulting in a quadratic term similar to that used by Bergman [14]. For negative deviations (hypoglycemia), the main feedback mechanism is that of the release of glucagon which, in turn, triggers the release of glucose from the liver. This process we model with a linear term as we consider the supply of glucose from the liver instantaneous and unlimited. The feedback *ϕ* is defined as
(3)

Table 1 summarizes the model parameters with their meaning as well as units used in our work.

Parameters of the control model and their expected value ranges across test subjects.

### Data acquisition and model fitting

We validate our proposed model using glucose data collected from individuals who are considered healthy based on a variety of metrics such as body-mass index (BMI), oral glucose tolerance test (OGTT), and measure of glycated haemoglobin (HbA1c). The data is sourced from three groups: 1) Klick Pilot Study—Employees of Klick Inc. who volunteered for the study (*N* = 42) S1 Data, 2) Klick Follow-up Studies—Subjects were recruited across various sites in India (*N* = 100) S2 Data, and 3) Stanford study on glucose dysregulation (*N* = 36) [26].

Individuals selected for the study are considered healthy using the guidelines provided by the American Diabetes Association, where A1c levels are below 5.7% and OGTT below 7.8 mmol/litre. In addition, the selected participants are not known to be diagnosed with any medical condition where medication may interfere with the subjects’ blood glucose regulation. Glucose data of the both Klick studies were recorded using the Freestyle Libre Flash Glucose Monitoring System by Abbott Laboratories. For each individual, blood glucose levels were measured automatically every 15 minutes over a two week duration. This provided each participant with their own time series of blood glucose readings. In the Stanford study group, glucose levels were measured using the Dexcom G4 CGM device once every 5 minutes over a minimum of two weeks, up to a maximum of four weeks. All participants in the Klick pilot and follow-up studies gave informed written consent and are at least 18 years of age [22, 24, 25]. The studies received full ethics clearance from Advarra IRB Service and from Ontario Tech University’s research ethics board.

To reduce the amount of noise that may be caused by instrumentation error, each time series is smoothed with Gaussian smoothing. Then, episodes of hyperglycemia and hypoglycemia were identified by extracting sufficiently large positive and negative deviations within each time series, which we refer to as peaks and troughs respectively. Peaks and troughs are determined using the following criterion:

- First derivative changes from positive/negative to negative/positive at the peak’s/trough’s maximum/minimum.
- Second derivative changes from negative/positive to positive/negative at the endpoints of the peak/trough.
- The minimum/maximum of each peak/trough are chosen as the baseline glucose level .

Each peak and trough extracted were fitted against the proposed model by minimizing the function
(4)
where is the deviation of raw glucose data from the set point, sampled at the peak/trough locations, and *n* is the number of recorded points for that particular peak/trough. The base metabolic rate *A*_{3} is assumed constant as all individuals in the study are considered healthy. The external input function *F*(*t*) is modelled using a Gaussian function with a variable amplitude, center, and variance, as, during hyperglycemia, this agrees reasonably well with data measured in vitro [28]. In hypoglycemic cases, *F*(*t*) takes the same form but with a negative amplitude to model the source causing a drop in blood glucose levels. The integral term of the control variable was numerically approximated via the midpoint rule, and forward Euler method was used for time stepping. The fitting error *E* is minimized with gradient descent.

## Results

### Dynamical systems analysis of control model

In the following analysis, we will use an equivalent planar dynamical system obtained by eliminating the integral term. If we define *f*(*u*, *e*) to be the right-hand side of Eq 1, then Eqs 1 and 2 can be described by the equivalent system of differential equations
(5) (6)
under the assumption that the initial condition satisfies *u*_{0} − *A*_{1} *e*_{0} = 0 and letting λ*t*_{0} ↓ −∞. We will consider this dynamical system on the domain . If *e*(*t*) approaches , the total blood glucose concentration approaches zero and our model is no longer valid since it does not describe reaction of the human body to life-threatening hypoglycemia.

#### Stability and bifurcation structure.

The equilibria of the proposed model satisfy (7)

We first assume that the input is constant and define *G* = −*A*_{3} + *F*. The sign of *G* determines if the input is greater than the resting metabolic rate. Suppose that *e** ≥ 0, then , and thus
(8)
is a valid solution provided that *G* ≥ 0. Suppose now that *e** < 0, then . Then a stationary point is
(9)
thus requiring that *G* < 0. Furthermore, we demonstrate the following result:

**Theorem 1**. *The stationary points* (Eqs 8 and 9) *of the dynamical system described by* Eqs 5 and 6 *are asymptotically stable for any constant input function*.

*Proof.* See S1 Thm.

#### Boundedness of solutions.

Consider the following function *L* ∈ *C*^{1}(*D*):
(10)

This function increases monotonically away from its minimum at and plays the role of a Lyapunov function. For its derivative along a solution, we find (11)

The zerocline of d*L*/d*t* is an ellipsoid centered at . The interior of any isocline of *L* that encloses this ellipsoid, or rather its intersection with the phase space *D*, is a trapping region for model (5 and 6). Searching for the smallest possible trapping region leads to a fourth-order polynomial equation. A simpler bound can be found by enclosing the ellipsoid with a parallelogram and fitting the isocline of *L* to the latter. This leads to the following result.

**Theorem 2**. *Solutions to the system of* Eqs (5 and 6) *with constant net input G* = −*A*_{3} + *F* *eventually enter the interior of the curve L* = *C and remain there. The minimal value of C is bounded from above by* (12) *if* *and by* (13) *if* . *Moreover, no periodic solutions can exist in this region*.

See S2 Thm.

A visualization of the trapping region described in Theorem 2 is shown in Fig 1.

The inner ellipse is defined by d*L*/d*t* = 0 and the outer one by *L* = *C*_{+}. Both are sheared by the transformation (*v*, *e*)→(*u*, *e*) = (*v* + *A*_{1} *e*, *e*). The rectangle *v*_{min} ≤ *v* ≤ *v*_{max}, *e*_{min} ≤ *e* ≤ *e*_{max}, used to obtain an explicit upper bound for *C*, is shown with dashed lines. The stable equilibrium is shown in the first quadrant.

The results of Theorem 2 can be extended to establish the boundedness of solutions with variable forcing *G*(*t*). Let us assume that *G* is bounded, i.e. *G*_{min} ≤ *G*(*t*) ≤ *G*_{max} for *t* ∈ [0, ∞). We then find the trapping region of Theorem 2, but with the constant *C*_{±} replaced by their supremum for *G* ∈ [*G*_{min}, *G*_{max}]. Most importantly, if G_{max} > 0 we have the following.

**Corollary 1**. *Let G*(*t*) = −*A*_{3} + *F*(*t*) *be bounded and let* *G*_{max} > 0. *Then solutions to to the system of* Eqs (5 and 6) *eventually enter the interior of the curve L* = *C and remain there*. *The constant C is given by* (14)

*Proof*. See S1 Cor.

If we fix the parameters to the middle of the range given in Table 1 then the largest value the glucose concentration attains inside the trapping region varies from 9(mmol/litre), for *G* = −0.15(mmol/litre min), to 13.5(mmol/litre) for *G* = 0.15(mmol/litre min). This range of *G* is in line with experiments [28] as well as with our data. In our datasets, we discovered that the maximum value of *G* for all individuals is 0.1098 (mmol/litre min) and the minimum value of *G* is −0.0964 (mmol/litre min). The methodology of the experiments will be discussed in further detail below. A blood glucose level of over 11.1(mmol/litre) is generally considered an indication that the glucose homeostasis is dysfunctional.

### Model fitting with CGM data

Upon extracting the peaks and troughs of individual CGM data, the peaks and troughs of individuals were fitted to the model with a fitting error of 0.3028 ± 0.6297 (*E*_{max} = 3.7545) and 0.1159 ± 0.1780 (*E*_{max} = 1.2578) respectively, as defined in Eq 4. In a small number of cases (<0.5% of all selected peaks), fitting error was comparatively high due to the shape of the selected peaks. In these instances, two or more smaller peaks were combined together into one automatically selected peak, resulting in a glucose deviation that was multi-modal. Two of each representative peaks and troughs are shown in Figs 2 and 3 with similar error to the mean.

Two example representative peaks extracted from measured CGM data. The original glucose data is represented by the red dashed lines. The set of black crosses is the model glucose output, and the black curve is the cubic spline interpolation of the model outputs.

Two example representative troughs extracted from measured CGM data. The original glucose data is represented by the red dashed lines. The set of black crosses is the model glucose output, and the black curve is the cubic spline interpolation of the model outputs.

We then compared the results of Fig 2 against the models proposesd by Ackerman et al. [12], Bergman et al. [14], and Palumbo et al. [21]. The model by Ackerman proposed a general glucose-regulating hormone, where its interaction with excess blood glucose is modelled as a linear feedback system. Bergman, instead, modeled an insulin-dependent system as opposed to a general glucose-regulating hormone. We compared our model against Model VI of his work [14] as it was indicated that it was the most robust option. Note that Model VI requires an external insulin source, which we have set to zero as there is no injection of insulin in any stage of our model. Palumbo also followed the approach of including insulin-sensitivity as part of the modelling procedure. A notable difference is that they have chosen a different memory kernel that maximizes at *t* = λ^{−1} in their memory/delay term, versus our model which is based on a strictly decreasing kernel. Another difference between the models of Bergman and ours is that the former assumes a base glucose uptake that is proportional to the current glucose concentration, rather than a constant rate as described in our model. Based on the time scales of each selected peak/trough (up to two hours), the difference between these approaches are negligible.

Despite having fewer parameters, our model is able to provide a better fit than the previously proposed methods (S1 Fig). The fitting errors are provided in S1 Table. This demonstrates that our model is able to reproduce glucose levels of healthy individuals with good agreement to real world measurements. We excluded the comparisons for hypoglycemic cases because the aforementioned models were not designed for this purpose, and thus a direct comparison would not make sense.

S2 Table outlines the range of parameter values across each of the three datasets. In each study, the mean of each parameter value fall within 15% of the overall mean. In addition, the largest coefficient of variation is 0.3402 (Hyperglycemic, *A*_{1}, Klick Follow-up), indicating low variances across all model parameters. This suggests that the distributions of *A*_{1}, *A*_{2}, and λ are independent from the source of data. From this it can be concluded that the model results are consistent regardless of the presence of intangibles such as cultural and demographic differences. Due to our peak/trough selection method and length differences in CGM data, the number of peaks/troughs extracted vary between different individuals. The means of *A*_{1} and *A*_{2} for each individual were computed (via bootstrapping) to compensate for this inconsistency. We observed that the means of *A*_{1} and *A*_{2} result in a clustering behaviour, demonstrated graphically in S2 Fig.

The parameters *A*_{1}, *A*_{2}, and λ for all selected peaks for each individual were bootstrapped, then normalized as standard-normal variables in order to derive an estimation of the distribution of parameter values. Their respective distributions were tested for normality using the Shapiro-Wilk test with 0.05 as the critical *p*-value. The distributions of parameter values and Gaussian overlays are shown in S3 and S4 Figs respectively. The data suggests that all parameters follow a normal distribution except hypoglycemic λ. Upon further investigation, we discovered that λ falls under a log-normal distribution. This was confirmed by the performing the Shapiro-Wilk test on logλ, resulting in a *p*-value of 0.419. The results of the Shapiro-Wilk test are included in S2 Table.

The experiments were performed on a HP EliteBook x360 1030 G4 laptop, with an Intel Core i7–8665U at 1.9GHz, and 16.0 GB of system memory. On average, 55.7 peaks/troughs were extracted from individuals’ CGM data over the course of a week (with standard deviation of 14.4). This leads to our experiments requiring five to ten minutes to analyze the glucose data of a single subject, depending on the length of the time series. Note that, however, the vast majority (90%+) of single peaks/troughs require less than one second to compute their corresponding parameter values. We can, therefore, obtain results in real time whenever peaks/troughs are detected by wearable glucose monitoring sensors. The remaining peaks/troughs required five to ten seconds for convergence. The computation time can be improved by choosing initial parameter values near their expected convergence values. This will reduce the number of iterations needed for gradient descent to converge, effectively lowering the total runtime required.

Our data supports that the parameters of our model are normally distributed, with the exception λ for hypoglycemia, which falls under a log-normal distribution. This suggests that the model parameters remain fairly structured among healthy individuals regardless of the source of the data. We observed that all three parameters were noticeably different in value between hyperglycemic and hypoglycemic cases. In particular, parameter values for hyperglycemia are lower than that of hypoglycemia. This was expected because the control systems modelling hyperglycemic/hypoglycemic cases are fundamentally different, mathematically speaking. At sufficiently large deviations, the quadratic control of the hyperglycemic model provides a much stronger feedback mechanism compared to the linear control found in the hypoglycemic counterpart. Therefore, lower parameter values are needed for the hyperglycemic model to achieve similar levels of feedback impact. As we extend our data to include pre-diabetic and diabetic individuals for future studies, we expect values for *A*_{1} and *A*_{2} to decrease as individual’s state of health worsens. In extreme cases, we suspect that the structure of the model parameters will quickly deteriorate. Should these claims prove to be correct, a variation and/or combination of *A*_{1} and *A*_{2} may be used as potential biomarkers for early detection of glucose homeostatic dysfunction of individuals.

## Conclusion

As instances of diabetes continue to rise, it is imperative that the overall function of glucose regulation is examined compared to observing just a single-valued output in diagnostics such as the Oral Glucose Tolerance Test (OGTT) and Fasting Blood Glucose (FBG) test. Mathematical models of glucose homeostasis provide a powerful tool in the quantification of glucose homeostasis functionality. With this in mind, we investigated the viability of using a simple proportional-integral (PI) model to simulate glucose variation. By doing so we were able to tune the model to suit an individual’s particular homeostasis. We showed that our pipeline of data acquisition, peak extraction and data assimilation has the potential to give a cheap, non-invasive and quick assessment of subject’s glucose homeostasis, in spite of the parsimony of the model. We determined that there will be a unique, stable equilibrium for all individuals, no periodic solutions for constant glucose input, and practical upper bounds for both glucose concentration and the control variable based on the parameter ranges of healthy individuals. All conformed model parameters have low variances and are approximately normally distributed, with the sole exception of the time scale of the delay in the hypoglycemic case, which is closer to log-normal. This indicates a consistency in the assessment of glucose homeostasis between individuals that is independent of study location and measurement device.

Since this method relies exclusively on an individual’s CGM data, it has the potential to provide insight into an individual’s glucose homeostasis functionality without requiring a visit to a health care provider. This model is formulated to only have a few features that change between individuals. As such, in order to check the regularity of glucose homeostasis, one only has to ensure that their parameter values are within the normal ranges as previously indicated. Due to this, the requirement to undergo fasting or blood tests (which is necessary for standard tests such as OGTT, FBG, and HbA1c) can be eliminated. Furthermore, our model is able to determine its parameter values given a single peak/trough in less then one second. This suggests that the proposed method is lightweight, computationally. Upon further code optimization, this can potentially be performed on portable devices, or translated to a web-based diagnostic tool where feedback can be provided in real time.

Future work for this model involves analyzing the glucose dynamics of diagnosed type 2 diabetics and prediabetic individuals. The resulting parameter values could then be used as a biomarker of homeostasis dysfunction, potentially becoming another metric of disease diagnosis and prediction. Additionally, using a model that measures the glucose homeostasis itself and not the output may allow for earlier detection of a faulty homeostasis, ultimately resulting in diabetes prevention methods being implemented sooner.

## Supporting information

### S1 Thm. Proof of Theorem 1.

On the stability of stationary points of the glucose homeostasis control model.

*Proof*. Under the assumption of a constant input, consider first that the input is greater than the resting metabolic rate, i.e. *F* > *A*_{3}, then *G* > 0. Therefore the stationary point corresponding to *e** < 0 no longer exists. If the solution is of class *C*^{2}(*D*), linearizing around (*u**, *e**) to get the Jacobian matrix
(15) where
(16)

Therefore the stationary point is a stable node or focus for *G* > 0. If *G* < 0, the linearization has the properties and which yields a stable node or focus. Hence the stationary point (*u**, *e**) is always asymptotically stable.

https://doi.org/10.1371/journal.pdig.0000072.s001

(PDF)

### S2 Thm. Proof of Theorem 2.

On determining a trapping region under the assumption of a constant input.

*Proof*. For ease of notation, we introduce the auxiliary variable *v* = *u* − *A*_{1} *e*. In the coordinate system (*v*, *e*), the ellipsoid implicitly defined by d*L*/d*t* = 0 has its major and minor axes aligned with the coordinate axes. It is enclosed by a rectangle with sides at *v* = *v*_{min}, *v*_{max} and *e* = *e*_{min}, *e*_{max}. A direct computation shows that *v*_{min} < -*v*_{max} < 0 < *v*_{max}. Since *L* is a monotonically increasing function of *e* on the domain *D*, the maximal value of *L* over the rectangle is then obtained at
if , in which case , and at
if , in which case . At this point we have with *C*_{±} as stated in the theorem.

We now use the Bendixson-Dulac theorem to demonstrate that it is impossible for solutions that enter this region to be periodic, consider the equivalent dynamical system

We now show that *Q* = ∂_{v} *F*_{1} + ∂_{e} *F*_{2} has the same sign in *D*. Computing *Q* directly, we get

It is clear that *Q* is constant and negative for any *e* < 0. Hence we only need to consider *e* > 0. Notice that *Q* is linear with respect to *v* and *e*, therefore any extrema of *Q* must be on the boundary of *D*. The maximal value can be found by the method of Lagrange multipliers, leading to
and so *Q*(*v*, *e*) < 0 in *D*. Therefore no periodic solution exists in the trapping region.

**Remark**: Although the Bendixson-Dulac theorem is stated for differentiable vector fields, its property still holds for our model despite *F*_{2}(*v*, *e*) being nondifferentiable along *e* = 0.

https://doi.org/10.1371/journal.pdig.0000072.s002

(PDF)

### S1 Cor. Proof of Corollary 1.

On determining a trapping region for any bounded input function.

*Proof*. The curve *L* = *C* takes the form *C* = *C*_{−} if and *C* = *C*_{+} if , and defines the boundary of a trapping region to Eqs 5 and 6. If , then *C* = *C*_{+} everywhere in the domain. Notice that *C*_{+} is a strictly increasing function of *G*, therefore its maximum is *C*_{+}(*G*_{max}). Suppose now that . A direct computation of the second derivative of *C*_{−} gives
(17) with the inequality holding for all values of *G*. Therefore the maximum of *C*_{−} occurs at one of its endpoints. Since *C* is continuous over all of *G*, and *C*_{+} is strictly increasing, then , meaning that the right endpoint (relative to values of *G*(*t*)) of *C*_{−} cannot be a maximum of *C*. Thus the largest value of *C* must be the larger of *C*_{−}(*G*_{min}) or *C*_{+}(*G*_{max}) as required.

https://doi.org/10.1371/journal.pdig.0000072.s003

(PDF)

### S1 Table. Comparison of fitting errors of our model against previous models.

The fitting error of the two sample hyperglycemic cases across different models shown in S1 Fig. The errors computed here are based on raw glucose data to accomodate for the specifications of the models compared.

https://doi.org/10.1371/journal.pdig.0000072.s004

(TIF)

### S2 Table. Ranges of model parameters.

Model parameter ranges for hyperglycemic and hypoglycemic cases with their respectively *p*-values of the Shapiro-Wilk test for normality. The null-hypothesis *H*_{0} states that the model parameters are normally distributed. The decision to reject or not reject *H*_{0} is based on a critical *p*-value of 0.05. The units of each parameter are listed in Table 1.

https://doi.org/10.1371/journal.pdig.0000072.s005

(TIF)

### S1 Fig. A comparison of our example results against existing models for hyperglycemic cases.

The black crosses are the model predictions at the time of each CGM measurement. The black curve is a cubic spline interpolation of the model prediction. The faded green, light blue, and purple curves are the glucose predictions based on the models proposed by Palumbo et al. [21], Bergman et al. [14], and Ackerman et al. [12], respectively.

https://doi.org/10.1371/journal.pdig.0000072.s006

(TIF)

### S2 Fig. Comparison of model parameter clustering between hyperglycemic and hypoglycemic episodes.

Mean (by subject) model parameter values for peaks and troughs found in hyperglycemic and hypoglycemic cases respectively. Parameter values for hyperglycemic cases are depicted by the circle markers, and in contrast, star markers represent parameter values for hypoglycemic cases. The units of *A*_{1} and *A*_{2} are both in litre/(min × mmol). The numerical values of each data point is found in S3 Data.

https://doi.org/10.1371/journal.pdig.0000072.s007

(TIF)

### S3 Fig. Normalized model parameter values for hyperglycemic cases.

In the left column, the blue columns form the histogram for each normalized parameter value distributed into ten bins of equal width. The red curve denotes the normal distribution with mean and variance that matches the sample mean and variance of each corresponding parameter. The right column are Q-Q plots for each model parameter. The rows, from top to bottom, correspond to the parameters *A*_{1}, *A*_{2}, and λ. The units of the parameters are [*A*_{1}] = [*A*_{2}] = litre/(min × mmol), and [λ] = 1/min.

https://doi.org/10.1371/journal.pdig.0000072.s008

(TIF)

### S4 Fig. Normalized model parameter values for hypoglycemic episodes.

In the left column, the blue columns form the histogram for each normalized parameter value distributed into ten bins of equal width. The red curve denotes the normal distribution with mean and variance that matches the sample mean and variance of each corresponding parameter. The right column are Q-Q plots for each model parameter. The rows, from top to bottom, correspond to the parameters *A*_{1}, *A*_{2}, and logλ. The units of the parameters are [*A*_{1}] = [*A*_{2}] = litre/(min × mmol), and [logλ] = log(1/min).

https://doi.org/10.1371/journal.pdig.0000072.s009

(TIF)

### S1 Data. Blood glucose data of Klick Pilot Study.

Blood glucose data of Klick Pilot Study measured using the Freestyle Libre Flash Glucose device. The data are presented in comma separated values (.csv) format for each healthy individual (*N* = 42). The filenames represent the unique identification of the individual to preserve anonymity.

https://doi.org/10.1371/journal.pdig.0000072.s010

(ZIP)

### S2 Data. Blood glucose data of Klick Follow-up Studies.

Blood glucose data of Klick Pilot Study measured using the Freestyle Libre Flash Glucose device. The data are presented in comma separated values (.csv) format for each healthy individual (*N* = 100). The filenames represent the unique identification of the individual to preserve anonymity.

https://doi.org/10.1371/journal.pdig.0000072.s011

(ZIP)

### S3 Data. Parameters values for *A*_{1}, *A*_{2} and λ for peaks and troughs of each individual.

Model parameter values obtained for each participant across all three studies. The data are presented in comma separated values (.csv) format.

https://doi.org/10.1371/journal.pdig.0000072.s012

(ZIP)

## Acknowledgments

The authors thank Adam Palanica and Anirudh Thommandram of Klick Applied Sciences for their work in the procurement of CGM data. We also thank Kathryn Mei-Yu Chen of Ontario Tech University for her work on the data streamlining framework.

## References

- 1. Cannon WB. Organization for physiological homeostasis. Physiol Rev. 1929;9:399–431.
- 2. Cooper SJ. From Claude Bernard to Walter Cannon. Emergence of the concept of homeostasis. Appetite. 2008;51:419–427. pmid:18634840
- 3.
Wiener N. Cybernetics, or control and communication in the animal and the machine. John Wiley & Sons; 1949.
- 4. Corson SA, Weed HR, O’Leary Corson E. Analysis and modeling of body water regulation. Proc IFAC World Congress. Vol. 1968;2:166–176.
- 5. Stolwijk JAJ, Hardy JD. Temperature regulation in man—a theoretical study. Pflugers Arch. 1968;291:129–162.
- 6. Powell T. A mathematical model for calcium homeostasis. Bull Math Biophys. 1972;34:483–502. pmid:4659274
- 7.
Long-term trends in Diabetes. CDC’s Division of Diabetes Translation; 2017. Available from: https://www.cdc.gov/diabetes/statistics/slides/long_term_trends.pdf.
- 8.
National Diabetes Statistics Report. Centers for Disease Control and Prevention; 2020. Available from: https://www.cdc.gov/diabetes/pdfs/data/statistics/national-diabetes-statistics-report.pdf.
- 9. Metz R. The effect of blood glucose concentration on insulin output. Diabetes. 1960;9:89–93.
- 10. Burns TW, Bregant R, Van Peenan HJ, Hood TE. Observations on blood glucose concentration of human subjects during continuous sampling. Diabetes. 1965;14:186–193. pmid:14278091
- 11. Bolie VW. Coefficients of normal blood glucose regulation. J Appl Physiol. 1961;16:783–788. pmid:13870789
- 12. Ackerman E, Gatewood LC, Rosevear JW, Molnar GD. Model studies of blood-glucose regulation. Bull Math Biophys. 1965;27:21–73. pmid:5884133
- 13. Gatewood LC, Ackerman A, Rosevaer JW, Molnar GD. Modelling blood glucose dynamics. Behav Sci. 1970;15:72–87. pmid:5413469
- 14. Bergman RN, Ider YZ, Bowden CR, Cobelli C. Quantitative estimation of insulin sensitivity. Am J Physiol Endocrinol Metab. 1979;236:E66–77. pmid:443421
- 15. Ceresa F, Ghemi F, Martini PF, Martino P, Segre G, Vitelli A. Control of Blood Glucose in Normal and in Diabetic Subjects: Studies by Compartmental Analysis and Digital Computer Technics. Diabetes 1968;17(9):570–578. pmid:5675317
- 16. Ličko V, Silvers A. Open-loop glucose-insulin control with threshold secretory mechanism: analysis of intravenous glucose tolerance tests in man. Math Biosci. 1975;27:319–332.
- 17. Goel P, Parkhi D, Barua A, Shah M, Ghaskadbi S. A Minimal Model Approach for Analyzing Continuous Glucose Monitoring in Type 2 Diabetes. Front Physiol. 2018;9:673. pmid:29915545
- 18. Gaynanova I, Punjabi N, Crainiceanu C. Modeling continuous glucose monitoring (CGM) data during sleep. Biostatistics. 2020; p. kxaa023.
- 19. Bartlette K, Carreau AM, Xie D, Garcia-Reyes Y, Rahat H, Pyle L, Nadeau KJ, Cree-Green M, Behn CD. Oral minimal model-based estimates of insulin sensitivity in obese youth depend on oral glucose tolerance test protocol duration. Metabol Open. 2021;9:100078. pmid:33511337
- 20. Saunders PT, Koeslag JH, Wessels JA. Integral Reign Control in Physiology. J Theor Biol. 1998;194:163–173. pmid:9778431
- 21.
Palumbo P, Gaetano AD. State feedback control of the glucose-insulin system. In: Aletti G, Burger M, Micheletti A, Morale D, editors. Math Everywhere: Deterministic and Stochastic Modelling in Biomedicine Economics and Industry. Springer; 2007. p. 241–252.
- 22.
Biofeedback of Glucose in Non-diabetic Participants. ClinicalTrials.gov Identifier: NCT04077203.
- 23. van Veen L, Morra J, Palanica A, Fossat Y. Homeostasis as a proportional–integral control system. NPJ Digit Med. 2020;3:77.
- 24.
A Triple Cohort, Prospective Observational Study to Analyze Type 2 Diabetes Glucose Biomarkers With a Continuous Glucose Monitoring System. ClinicalTrials.gov Identifier: NCT04529239.
- 25.
A Quadruple Cohort, Prospective Observational Study to Analyze Type 2 Diabetes Glucose Biomarkers and Physiological Variables with Continuous Glucose Monitoring System. CTRI.nic.in Identifier: CTRI/2021/08/035957.
- 26. Hall H, Perelman D, Breschi A, Limcaoco P, Kellogg R, McLaughlin T, et al. Glucotypes reveal new patterns of glucose dysregulation. PLoS Biol. 2018;16(7):e2005143. pmid:30040822
- 27. Yang J, Li L, Shi Y, Xie X. An ARIMA Model With Adaptive Orders for Predicting Blood Glucose Concentrations and Hypoglycemia. IEEE J Biomed Health Inform. 2019;23(3):1251–1260. pmid:29993728
- 28. Monro JA, Mishra S, Venn B. Baselines representing blood glucose clearance improve in vitro prediction of the glycaemic impact of customarily consumed food quantities. Br J Nutr. 2010;103:295–305. pmid:19930760