Which statistical model to use when trying to find the beginning of a time-dependent increase I have a repeated measures data set with time as the independent variable and a single dependent variable, y. That is, for each subject, I have a certain (small, from 1 to 3) number of measurements. The maximum time point of all measurements is a certain clinical event (diagnosis).
Visually, I see that until (roughly) a certain time point, y is independent of time. However, as the measurements approach the time of diagnosis, I can see that the measured variable starts to rise. In principle, this is the relationship that I think I observe:
$$
y(x) = \begin{cases}
a & x < x_1\\
a + bx & x \ge x_1\\
\end{cases}
$$
My question is: how to get an estimate and confidence intervals of $x_1$.
 A: The model you describe reminds me of changepoint models. Like you said, the model parameters change, in your case $b$, with respect to some changepoint $x_1$. 
There might be several ways to estimate such models. One way is to use Markov chain Monte Carlo (MCMC). This would provide estimates of the uncertainty of your parameter fits as well. 
OpenBugs is a softwarte frequently used in the context of MCMC. One example is about changepoint models. Maybe this will help.
http://www.openbugs.net/Examples/Stagnant.html
A: Such time-dependent covariates can be modeled such that their effects are smooth functions of time.  A flexible and relative simple way to do this is to string out the observations into a tall and thin format and to do an after-the-fit cluster sandwich or cluster bootstrap adjustment for intra-cluster correlation, a cluster being a patient.  Rather than trying to create a "fall off the cliff" threshold, keep the time functions smooth using regression splines.  The tall thin dataset would have final diagnosis as $Y$, duplicated for every record for the patient.  The predictors would be a spline of time until diagnosis, the independent variable $x$ (possibly expanded into splines), and a tensor spline interaction surface of the two variables (all cross-products of the spline terms for time and $x$).  When finished you can plot time, $x$, and probability of positive diagnosis from the fitted binary logistic model, on a 3-d wireframe plot or in a color image plot or contour plot.
With this setup every patient can have a different number of measurements, and different measurement times.
