Conceptual question about piecewise growth curve analysis I understand that when using fixed breakpoints to do piecewise growth curve analysis in, e.g., lmer, you can specify dummy variables that replace the original time variable. For example, if you have 6 trials in two phases p, q, you could use:
T p q
0 0 0
1 1 0
2 2 0
3 2 1
4 2 2
5 2 3

What I'm confused about is why it isn't more like:
T p  q
0 0  NA
1 1  NA
2 2  0
3 NA 1
4 NA 2
5 NA 3

In other words, why doesn't the presence of the extra unchanging points in p (2,2,2) and q (0,0) distort the estimation of p and q?
Forgive me if this is naive, but I'd really like to understand it.
UPDATE. First, consider the following trivial experiment:
> # made up experiment of 9 total trials. there are three
> # phases to be analyzed using a piecewise growth curve.
> # this is the data from the middle phase only, 5 trials
> middleTrials <- c(0,1,2,3,4)
> middleData <- c(4,7,8,11,17)
> # here are its intercept and slope
> lm(middleData ~ middleTrials)

Call:
lm(formula = middleData ~ middleTrials)

Coefficients:
 (Intercept)  middleTrials  
         3.4           3.0  

> 
> # this is the same data, but now “in context” of the beginning and ending phases
> # note that the added leading trials are set to 0 and the added final trials are
> # set to the last trial number of the thePhase, as might done in specifying
> # a piecewise growth curve.
> allTrials <- c(0,0,0,1,2,3,4,4,4)
> allData <- c(1,3,4,7,8,11,17,18,21)
> # here are its intercept and slope
> lm(allData ~ allTrials)

Call:
lm(formula = allData ~ allTrials)

Coefficients:
(Intercept)    allTrials  
      2.308        3.846  

> 
> # finally, this is a run using allData again, but now setting non-middle trial
> # numbers to NA
> allTrialsNA <- c(NA,NA,0,1,2,3,4,NA,NA)
> allData <- c(1,3,4,7,8,11,17,18,21)
> # here are its intercept and slope
> lm(allData ~ allTrialsNA, na.action = na.exclude)

Call:
lm(formula = allData ~ allTrialsNA, na.action = na.exclude)

Coefficients:
(Intercept)  allTrialsNA  
        3.4          3.0  

Note that the version with non-middle trials set to NA gets the slope and intercept of the middle trials correct (duh), but when they are set to values as in a piecewise growth curve dummy variable, the slope and intercept are incorrect. This is the basis of my question: how can lmer() or lme() get the correct slope and intercept for a given phase correct when the conventional way to specify the different phases is used?
 A: I presume you mean piecewise linear regression for which, in a simple case, the fixed-effects part could look like this: $$\beta_0 + \beta_1 \texttt{time}_{ij} + \beta_2 (\texttt{time}_{ij} - c)_+,$$ where $(A)_+ = A$ when $A \geq 0$ and 0 otherwise. In this case, the coefficient $\beta_2$ captures the change in the slope after time point $c$. That is, for $\texttt{time}_{ij} < c$ the slope is $\beta_1$ and for $\texttt{time}_{ij} \geq c$ the slope is $\beta_1 + \beta_2$. Hence, testing for the null hypothesis $H_0: \beta_2 = 0$ can tell us if there is a change in the slope.
You can extend the above formulation with more than one cut-points $c$, and by making the functional form of $\texttt{time}_{ij}$ nonlinear before and after each cut-point. This is in fact what regression splines are doing. In addition, you could add this formulation also in the random-effects part of your model.
Finally, with regard to your specific question, it is not clear why you have put the NAs. Note that rows with missing values will be dropped, and hence in this case it seems that the specification of your fixed-effects part will not be correct. 
