Summary of the Previous Session
In our previous sessions, we explored the Multiphase Optimization Strategy (MOST) and Sequential Multiple Assignment Randomized Trials (SMART) in great detail. MOST is a framework that helps us build and fine-tune interventions by identifying their most effective components. Meanwhile, SMART takes a dynamic approach, using multiple stages of randomization to adapt intervention sequences based on how individuals respond over time. Together, these tools provide a solid foundation for creating interventions that are both efficient and personalized to meet diverse needs.
Now, we’re ready to dive into Just-in-Time Adaptive Interventions (JITAIs), which take adaptability to a whole new level. JITAIs use real-time data—like information from wearable devices or smartphone sensors—to deliver tailored interventions exactly when it’s needed, such as a reminder to take medication or a boost of encouragement during a tough moment. Building on what we’ve learned about MOST and SMART, this session will explore how these frameworks can help us design and refine JITAIs, ensuring they’re not only effective but also seamlessly integrated into everyday life.
Introduction to JITAIs
They are an innovative class of interventions that deliver personalized support to individuals precisely when they need it, adapting in real-time to their changing circumstances. Unlike traditional interventions, which are often fixed and uniform, JITAIs leverage technologies such as mobile apps, wearable sensors, or self-reports to collect real-time data and dynamically adjust the type, timing, and content of the support provided.
For example, a JITAI might send a motivational prompt to encourage exercise when a person has been inactive or offer stress-relief strategies when elevated stress is detected. As another example, In an e-commerce context, a JITAI can drive purchases by delivering personalized offers—like a discount or free shipping—exactly when customers show intent, such as lingering on a product page or abandoning a cart, using real-time data and decision rules to convert hesitation into action.
JITAIs represent a paradigm shift in experimental research. Their key advantages include:
Optimal Timing: Interventions are delivered at moments of greatest need or receptivity, enhancing effectiveness.
Personalization: Support is tailored to an individual’s current state, context, and preferences.
Efficiency: By targeting interventions strategically, JITAIs minimize unnecessary actions, reducing participant burden.
Scalability: Technology enables JITAIs to reach large populations cost-effectively.
Components of JITAIs
Decision Points
Definition: Specific moments when a decision is made about whether and how to intervene.
Examples:
Time-based (e.g., every morning)
Event-based (e.g., entering a high-risk location)
State-based (e.g., increased heart rate)
Research Consideration: Identifying relevant decision points requires understanding the behavior or outcome of interest.
Intervention Options
Definition: The range of support strategies available at each decision point.
Examples:
Sending a text reminder
Offering educational content
Prompting a specific action like deep breathing
Research Consideration: Options should be evidence-based and feasible within the delivery platform (e.g., a smartphone).
Tailoring Variables
Definition: Data-driven factors that determine which intervention option is delivered and when.
Examples:
Demographic traits (e.g., age)
Behavioral history (e.g., past activity levels)
Real-time metrics (e.g., location, stress levels)
Research Consideration: Selecting tailoring variables involves balancing granularity with practicality.
Decision Rules
Definition: The logic or algorithms connecting tailoring variables to intervention options.
Examples:
Simple rules (e.g., “If stress > threshold, send relaxation prompt”)
Complex models (e.g., machine learning predictions)
Research Consideration: Rules must be tested and refined to ensure they effectively target the intended outcomes.
Extending the Stress-Reduction App Example with JITAIs
Background
In prior sessions, we explored a stress-reduction app for University of Miami students, optimized using the Multiphase Optimization Strategy (MOST) to identify effective components—mindfulness exercises, social support prompts, and physical activity prompts. The intervention was then imporved via a Sequential Multiple Assignment Randomized Trial (SMART) to adapt interventions based on response and figure out the best sequence of components.
Now, we extend this into a JITAI framework, focusing on real-time delivery, implementation, and analysis, using a synthetic dataset to demonstrate key concepts.
Designing the JITAI
The JITAI aims to reduce stress by delivering the right intervention at the right time. Its design builds on three core components:
Decision Points
Moments of elevated stress, detected via:
Self-reported stress levels: Collected via app check-ins, using a 1-10 scale.
Physiological data: Monitored through wearable devices (e.g., heart rate variability from a Fitbit).
Contextual triggers: Detected through app usage patterns (e.g., late-night study hours).
Intervention Options
Mindfulness exercise: A 5-minute guided breathing session.
Social support prompt: A suggestion such as “Text a friend for a quick chat.”
Physical activity prompt: A notification such as “Take a 10-minute walk.”
Tailoring Variables
The intervention is tailored based on:
Stress level at the decision point.
Time of day.
The student’s past response to interventions (e.g., prefers mindfulness over activity).
Decision Rules
A set of predefined logic determines which intervention to deliver:
Example Rule: If stress 6 and it is after 8 PM, deliver a mindfulness exercise.
Example Rule: If stress 4 and the student has been inactive for 2 hours, suggest physical activity.
Implementation
The implementation leverages mobile technology and real-time data:
Platform
The app integrates with wearable devices (e.g., Fitbit) to track physiological data and uses push notifications for intervention delivery.
Data Collection
Continuous monitoring of stress indicators:
Self-reports every 4 hours.
Wearable sensor data recorded every minute.
Tracking user responses to interventions (e.g., accepted, declined, completed).
Execution
At each decision point, the app’s algorithm:
Assesses the relevant tailoring variables.
Selects an appropriate intervention based on decision rules.
Triggers intervention delivery with minimal latency (e.g., 30 seconds from stress detection to notification).
Variables in the Synthetic Dataset
The synthetic dataset, jitai_stress_data.csv, contains 550 observations generated for the JITAI implementation of a stress-reduction app for University of Miami students. The dataset spans March 1–7, 2025, with 550 observations (50 students, 11 decision points each).Below is a description of each variable, reflecting its design and role in the real-time intervention framework.
Student_ID
Description: Unique identifier for each participating student.
Type: Character (e.g., “S001”, “S002”, ..., “S050”).
Purpose: Distinguishes individual students to track stress, interventions, and responses.
Generation: Assigned sequentially to 50 hypothetical students (S001 to S050).
Role in JITAI: Enables individual-level analysis, capturing student-specific patterns.
Timestamp
Description: Date and time of the decision point when stress is assessed and an intervention is delivered.
Type: Character in CSV (e.g., “01MAR2025:08:23:45”), convertible to datetime.
Purpose: Marks the exact moment of intervention, crucial for real-time adaptation.
Generation: Starts March 1, 2025, with random offsets over 7 days (March 1–7), simulating 2–4 check-ins per day.
Role in JITAI: Links interventions to timing, enabling evaluation of temporal effects (e.g., night vs. morning).
Stress_Level
Description: Student’s stress level at the decision point, on a 1–10 scale.
Type: Numeric (integer, 1 to 10).
Purpose: Primary tailoring variable to determine intervention need and type.
Generation: Drawn from a skewed distribution (higher probability for 4–7), with a +2 increase during Night hours.
Role in JITAI: Triggers decision rules (e.g., Stress_Level prompts Mindfulness at night).
Time_of_Day
Description: Categorizes the decision point into Morning (6 AM–12 PM), Afternoon (12 PM–6 PM), Evening (6 PM–12 AM), or Night (12 AM–6 AM).
Type: Character (e.g., “Morning”, “Night”).
Purpose: Tailoring variable to adapt interventions to circadian or contextual factors.
Generation: Derived from
Timestamphour using conditional logic.Role in JITAI: Influences decision rules (e.g., Mindfulness prioritized in Evening/Night for high stress).
Hours_Since_Active
Description: Hours since the student’s last recorded physical activity, inferred from wearable data.
Type: Numeric (float, 0 to 5, one decimal place).
Purpose: Tailoring variable to detect inactivity, triggering physical activity prompts.
Generation: Randomly assigned from a uniform distribution (0 to 5 hours).
Role in JITAI: Drives rule: if hours inactive and Stress_Level , deliver Physical intervention.
Past_Preference
Description: Student’s historically preferred intervention (Mindfulness, Social, Physical, or None).
Type: Character (e.g., “Mindfulness”, “Social”).
Purpose: Tailoring variable reflecting individual tendencies for personalization.
Generation: Randomly assigned with equal probability across options (simplified; ideally dynamic).
Role in JITAI: Guides intervention choice for moderate stress or when rules don’t apply.
Intervention
Description: Intervention delivered: Mindfulness (5-minute breathing), Social (friend prompt), Physical (10-minute walk), or None.
Type: Character (e.g., “Mindfulness”, “None”).
Purpose: Action tested for stress reduction efficacy.
Generation: Assigned via decision rules: Stress_Level and Evening/Night Mindfulness; Stress_Level and Hours_Since_Active Physical; else Social or None (weighted by Past_Preference).
Role in JITAI: Core component evaluated for real-time effectiveness.
Response
Description: Whether the student completed the intervention (1 = yes, 0 = no/declined).
Type: Numeric (binary, 0 or 1).
Purpose: Measures engagement, a proximal indicator of acceptability.
Generation: 70% completion if matches
Past_Preference, 50% otherwise (Bernoulli).Role in JITAI: Links delivery to behavior, impacting stress reduction likelihood.
Stress_Reduced
Description: Outcome indicating if stress decreased post-intervention (1 = yes, 0 = no/increase).
Type: Numeric (binary, 0 or 1).
Purpose: Primary outcome assessing JITAI effectiveness (akin to “purchase”).
Generation: 80% success if
Response= 1, 20% ifResponse= 0 (Bernoulli with noise).Role in JITAI: Drives evaluation and optimization of decision rules.
proc logistic data=jitai_data descending;
class Intervention (ref="None") Time_of_Day (ref="Morning") Past_Preference (ref="None") / param=ref;
model Stress_Reduced = Intervention Stress_Level Time_of_Day Hours_Since_Active Past_Preference / link=logit firth;
where Response = 1;
oddsratio Intervention;
run;Listing 7.1. SAS code to estimate the effects of interventions for those who responded
When we run the code without the firth adjustment, we get a warning that says "The maximum likelihood estimate may not exist". This is due to the nature of the data that we are using here, which leads to uasi-Complete Separation.
This occurs when predictors (e.g., Intervention, Stress_Level) perfectly or nearly perfectly predict the outcome (Stress_Reduced) in a data subset, leading to infinite or unstable maximum likelihood estimates (MLEs). In logistic regression, the probability of the outcome is modeled as:
where is the intercept, and are coefficients estimated via MLE to maximize the likelihood of observing the data. Normally, a mix of 1s and 0s across predictor values allows the algorithm to find finite coefficients. However, if a predictor (e.g., Intervention = Mindfulness) perfectly splits the outcome (all 1s, while None = all 0s), the model seeks an infinite to achieve (since ), but no finite value suffices. This causes convergence failure, as the algorithm cannot settle on a solution.
Visually, imagine a scatterplot with Intervention (None = 0, Mindfulness = 1) on the x-axis and Stress_Reduced (0 or 1) on the y-axis. If all Mindfulness points are 1 and None points are 0, a vertical line separates them perfectly, requiring an infinite slope—an impossibility in logistic regression. Thus, quasi-complete separation (near-perfect prediction) destabilizes MLEs, necessitating adjustments like Firth’s penalized likelihood to stabilize estimates.
The Firth method addresses quasi-complete separation by adding a penalty to logistic regression’s likelihood, preventing infinite coefficients. Standard logistic regression predicts the probability of the outcome using maximum likelihood to maximize the log-likelihood:
When separation occurs (e.g., all Mindfulness = 1, None = 0), grows infinitely, stalling convergence. The Firth method modifies this to a penalized log-likelihood:
Here, is the Fisher information matrix, reflecting data precision about . The penalty, , increases as becomes extreme, pulling coefficients back from infinity. For the JITAI data, this ensures finite estimates (e.g., Mindfulness odds = 20 vs. None) even with near-perfect separation, allowing the model to converge and produce usable results.
| Parameter | Level | Estimate | Std. Error | Wald Chi-Square | Pr > ChiSq |
|---|---|---|---|---|---|
| Intercept | 2.2754 | 1.8082 | 1.5835 | 0.2083 | |
| Intervention | Mindfulness | -1.1500 | 1.8046 | 0.4061 | 0.5240 |
| Intervention | Physical | -1.6071 | 1.7450 | 0.8482 | 0.3570 |
| Intervention | Social | -1.6230 | 1.7660 | 0.8446 | 0.3581 |
| Stress_Level | -0.00702 | 0.00740 | 0.9011 | 0.3425 | |
| Time_of_Day | Afternoon | 0.2246 | 0.3990 | 0.3168 | 0.5735 |
| Time_of_Day | Evening | 0.4311 | 0.6540 | 0.4345 | 0.5098 |
| Time_of_Day | Night | -0.8690 | 0.7209 | 1.4533 | 0.2280 |
| Hours_Since_Active | 0.2005 | 0.1074 | 3.4871 | 0.0619 | |
| Past_Preference | Mindfulness | -0.1948 | 0.4380 | 0.1978 | 0.6565 |
| Past_Preference | Physical | 0.2138 | 0.4288 | 0.2486 | 0.6180 |
| Past_Preference | Social | 0.4167 | 0.4483 | 0.8639 | 0.3526 |
We could also look at the interaction effects to see how the effectiveness of an intervention changes with other variables.
proc logistic data=jitai_data descending;
class Intervention (ref="None") / param=ref;
model Stress_Reduced = Intervention Hours_Since_Active Intervention*Hours_Since_Active / link=logit firth;
run;Listing 7.2. SAS code to estimate the intercation effects
| Parameter | Level | Estimate | Std. Error | Wald Chi-Square | Pr > ChiSq |
|---|---|---|---|---|---|
| Intercept | -4.3106 | 3.5488 | 1.4754 | 0.2245 | |
| Intervention | Mindfulness | 4.2700 | 3.5550 | 1.4427 | 0.2297 |
| Intervention | Physical | 4.1415 | 3.5670 | 1.3481 | 0.2456 |
| Intervention | Social | 4.7174 | 3.5870 | 1.7296 | 0.1885 |
| Hours_Since_Active | 5.5345 | 4.3258 | 1.6369 | 0.2008 | |
| Hours_Since_Active * Intervention | Mindfulness | -5.4257 | 4.3265 | 1.5727 | 0.2098 |
| Hours_Since_Active * Intervention | Physical | -5.5696 | 4.3273 | 1.6566 | 0.1981 |
| Hours_Since_Active * Intervention | Social | -5.9669 | 4.3502 | 1.8814 | 0.1702 |
Required readings
Nahum-Shani, I., Smith, S. N., Spring, B. J., Collins, L. M., Witkiewitz, K., Tewari, A., and Murphy, S. A. (2018). Just-in-Time Adaptive Interventions (JITAIs) in Mobile Health: Key Components and Design Principles for Ongoing Health Behavior Support. Annals of Behavioral Medicine, 52(6), 446–462. https://doi.org/10.1007/s12160-016-9830-8
Gonul, S., Namli, T., Huisman, S., Laleci Erturkmen, G. B., Toroslu, I. H., and Cosar, A. (2019). An Expandable Approach for Design and Personalization of Digital, Just-in-Time Adaptive Interventions. Journal of the American Medical Informatics Association, 26(3), 198–210. https://doi.org/10.1093/jamia/ocy160