Source: HealthBasket

Using Causal Inference: How Can AI Help People Slow Their Aging Down

How can AI help people live longer by recommending lifestyle actions?

Shubhangi Ranjan
Omdena
Published in
8 min readJun 18, 2021

--

Written by Shubhangi Ranjan

This article appeared originally on Omdena’s blog.

Problem Statement

Age-related diseases are killing 150,000 people per day. Humanity is a health tech organization, which is now able to monitor people’s rates of aging, but the only way for that information to have an impact is if the people can know what actions they should take to slow their aging down. This is complex because these impactful actions will not only be different for every person, but also for every moment in that person’s life, and for every combination of actions the person takes.

Biological Age: The basic idea behind biological aging is that aging occurs as you gradually accumulate damage to various cells and tissues in the body. Biological age may vary depending on your lifestyle (diet, exercise, sleep, attitude, stress, etc.). Depending on your genetics and your life habits, your biological age will be higher or lower than your chronological one. People with a younger biological age compared to their chronological age are at a lower risk of suffering age-related diseases and mortality.

So in this challenge, Humanity and the Omdena team compressed high throughput markers such as activity and other lifestyle action data from the user (e.g. diet, weight, socio-economic status) to develop weighted algorithms predictive of the biological age outcome.

Relationship between aging and mortality. Source: Research Gate

Causal Inference

Association does not imply causation

Machine learning algorithms use standard statistical analysis, typified by regression, estimation, and hypothesis testing techniques to assess parameters of a distribution from samples drawn of that distribution. With the help of such parameters, one can infer associations among variables, estimate beliefs or probabilities of past and future events, as well as update those probabilities in light of new evidence or new measurements.

Correlation and causality can seem deceptively similar. While causation and correlation can exist at the same time, correlation does not imply causation. Causation explicitly applies to cases where action A causes outcome B. On the other hand, correlation is simply a relationship. Action A relates to Action B — but one event doesn’t necessarily cause the other event to happen. So, correlations can lead to wrong assumptions.

In correlations, the notation is P(x|y) i.e. the probability of x given y: for example, the probability of a disease given the person consumes alcohol. However, in causal calculus, a very small but important change is made. Instead of P(x|y) it’s P(x|do(y)) i.e. the probability of x given that y is done: for example, the probability of a lower biological age given that I start doing a high-intensity activity. The ‘do’ is very important: it represents the intervention, the actual doing of something that will cause the effect.

Causal inference is a powerful modeling tool for explanatory analysis, which might enable current machine learning to make explainable predictions.

Conceptual Framework (Structural Causal Graphs):

Source: sciencedirect.com

Directed acyclic graphs are used to represent causal relationships. A DAG displays assumptions about the relationship between variables. The assumptions we make take the form of lines (or edges) going from one node to another. Directed paths are also chains because each is causal on the next.

Source: Omdena.com

Here, both X and Treatment variables have an impact on biological age. People with lower chronological age or weight might not have a higher biological age. Consequently, their chances of having a disease are lower. Also, people who exercise more, do not consume alcohol, have healthy sleeping patterns may have lower biological age. This is based on the assumption that having healthier lifestyle habits will lead to having a longer life. We are trying to capture the relationship between the treatment i.e. lifestyle actions and outcome variables i.e. biological age.

Simulating randomized controlled trials:

Source: MIT Press

The data that we have used is of 5 people over a period of 6 months recorded from devices like fitbit. Also, there is manually entered data by the user like sleep efficiency, fatigue, stress, revitalization score on a score of 10.

Randomized experiments are the gold standard for causal inference because the treatment assignment is random and physically manipulated: one group gets the treatment, one does not. The assumptions here are straightforward, securable by design, and can be conveniently defended. When there is no control over treatment assignment, like with observational data, we attempt to model it. Modeling here is equivalent to saying “we assume that after adjusting for age, gender, weight, maximum heart rate, alcohol consumption, socioeconomic factors, ethnicity, runners and non-runners are so similar to each other as if they were randomly assigned to running.”

Controlled experiments are simple, we can act upon a variable directly and see how our other variables change in our causal diagram. In a medical trial, this would be taking groups of people 1 and 2, 1 group 1 taking the placebo, and group 2 taking the actual medicine to the sickness and observing the results. Naturally, in medical trials we want these people to come from the same distribution.

In order to simulate an RCT experiment environment, the first step will be to cluster similar users based on constant factors that do not change instantly. Hierarchical clustering allows users to move from one cluster to another as the clusters become more mature.

Agglomerative clustering output. Source: Omdena.com

In randomized experiments, treatment is assigned by the flip of a coin, but in observational studies treatment (eg., a person exercising) may be determined by many factors (e.g., likes exercising). If those factors affect the risk of developing the outcome (e.g., lowering of biological age), then the effects of those factors become entangled with the effect of treatment.

So, the next step to mimic controlled experimentation and minimize the limitations of observational data would be to minimize selection bias. For example, in a particular cluster, a certain user tends to exercise more to stay healthy while another user tends to meditate more and sleep for 7–8 hours every day. For this purpose, we have used the propensity score matching technique.

PyMatch is a Python library that features matching techniques for observational studies and is a Python implementation of R’s Matching package. PyMatch supports propensity score matching for both discrete and continuous variables, which we used during our project.

More details about PyMatch can be found in the following GitHub repository: https://github.com/benmiroglio/pymatch

Fitting an Initial Propensity Score Model

In this step, we fitted an initial propensity score model and obtained the following result. We observed that both dummy groups have very similar propensity score distribution. In our case, this is expected since our BA is randomly simulated, and is not affected by any of the activity/ health variables. Ideally (for an accurate dataset), there should be a more visible separation between the 2 groups, thus indicating that the X-variables affect the y-variable, and hence it is worth further implementing matching.

Source: Omdena.com

Matching

Matching attempts to reduce the treatment assignment bias, and mimic randomization, by creating a sample of units that received the treatment that is comparable on all observed covariates to a sample of units that did not receive the treatment. In this case, matching tries to estimate effects on decreased BA group had they received treatments that are different from the decreased BA group to increased BA group.

Now, we use the function model.match() to start implementing matching. This is done with replacement, meaning a single majority record (in our case, y=1) can be matched to multiple minority records (y=0). Matcher assigns a unique record_id to each record in the test and control groups so this can be addressed after matching. At the end of this section, the scores are printed out and we can observe that each pair of matches have scores within 0.0001 of each other.

Assessing Matches

Now, we assess the matches by plotting the histograms and ECDF plots of each X-variables. We can observe that for most variables, matching has made the corresponding distribution more similar across the 2 dummy groups. This indicates that the matching algorithm worked as intended.

Machine Learning for Recommendation:

With the matched dataset (Matched_df), we can now train an ML model and infer causality. We used a logistic regression model and performed hyperparameter tuning on its regularization parameter C.

Conclusion

We have built a system that takes in the user actions that are being monitored on one side (activity rates, sleep, meditation, diet, etc.) and uses the ongoing increases or decreases in the user’s Rate of Aging measure (to calculate the user’s Biological Age) to decide which actions were most effective and in what combinations and when.

The system then also matched across users with similar attributes to use the insights and weightings set for one user to affect the weightings given to actions and the combination of actions to another user. The causal inference has helped us identify the introduction of certain new actions/interventions to a person’s daily actions since they have a large effect on the person’s rate of aging. Machine learning implementation has allowed the personalization and combinatorial nature of real-life to be modeled.

--

--