1
$\begingroup$

Suppose we have a regression / survival model where we would like to model follow-up time using a regression spline. Follow-up time has two phases (first treatment active, and second treatment completed i.e. not active) which we would like to consider i.e. allow for slope changes. However, the time points at which these phases occur can differ by subject (person). How can we construct the spline for time so that the slope can change as the subject passes from the first to second phase? Do we need to place a knot at this boundary but allow it to vary by subject?

Update (further details as requested)

I was wondering if this approach is possible to use in regression / survival models in general. Hence I just used the unit of person. However, the current study for which I would like to consider this approach is a longitudinal study modeling counts (rates) over time. We have monthly counts by sex for several months before start of intervention (I.e. baseline), during intervention (i.e. active phase), and after intervention (i.e. post phase), in paired control and treatment sites. I had planned to use mean (since we have several months worth-) of “before” as baseline covariate as per ANCOVA approach. So the model will look roughly like:

Post = offset + baseline + month + sex + treatment + phase + time_since_start_active + time_since_start_post + (1|pair/clinic)

Where: month is categorical to adjust for natural monthly changes, treatment is yes/no indicating whether site is real intervention or control, phase is active/post. The time terms are numeric which I would like to model with splines. The terms in brackets are random effects.

The timeline is the same within but not between pairs of clinics. In other words, the lengths of active and post phases might differ between pairs of clinics. That’s why I was considering two time variables that I wondered if these could be constructed together in one spline term?

I am also aware of the need for interaction terms in the above model. In particular, I think there is a need to include random slopes for time variables since duration of phase might alter its slope?

$\endgroup$
14
  • $\begingroup$ If the two phases are well defined, might it be possible to rescale time for each individual to represent the fraction of the phase that has passed until that time? $\endgroup$
    – EdM
    Commented Jun 20 at 20:55
  • $\begingroup$ @EdM, if we rescale time to a fraction, the phase change does not always occur at e.g. time = 0.5. Rather, second phase can occur at several times e.g. 0.2, 0.5, 0.6, depending on subject $\endgroup$
    – user167591
    Commented Jun 22 at 13:16
  • $\begingroup$ I was thinking of trying to do something along the lines of what is described at the end of this web post rpubs.com/alecri/review_longitudinal where it talks about linear splines. It describes using 2 time variables, time and timepost, though the resulting curve is not smooth which I would like $\endgroup$
    – user167591
    Commented Jun 22 at 13:21
  • $\begingroup$ Please edit the question to say more about what you are trying to model and the types of predictor variables involved. In a survival model the time-to-event or follow-up time is typically the outcome variable. You can use a regression spline to model the association of outcome with a continuous predictor variable, but not for the outcome by itself. It sounds like you might use a two-stage survival model, but it's hard to say without more information. Please provide that information by editing the question, as comments are easy to overlook and can be deleted. $\endgroup$
    – EdM
    Commented Jun 22 at 13:30
  • 1
    $\begingroup$ Please define the experimental design. Is treatment an endogenous or an exogenous variable, i.e., were treatment crossover times pre-determined by randomization so that treatment is exogenous and interpretation will not be complex? If treatment is endogenous (internal time-dependent covariate) how is it chosen? $\endgroup$ Commented Jun 23 at 12:06

1 Answer 1

1
$\begingroup$

The study involved pairs of clinics, with an initial "baseline" observation phase before interventions. Then one member of the pair had an intervention and the other served as control during the "active phase." After some period of time, the intervention was discontinued ("post phase"). Outcomes are counts of "uptake of healthy lifestyle intervention each month" per clinic.*

With a discontinuity in treatment at the switch from "active" to "post" phases, fitting the time predictor with a smooth spline might require something beyond what's in the code suggested in the question. Section 2.8 of Frank Harrell's Regression Modeling Strategies illustrates how to add extra knots near the discontinuity and to use the R gTrans() function in his rms package to incorporate a jump at the discontinuity and seasonal trends in a Poisson regression, similar to the scenario in this question. This web page provides more examples of how to use that function.

The problem in this case is that the duration of the "active phase" could differ among pairs of clinics. For example, some pairs of clinics had 12 months of "active phase" while others had 15.

The simplest way to deal with that would be to model the "active" and "post" phases separately. That would use all the data available for those phases, and shouldn't pose a problem with some of the clinic pairs not having values at later times within a phase. That might also simplify evaluating whether the duration of the "active" phase was associated with different trajectories of "uptake" rates during the "post" phase. One model could evaluate time relative to the "baseline" to "active" transition, while the second evaluates time relative to the "active" to the "post" transition. Each model would then be similar to an example in the linked web page, in which time was evaluated relative to time of menarche.

I haven't thought of a way to do this all together in a single model, although there might be a clever way to use gTrans() for that.


*This answer focuses on the modeling of time as raised in the question. It doesn't address Frank Harrell's concerns, noted in comments, about randomization of the intervention among members of a pair of and thus the interpretability of results.

$\endgroup$
20
  • $\begingroup$ Thanks so much @EdM,, $\endgroup$
    – user167591
    Commented Jul 3 at 10:24
  • $\begingroup$ Thanks so much @EdM. Do you think a single time variable with time zero start of active phase, phase as a categorical predictor, and their interaction would work? Im concerned about the high correlation of phase and time though. $\endgroup$
    – user167591
    Commented Jul 3 at 10:45
  • $\begingroup$ @user167591 I don't see a way to use a single time scale without losing information about changes at the transition from active to post phase. Say that some pairs had 12 months of active phase while others had 15. With a single time scale and an interaction with phase, at 16 months (all pairs now in post phase) you would be assuming that all pairs had the same outcomes. In fact some pairs would be 4 months post-active while others were only 1 month post-active, so you might expect differences on that account. That's why I suggest two models, centered on the transition times. $\endgroup$
    – EdM
    Commented Jul 3 at 13:03
  • $\begingroup$ if we center on transition times, wouldn’t we get negative values extending into baseline phase? I was thinking to use mean baseline as a covariate as per the ANCOVA approach. $\endgroup$
    – user167591
    Commented Jul 3 at 17:14
  • 1
    $\begingroup$ @user167591 the choice between the last pre-treatment baseline value or an average over prior baseline values to calculate the differences is a matter of your understanding of the subject matter, not statistics. If you don't have reason (before looking at the data) to expect differences among pre-treatment values, then their average might be more precise. That probably isn't the case at the switch to the second phase of the study, however, as the prior values presumably change during the first phase. Using differences should be OK if you aren't also using baseline values as predictors. $\endgroup$
    – EdM
    Commented Sep 8 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.