Got my first autoregression function done, for determining the coefficients. It's not 100% JavaScript though. I am not fluent in JavaScript,but I know Java.
I also have to test it and refine it, but in theory it should work.
https://gist.github.com/diabeticgonewild/9c0eb4b2e4781f2635cb
@kenstack , are you going to use differential equations? That would be the best representation of that, as a function of time. For solving the DE as a system--in the steady-state (good for everything except the kind of updated models from Hovorka), I personally would use globally convergent Newton's method or globally convergent Broyden's method (preferrable) as the model is nonlinear.
If you are not solving for things as a system, use some variant of Runge-Kutta, with PI (preportional, integrating) controls.
@kenstack , the way the Hovorka models are described and used, it would be difficult to solve for anything reliably besides in the steady-state, which has limitations.
However, in Stochastic Virtual Population of Subjects With Type 1 Diabetes for the Assessment of Closed-Loop Glucose Controllers and the doctoral thesis, if you search in Google for "External Artificial Pancreas for Type 1 Diabetes: Modeling and Control", I am pretty sure things can be solved for in 15 minute intervals, with the time-varying piecewise linear functions, but that is something I have to test out. However, I have a feeling I am right on with that.
There's nothing wrong with the steady-state if you are using it in real-time as an "artificial pancreas". In that respect, the steady-state is perfectly fine.
Glucodyn looks very nice for corrective action that cannot be taken seemingly instantaneously or automatically.
I think I might have to get back to you (eventually) on the model(s) you want. I don't know how that would be covered. I am working on something semi-related, for BG prediction right now.
I am probably going to get flamed but I am not really a fan of COB and I don't even know how those concepts are modeled. Keep in mind that I have severe gastroparesis (not diabetes-related), and I have reasons not to trust such models. That doesn't mean that I don't think they are important. ;)