An Application of the Time-Varying Effect Model (TVEM) | The Methodology Center

An Application of the Time-Varying Effect Model (TVEM)

The time-varying effect model (TVEM) allows scientists to use intensive longitudinal data (ILD) to observe change over time in the factors that influence an outcome. For example, when a person is trying to quit smoking, successful quitting is influenced by a number of factors, including mood, belief in one's ability to quit, and stress level. With TVEM, we can model the changes in these relationships which will allow us to see when and under what circumstances a quitter might need additional support in order to succeed.



Conceptual Introduction

As data collection technology such as smart phones and pedometers create richer and denser datasets, TVEM will allow researchers to answer new questions and to answer existing questions with greater nuance than was possible just a few years ago. Problem behaviors (e.g., substance use) and their predictors (e.g., craving, mood) change over time, and TVEM helps us understand these changes. This applies to smoking, obesity, substance use, HIV disease course, and any other area of behavioral science that collects ecological momentary assessment (EMA) data or other forms of ILD.


There is no hard, fast rule for exactly what constitutes ILD. Generally, ILD is defined as data with more than 20 or 40 measurements over time. But in truth, it is not the number of observations that matter, it is the relationships you are trying to model and whether you have enough data points to measure the change. As a simple example, consider the graph below. Imagine this represents someone's craving for food on a scale of 1 to 5 over the course of two days.


Graph with 2 measurements. Both are at 1 on the y-axis. There is a line between the points.

If we measured craving two times, we would perceive that the cravings were low and stable for the duration of the two days.

Graph with 5 measurements. Points 1 and 5 are at 1 on the y-axis. Points 2 and 4 are at 3 on the y-axis. Point 3 is at 5 on the y-axis. The resulting graph shows an increase that levels out in the middle and the drops back to the original level.

If we measured craving five times, we would perceive that the cravings increased steadily, leveled off, and then fell steadily.

Graph with 17 measurements. The 5 points from the previous graph are visible, but the shape around those points is completely irregular.

If we measured more intensively (17 times in this example), we would see that the person's cravings fluctuated wildly throughout the time span. 


The more dynamic and complex the relationship we are trying to model, the more valuable it is to have intensive longitudinal data. So the number of observations matters only in that you have enough measurement occasions to accurately determine the shape of the curve. If the shape of the curve above is accurate, then adding 50 more data points will not give you more information, though it will increase your certainty of the curve's shape.


Graph of an irregular curve. The confidence bands are very wide.

In the %TVEM SAS macro suite, time-varying effects are not reported as a p-value; time-varying effects are reported as a curve. As you might expect, the confidence bands on the curve rely on the number of subjects in the study. In the figure to the left, you can see that the effects appear to vary over time.

The same graph as above with a straight line drawn through the graph. The line does not touch the confidence bands.

However, because the confidence intervals are so wide, a straight line can be drawn through the curve. We cannot describe the relationship based on this result. Look at the dashed line overlaid on the graph to the left. Because it does not touch the confidence bands at any point, this could be the actual shape of the curve, and a linear effect does not vary with time. Tighter confidence bands are needed to accurately identify the shape of the curve. 


The same graph as above with narrow confidence bands. No line could be drawn that touched the curve but did not touch the confidence bands.

With a larger study, the curve has been modeled in exactly the same shape, but the confidence bands are much narrower. As you can see, there is no way to put a straight line through the curve within the confidence bands. With this result, we can make statements about the time-varying effects.


Graph with a single point and a confidence interval around it. estimate = 6.51605, standard error = .62729, p-value <.0001, 95% confidence limits = 5.23110 & 7.80099

A time-varying effect is an irregularly shaped curve, made up of an infinite number of points. You could measure the p-value at any one point, but that would tell you nothing about the validity of the rest of the curve. Alternately, you could take an average over the whole curve, but this would give you, effectively, no information at all about any single point on the curve.


For a time-invariant parameter, significance can be expressed through either a p-value or a confidence interval (as seen to the left). Because of the variation over time, the p-value is not useful for expressing the significance of time-varying parameters, but a dynamic confidence interval is. So, while journals typically print p-values, a confidence interval provides exactly the same information. That is why the %TVEM macro suite expresses results graphically. An empirical example of the application of the TVEM macro can be found in the article listed below.





 Shiyko, M. P., Lanza, S. T., Tan, X., Li, R., & Shiffman, S. (2012). Using the time-varying effect model (TVEM) to examine dynamic associations between negative affect and self confidence on smoking urges: Differences between successful quitters and relapsers. Prevention Science. PMCID: PMC3372905 doi:10.1007/s11121-011-0264-z


Introductory Example: TVEM Applied to Smoking-Cessation Data

SmokingIn this example, researchers analyze data from a smoking-cessation program using a time-varying effect model (TVEM). TVEM allows the researchers to see the change over time in the relationships between a successful quit and personal factors such as cigarette craving and belief in one's ability to quit. This information could be used to develop early intervention cues for people quitting smoking who are in danger of relapsing.



Data Set: EMA Study of Smokers Trying to Quit

  • Smokers were prompted to report at 5 random times each day on a cell phone. This is called ecological momentary assessment (EMA).
  • Data were collected 2 weeks pre-quit and 2 weeks post-quit
  • 304 smokers
  • Baseline mean = 27.6 cigarettes/day



Structure of the Model

Many complex factors are involved in problem behaviors. Many scientists study factors in a model that vary over time. However, traditional methods assume that the effects of these covariates are consistent. TVEM allows scientists to measure the time-varying effects of covariates.



Time-Invariant Covariates vs. Time-Varying Covariates

Some covariates, like gender, are stable. Others, like cravings, change.

Covariates are variables of scientific interest because they may have an impact on the outcome of interest. These can be things that are constant or changing. If we study the process of quitting smoking, craving is a covariate, because it impacts the outcome. Cravings are time-varying covariates because they come and go almost constantly. Other items, like gender, may impact how much someone smokes while trying to quit, but a person's gender is highly unlikely to change. For that reason, gender is considered a time-invariant covariate. NOTE: In the larger example on this page, gender is not considered in the model. It is only mentioned here to illustrate the difference.



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 obesity 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.



Outcomes Can Vary Over Time

Outcomes are the last moving piece: they can also change over time. For example, a person who is trying to quit may smoke different numbers of cigarettes on different days.



Other Significant Attributes of Intensive Longitudinal Data (ILD)

ILD have a multi-level structure.


Also, effects vary between individuals.

  • Data have a multilevel structure. For example, occasions are nested within individuals, who are nested within families, and families are nested within communities.
  • Effects vary not only across time but also between individuals. Different people may be affected differently by certain situations. For example, the relationship between mood and daily smoking may change over time and vary across individuals, because some people smoke in enjoyable social situations but others smoke when they are alone and under stress.
  • The population may be a combination of several discrete latent subpopulations. This is related to the previous attributes. For example, mood may have a strong effect on urge to smoke for some smokers and a weak effect on others. If there are qualitatively different groups in a population, then this should be taken into account in the model.
  • The structure of the error process changes over time. The error variance may dramatically change over time, making the classic linear modeling assumption of a constant variance term untenable.



The Generalized Mathematical Model 

Time-varying effect models (TVEMs) are a natural extension of linear regression models.

Read more



Results and Model Flexibility

Intercept (with confidence intervals) of smoking urges for relapsers and successful quitters. The relapsers’ intercept is constant at 4.5. The successful quitters intercept originates at 4.5 and drops throughout the 13 days on the graph. The rate of decline lessens over time. The model is able to incorporate time-varying effects and time-invariant effects. In this study, one of the most interesting results related to the way that smoking urges changed over time for successful quitters, compared to those who eventually relapsed. For both groups, urge to smoke started out high, but for successful quitters, the urges decreased steadily for several days and then continued to decrease slowly. For relapsers, the urge to smoke never decreased. Thus, researchers learned that early intervention may be warranted for quitters whose urges do not decrease in the first few days.


The modeling of time-varying effects in %TVEM can help remove bias from analysis of complex data. Sometimes while analyzing data, scientists make assumptions about the constancy of relationships or the shape of a curve without any knowledge of the true shape of the curve.


For those who relapsed, the urge to smoke never decreased.

If a scientist assumes linearity and is wrong, the results will be biased. So, when researchers have no reason to assume a specific shape of the curve, %TVEM can help you avoid this potential source of bias. The %TVEM macro builds models based on the characteristics of the data, not on a priori assumptions.





Shiyko, M. P., Lanza, S. T., Tan, X., Li, R., & Shiffman, S. (2012). Using the time-varying effect model (TVEM) to examine dynamic associations between negative affect and self confidence on smoking urges: Differences between successful quitters and relapsers. Prevention Science. PMCID: PMC3372905 doi: 10.1007/s11121-011-0264-z  View abstract


What Would Scientists Have Done Without TVEM?

Sometimes while analyzing data, scientists will make assumptions about the constancy of relationships or the shape of a curve without any knowledge of the true shape of the curve. If a scientist assumes linearity and is wrong, the results will be biased.

The standard for modeling longitudinal data is a growth curve model. Obviously, there are many valuable applications of growth curve models, but the advantage of ILD or EMA data is that it can capture complex relationships and processes. While a growth curve model ignores this complexity, TVEM embraces it.



Current and Future Applications of TVEM

A list of our current work on ILD and TVEM can be found on our ILD research page.


In the future, the capacity to measure and model time-varying effects could alter the future of behavioral interventions. The better we understand complex relationships, the better able we will be to understand where problems arise and how to intervene at critical moments.


View our recommended reading for ILD

Like Us On Facebook or Tweet This Page