# Conceptual Introduction to TVEM for ILD

### Why does TVEM matter?

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 associations with 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.

### What are ILD and how many data points do I need?

There is no hard, fast rule for exactly what constitutes ILD. Generally, ILD are 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.

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. NOTE: data spacing is also important. Large gaps in the measurements can decrease a TVEM’s usefulness.   If we measured craving two times, we would perceive that the cravings were low and stable for the duration of the two days. If we measured craving five times, we would perceive that the cravings increased steadily, leveled off, and then fell steadily. If we measured more intensively (17 times in this example), we would see that the person’s cravings fluctuated wildly throughout the time span.

### If I have enough data points, how many subjects do I need?   In the %TVEM SAS macro, 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. 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. 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.

### If the macro does not provide a p-value, how do I publish my results? In many journals in the behavioral sciences, researchers report a p-value to express whether an association is significant. However, a time-varying effect is an irregularly shaped curve, made up of an infinite number of points. This means that an overall p-value would not meaningfully demonstrate the association that was modeled. The entire curve is needed to show at what times the association is or is not statistically significant and to show how the association changes.

For a time-invariant parameter, significance can be expressed through either a p-value or a confidence interval (as seen in the figure on the right, where the red dot is the estimate, and the blue dots are the confidence intervals). In order to show variation over time, the p-value is not useful but a dynamic confidence interval is. So, while journals typically print p-values, a confidence interval provides exactly the same information. TVEM results present an estimated coefficient and 95% confidence intervals for the entire curve which can be used to determine statistical significance at any point on the curve. That is why the TVEM macro expresses results graphically.