Introductory Example: Predicting Multiple Sexual Partners

In this example, TVEM enabled researchers to model the change across adolescence and early adulthood in the association between substance use and the odds of having multiple sexual partners. An analysis of Add Health data found that the strength of the associations between predictors and having multiple partners change across this age span.

Data Set: National Longitudinal Study of Adolescent to Adult Health
—  11,963 adolescents followed into young adulthood
—  Data collected in four waves (1994-95, 1995-96, 2001-02, 2008)
—  7th–12th graders at initial assessment.
—  Mean age 16 at wave 1, but due to variety in ages (measured in months old) there was good coverage of the age axis


About the Time-Varying Effect Model

Traditional methods for analyzing risk factors that vary over time assume that the effects of the factors (covariates) in an analysis are static. For example, even though something like depression (which could correlate to a person’s number of sex partners) may change over time, in a traditional linear regression this time-varying nature is not taken into account. TVEM allows scientists to model the time-varying effects of covariates.

Time-Invariant Covariates vs. Time-Varying Covariates

Some covariates, like gender, are typically stable. Others, like substance use habits, can change.

Covariates are variables of scientific interest because of their potential associations with the outcome. Covariates can be things that are static or changable. If we study the impact of having multiple sex partners over time, substance use is a covariate because it is associated with the outcome. Substance use is a time-varying covariate because use changes across adolescence and young adulthood for most people. Other items, like gender, may impact the likelihood that someone will have sex with multiple partners, but a person’s gender is unlikely to change. For that reason, gender is considered a time-invariant covariate.

Outcomes Can Vary Over Time

Outcomes are the last moving piece: They can also change over time. For example, a person may engage in risky sexual behavior during some periods of their life, engage in low-risk sex in others, and abstain from sex during other periods.

Time-Invariant Effects vs. Time-Varying Effects

The relationship between a covariate and the outcome may change over the course of a study. TVEMs can estimate this change.

The effect of a covariate can also vary (regardless of whether the covariate is time-varying or time-invariant). For example, in a hypothetical substance use intervention, let’s imagine that over the eighteen weeks of the program, 50% of men and 65% of women complete the program. In this case, gender would be a time-invariant covariate. This is useful information, but imagine that, during the first 4 weeks of the study 30% of men and 30% of women drop out. However, during the last 4 weeks, 20% of the men drop out and only 5% of the women drop out. If this were true, it would indicate that the effect of gender on adhering to the program varied tremendously in weeks 5 through 8. In this example, gender is still a time-invariant covariate, but it has a time-varying effect. In an instance like this, researchers may want to examine the intervention to see if anything can be done to retain men during the latter half of the intervention. Alternately, if men were slightly more likely to drop out at every point in the study than women, gender would have a time-invariant effect.

Data Characteristics

TVEM can be used with different types of data structures, provided there is data across the time-span of interest.

Read about the data characteristics appropriate for TVEM.

Mathematical Model and Results

The Generalized Mathematical Model

Time-varying effect modeling (TVEM) is a natural extension of linear regression modeling.

Read more


In this study, one of the most interesting results related to how heavy episodic drinking predicted having multiple sex partners within the past year. Both figures show the association is between heavy episodic drinking and having multiple sex partners. In the figures, both males and females show an association that is much stronger in early adolescence and decreases greatly by age 22. The greatest difference can be observed in later adolescence, from ages 17 –20. During this time, the association between HED and multiple sex partners is somewhat stronger for females.

Sometimes while analyzing data, scientists make assumptions about the shape of a curve without any knowledge of its true shape. In this study, if a linear effect of time was estimated, the gender differences may not have been detected. The %TVEM SAS macro allows researchers to uncover these nuances.

See the article for more information.


Vasilenko, S. A., & Lanza, S. T. (2014). Predictors of multiple sexual partners from adolescence through young adulthood. Journal of Adolescent Health. 55(4), 491-497.


What Would Scientists Have Done Without TVEM?

Scientists sometimes make assumptions about the shape of a curve without any knowledge of its true shape. In this study, if a linear effect of time was estimated, gender differences may not have been detected.

The standard for modeling longitudinal data is a growth curve model. While there are many valuable applications of growth curve models, the advantage of TVEM is that they can capture complex relationships and processes in a more nuanced way. While a growth curve model may smooth over this complexity, TVEM embraces it, allowing for more precise estimates and discovery of critical periods of change.

View our recommended reading for TVEM


Last updated: May 12, 2020