LAT Lab

Longitudinal Adherence Trajectory Modeling & Simulation Platform

Model

Configure LAT parameters

Calibration
Powered by
Opt
X
Simulation

Run Monte Carlo analysis

Select Mode:
LAT Lab | Playground
Powered by OptX

Optimization Complete

0.0000
Final Calibration Error

Optimized Parameters

Method: Single-Objective
Starts: 5 | Iterations: 100 | Parameters Optimized: 6

Simulation Tab Guide

Note: This tool supports two modes: Cancer Screening (age-based, years) and Medication Adherence (time-based, days). The same LAT algorithm works for both - only labels and time scales differ. Some sections below are mode-specific (e.g., Age Groups for Screening, Persistence Curve for Medication).

What is Simulation?

The simulation runs multiple virtual patients through the LAT model to see how adherence behaviors vary. Each run simulates one patient's journey from start to end of the time horizon, deciding at each action point whether they adhere based on the probability from your model settings.

Running 100-1000 simulations gives you a statistical picture of expected outcomes - average adherence rates, how spread out results are, and what percentage of patients fall into different behavior categories.

Simulation Settings

The Model Settings card shows the parameters used for the simulation. These come from the Model tab where you configure growth and decay functions.

  • Number of Runs: How many patients to simulate (more = more accurate statistics)
  • Time Horizon: Start to end of the observation period (ages in Screening mode, days in Medication mode)
  • Interval: Time between scheduled actions (e.g., 3 years for colonoscopy, 1 day for daily medication)
  • Growth/Decay: The functions that determine probability at each time point

Histogram Chart

A bar chart showing how adherence rates are distributed across all patients. Each bar represents a range (bin) of adherence rates, and the height shows how many patients fell into that range.

For example, a tall bar at 70-80% means many patients had adherence in that range. This helps you see if most patients cluster around certain values or are spread out.

Trajectories Chart (Spaghetti Plot)

Shows individual patient journeys over time. Each colored line represents one patient's probability of attending at each age. The red line shows the average (mean) across all patients at each age point.

Example: Patient A (Blue Line)

Age 45P(t) = 30%
Age 50P(t) = 45%
Age 55P(t) = 62%
Age 60P(t) = 71%
Age 65P(t) = 68%
Line goes up then slightly down → Late bloomer pattern

Example: Mean Line (Red)

Age 45Mean = 35%
Age 50Mean = 48%
Age 55Mean = 55%
Age 60Mean = 58%
Age 65Mean = 54%
Average of all patients at each age point

Age Groups Chart Screening Mode

A bar chart showing adherence rates by age bracket. This reveals how screening behavior changes across different life stages:

  • 45-54: Early screening years - often lower adherence as patients are newly eligible
  • 55-64: Middle years - typically increasing adherence as habits form
  • 65-74: Medicare transition - often peak adherence after retirement
  • 75+: Later years - may decline due to health priorities or screening cessation

Look for patterns: Does adherence grow with age? Peak at a certain bracket? Understanding these trends helps target interventions.

Box Plot

A compact summary of the adherence distribution. The box shows where the middle 50% of patients fall, with a line at the median (typical patient). The whiskers extend to the minimum and maximum values.

The diamond marker shows the mean (average). If the mean is higher than the median, it suggests some high-performing patients are pulling the average up.

Adherence Card

Adherence measures how often a patient attends their scheduled screening tests. When a patient attends, their next test is scheduled at the normal interval (e.g., 3 years for colonoscopy). When they miss, we offer the test again next year until they attend.

The adherence rate is simply: tests attended divided by total tests offered. If a patient was offered 10 tests and attended 6, their adherence is 60%.

  • Mean: The average adherence rate across all simulated patients
  • Std Dev: How spread out the results are (higher = more variation)
  • 95% CI: The range where 95% of patients fall

Distribution Card

This card groups patients into three tiers based on how well they followed their screening schedule. It helps you quickly see what percentage of patients are high, medium, or low adherence.

  • High (≥80%): Attended most of their tests - very reliable patients
  • Medium (50-79%): Attended about half - inconsistent but engaged
  • Low (<50%): Missed more than half - at risk of gaps in care

The behavior gauges show extreme cases: "Always" means perfect 100% attendance, "Never" means 0% - they missed every single test offered.

Time to Peak

This shows how quickly patients reached their highest likelihood of attending. Some patients start strong and stay strong (fast peak), while others take many years to build up the habit (slow peak).

  • Fast (<5 years): Quickly developed good screening habits
  • Medium (5-15 years): Gradually improved over time
  • Slow (>15 years): Took a long time to reach best behavior

Example 1: Fast Peak

Start Age45
Age 45 P(t)30%
Age 48 P(t)72% ★ Peak
Age 55 P(t)68%
Peak reached atAge 48
Time to Peak = 48 - 45 = 3 years → Fast

Example 2: Slow Peak

Start Age45
Age 45 P(t)25%
Age 55 P(t)45%
Age 65 P(t)78% ★ Peak
Peak reached atAge 65
Time to Peak = 65 - 45 = 20 years → Slow

Trajectory Types

This classifies the overall shape of each patient's adherence pattern over their lifetime. We compare the average probability in the first half of their journey to the second half to determine the trend.

  • Steady (─): Consistent behavior throughout - neither improving nor declining
  • Late (↗): Started weak but improved over time - "late bloomers"
  • Decline (↘): Started strong but got worse - possibly due to aging or life changes
  • Fluctuate (↕): Unpredictable - good some years, bad others

Example 1: Late Bloomer ↗

Age 45 P(t)25%
Age 50 P(t)30%
Age 55 P(t)35%
1st Half Avg30%
Age 60 P(t)55%
Age 65 P(t)65%
Age 70 P(t)70%
2nd Half Avg63%
2nd half (63%) much higher than 1st (30%) → Late

Example 2: Decline ↘

Age 45 P(t)75%
Age 50 P(t)70%
Age 55 P(t)68%
1st Half Avg71%
Age 60 P(t)50%
Age 65 P(t)40%
Age 70 P(t)35%
2nd Half Avg42%
2nd half (42%) much lower than 1st (71%) → Decline

Kaplan-Meier Persistence Curve Medication Mode

This chart shows the Kaplan-Meier survival analysis for medication persistence - how long patients stay on their medication therapy.

Key distinction:

  • Persistence = duration on therapy (time until discontinuation)
  • Adherence = taking medication correctly while still on therapy

A patient can have high adherence (takes pills correctly) but low persistence (stops therapy after 3 months). The curve shows what percentage of patients are still taking their medication at each time point.

Reading the chart:

  • Y-axis: Percentage of patients still on therapy
  • X-axis: Time since starting medication
  • Median persistence: The time when 50% of patients have discontinued

The steeper the drop, the faster patients are discontinuing therapy.

Calibration Tab Guide

What is Calibration?

Calibration finds the optimal model parameters that make simulated adherence match real-world observed data. Instead of manually adjusting P₀, Pmax, rg, L, K, and n, the optimizer automatically searches for the best combination.

You provide target adherence rates (e.g., "overall adherence should be 62%") and the algorithm iteratively tests different parameter combinations until it finds values that produce simulations matching your targets.

Model Type

Select the growth and decay functions to use during calibration. This determines which parameters are optimized:

  • Growth Functions:
    • Logistic - S-curve growth using P₀, Pmax, rg
    • Sigmoid - S-curve centered at midpoint age using P₀, Pmax, rg
    • Fixed - Constant probability, only P₀ is used (Pmax and rg hidden)
  • Decay Functions:
    • Hill - Uses L, k (half-life), n (steepness)
    • Exponential - Uses L, r_d (annual decay rate)
    • None - No decay, probability stays constant (only with Fixed growth)

Parameters

Define which parameters to optimize and their search ranges. Check the box to include a parameter in optimization.

  • P₀ (Initial) - Starting probability of adherence (0.05-0.50 typical)
  • U (Upper) - Maximum probability ceiling (0.50-1.00 typical)
  • rg (Growth Rate) - How fast probability grows with adherence
  • L (Floor) - Minimum probability after decay
  • k (Half-life) - Years until decay reaches 50% of drop
  • n (Hill Coefficient) - Steepness of Hill decay curve
  • r_d (Decay Rate) - Annual decay rate for exponential decay

Tip: Narrower ranges speed up optimization but may miss the true optimal. Start wide, then narrow based on initial results.

Objectives (Targets)

Define what adherence behaviors you want the model to match. The optimizer minimizes the difference between simulated and target values.

  • Overall Adherence: Mean adherence rate across all individuals
  • Early Adopter: Percentage who attend at least one screening in the early age range (click chevron to configure, default 45-50)
  • Always Screener: Percentage who attend EVERY screening
  • Never Screener: Percentage who miss ALL screenings

Weights: Higher weights make that objective more important. If Overall has weight 50 and Early has weight 25, the optimizer prioritizes matching Overall.

OptX - AI-Enabled Optimizer

OptX is TwinAI's proprietary hybrid optimization engine designed specifically for simulation calibration. It combines:

  • Smart Surrogate Modeling: Learns the simulation response surface to predict optimal regions
  • Intelligent Search: Avoids revisiting explored regions for efficient exploration
  • Global Optimization: Escapes local minima to find the best parameters

Settings:

  • Iterations: How many parameter combinations to test (more = better results but slower)
  • Sims/Eval: Patients simulated per evaluation (more = stable results but slower)
  • Gap %: Stop early when all objectives are within this percentage of targets

MSE Convergence Chart

Shows how the error (Mean Squared Error) decreases as optimization progresses. The MSE measures how far simulated values are from targets - lower is better.

  • Blue Line (Best MSE): The best error found so far
  • Light Blue (Current): Error of current iteration

A good calibration shows the best MSE curve dropping quickly then leveling off, indicating convergence to optimal values.

Target vs Simulated Table

Compares your objective targets against simulated results using visual bar comparisons:

  • Target (Purple line): Your specified objective value
  • Simulated (Gold line): What the calibrated model produces
  • Gap %: Percentage difference between target and simulated

When lines overlap closely, the calibration has successfully matched that objective. Larger gaps indicate room for improvement - consider adjusting weights or parameter ranges.

Best Values Box

Displays the optimal parameter values found during calibration. These are the values that produced simulations closest to your targets.

After calibration completes, click "Apply" to copy these values to the Model tab for further exploration.

Adherence 95% CI Card

Shows the simulated overall adherence with confidence interval using the optimal parameters:

  • Mean: Average adherence across simulations
  • Lower/Upper: 95% confidence interval bounds

Compare this to your Overall target to see how well calibration matched.

Pareto Solutions

When optimizing for multiple objectives (e.g., Overall Adherence AND Early Adopter rate), there's often no single "perfect" solution. Instead, you get a set of Pareto-optimal solutions representing different trade-offs.

What is Pareto optimal? A solution is Pareto-optimal if you can't improve one objective without making another worse. Each solution in the Pareto set is equally "good" mathematically - they just prioritize different objectives.

Color coding:

  • Green (<2%) - Excellent fit, error less than 2%
  • Gold (2-5%) - Good fit, error between 2-5%
  • Red (>5%) - Poor fit, error greater than 5%

How to choose: Click on any solution to apply those parameters. Consider which objective matters most for your use case - a solution that slightly misses the Early Adopter target but nails Overall Adherence might be preferable if overall adherence is your primary concern.