Medical AI lab · Digital twin ·
Digital twin of one patient: fit, ask what-if, check trust
A patient digital twin is a model fitted to one person’s own data and then asked what would happen under different choices. It is worth what its validation shows. In this demo a small glucose-regulation model fitted to nine months of one synthetic patient’s fasting glucose and HbA1c is off by 10 mg/dL on the months it did not see, close to the test-to-test noise. Its projection of HbA1c widens from a range of 0.7 points today to 1.9 points a year out. Used on a second patient without refitting, the same twin is off by 44 mg/dL.
In one line: Fitted on 9 months: 10 mg/dL held-out error. A year out: HbA1c 8.7%, 80% range 8.0–9.9%. On another patient without refitting: 44 mg/dL.
These demos are illustrative. Every signal, image, patient and note is synthetic and fictional, generated and scored in your browser, and every number shown is computed from that synthetic data. They show general principles, not the performance of any real model, product or project, and none of them is a medical device.
Nothing is uploaded. No patient data is used.
Clinical model validation / digital twin
Digital twin of one patient: fit, ask what-if, check trust.
What this shows: a digital twin is a model fitted to one patient. It is worth what its validation shows: how well it predicts months it did not see, how wide its range is at the horizon you care about, and whether it is still the right patient’s twin.
1. Fit the twin
The rest of the 12 months is held out to check the twin. Fasting glucose is measured monthly, HbA1c every 3 months.
2. Ask what-if, from month 12
Effect sizes are illustrative, not clinical guidance. How strongly this patient responds is unknown, and the range shows it.
One patient, 12 months measured, 12 projected
synthetic patient ABlue: measured, used to fit; blue line: the twinWhite ring: held outCyan: what-if, with its 80% rangeGrey dashed: no change
3. Trust check: the same twin on patient B
not refitted vs refittedRed dashed: patient A’s twin, not refittedBlue: patient B’s own twin
Synthetic data · illustrative · not a medical device
Patient digital twins, virtual patients and any model personalised to one person for treatment planning or in-silico trials. Ask for its error on data it was not fitted to, its range at the decision horizon, and when and how it is refitted.
What this experiment models
A steady-state model of glucose regulation in the spirit of the HOMA model. Fasting glucose is set by the liver’s glucose output against insulin action, the product of insulin sensitivity and beta-cell response, through a glucose load L = H / (S × B)0.7; fasting glucose is 46.8 × (1 + L) mg/dL. Beta-cell function declines slowly, so L drifts upward. HbA1c follows mean glucose (the ADAG relation, mean glucose taken as 1.1 × fasting) with a two-month lag, plus a personal offset. From fasting glucose and HbA1c alone, S, B and H cannot be told apart, so the twin fits three numbers: L at month 0, its yearly drift and the HbA1c offset, by weighted least squares with test noise of 9 mg/dL and 0.15 HbA1c points. The projection uses the twin as fitted and validated. The levers act from month 12 and take three months to reach full effect: each kilogram lost raises insulin sensitivity by 2.5%, 150 minutes of activity a week by 15%, and the drug lowers liver glucose output by 20%. These effect sizes are illustrative. The 80% range comes from 400 draws of the fitted parameters, from their estimated uncertainty, and of how strongly this patient responds to each lever (standard deviation 45% of the effect). Patient B is a second synthetic patient with a lower glucose load. All data is generated with fixed seeds in your browser.
The principle
How it works
A digital twin of a patient is a model with the same structure for everyone and parameters fitted to one person. Here the structure is a small mechanistic model of glucose regulation in the spirit of the HOMA model: fasting glucose sits where the liver’s glucose output is balanced by insulin action, beta-cell function declines slowly, and HbA1c follows mean glucose with a lag of about two months. Three numbers are fitted to the patient: the starting glucose load, how fast it rises and a personal HbA1c offset.
A fitted model always matches the data it was fitted to, so the fit itself proves little. The test is the months it did not see. The demo holds out the end of the 12 months and reports the error there. A twin that predicts the held-out months to within the noise of the tests has earned some trust for the near future. It has not earned it for changes it has never seen: the twin knows nothing about how this patient responds to weight loss, activity or a drug, so those effects come from population figures and add to the range. Most of the range at month 24 comes from the twin itself: nine months of noisy tests pin down only roughly how fast this patient’s glucose is rising, and that uncertainty compounds with time.
Fasting glucose and HbA1c cannot separate insulin sensitivity, beta-cell function and liver output; only their combined effect is identifiable. A twin with more parameters than its data can support will still produce a confident-looking curve. So a twin should report its held-out error, its range at the horizon where the decision is made, what its data can and cannot identify, and when it is refitted. See clinical model validation.
Worked example
A glucose twin for a patient with type 2 diabetes
Picture a clinic building a digital twin for a patient with type 2 diabetes. It has a year of the patient’s records: a fasting glucose test every month and an HbA1c test every three months. The question is what the next year looks like, with and without changes in weight, activity or medication.
The demo’s default settings fit the twin to months 0 to 8 and hold out months 9 to 12. The twin puts fasting glucose at 157 mg/dL at the start, rising as beta-cell function declines by about 13% a year. Held-out error, glucose reads ±10 mg/dL, close to the 9 mg/dL by which a fasting test varies from one month to the next. The held-out HbA1c tests are matched to within 0.13 points.
With no change, HbA1c at month 24 reads 8.7%, and 80% range at month 24 reads 8.0–9.9%. The range is 0.7 points wide at month 12 and 1.9 points at month 24: the uncertainty in how fast the patient’s glucose is rising compounds with time.
Now ask what-if. Losing 5 kg gives 8.3% at month 24, range 7.5–9.5%. Starting the glucose-lowering drug alone gives 7.7%, range 6.9–8.8%. All three together, losing 5 kg, adding 150 minutes of activity a week and the drug, give 7.0%, range 6.3–8.0%, and Versus no change reads −1.7 pts. Part of each range is how strongly this patient will respond, which the twin has never seen, since the effect sizes are population figures. For the three changes together, taking those effect sizes as exact would narrow the range to 6.5–7.9%.
Fit on fewer months and the twin is less sure. With months 0 to 5 the no-change range at month 24 is 7.3–12.1%, too wide to plan with. More history narrows it, which is why a twin should be refitted as new results arrive.
Finally the trust check. Patient B has lower glucose and a slower rise. Used on patient B as it is, patient A’s twin is off by 44 mg/dL on the held-out months. Refitted to patient B’s own first nine months, the error is 7 mg/dL. The correct practice is to validate a twin on data it was not fitted to, report its range at the decision horizon, state which parameters the data can identify, and refit it for each patient and as new data arrives.
Checklist
What to check in your own project
- What is the twin’s error on data it was not fitted to, and how does that compare with measurement noise?
- How wide is the projection’s range at the horizon where the decision is made?
- Which parameters can the available data identify, and which are taken from population figures?
- Where do the effect sizes for each what-if come from, and how uncertain are they for this patient?
- When and how is the twin refitted as new results arrive?
- Has the twin been checked on patients unlike those it was developed on?
Related: our clinical model validation service, the wiki page on medical AI validation, and the demos on model drift and monitoring and confounder shift.
FAQ
Common questions
What is a patient digital twin?
It is a model with a common structure whose parameters are fitted to one person’s data, so it can be asked what would happen to that person under different choices. In this demo the twin is a small model of glucose regulation fitted to one synthetic patient’s fasting glucose and HbA1c over nine months.
How do you validate a digital twin?
Fit it to part of the patient’s history and compare its predictions with the part it did not see, against the noise of the measurements. In the demo the twin is off by 10 mg/dL on the held-out months, close to the 9 mg/dL test-to-test noise. Also check its range at the decision horizon and test the method on patients unlike the development set.
How accurate is a digital twin’s what-if prediction?
Less sure than its fit to the past suggests. The range grows with the horizon, and it includes how the patient will respond to a change the twin has never seen. In the demo the no-change projection of HbA1c at month 24 has an 80% range of 8.0–9.9%; with weight loss, activity and a drug it is 6.3–8.0%. The range widens with the horizon, from 0.7 points at month 12 to 1.9 at month 24.
Can a digital twin be reused for another patient?
Not without refitting. A twin carries one patient’s parameters. In the demo patient A’s twin used on patient B is off by 44 mg/dL; refitted to patient B’s own data it is off by 7 mg/dL. The structure can be shared; the parameters cannot.
What is the difference between a digital twin and a prediction model?
A prediction model is fitted to a population and gives the average answer for people like the patient. A twin is fitted to the patient and can be asked about choices, but it needs enough of that patient’s data to identify its parameters, and it inherits population figures for anything the patient has not yet experienced.
Medical AI lab
More demos
All 16 demos on one page: the medical AI labClinical model validation →