Can a generalization of Difference in Differences (DiD) be done when the durations of pre-start and post-start periods vary by individual?
I believe that the mean pre-start-duration and mean post-start-duration could be modeled, then the lift could be computed as
$$ y = \alpha + \beta_{treatment-group}*X_{treatment-group} \\ + \beta_{time} * X_{post-start-duration} \\ - \beta_{time} * X_{pre-start-duration} \\+ \phi * X_{treatment-group} * X_{post-start-duration} $$
*Where $X_{post-start-duration}$ is 0 during the pre-start period else a positive number and likewise, $X_{pre-start-duration}$ is 0 during the post-start period else a positive number. And $X_{treatment-group}$ is a dummy variable for treatment group assignment.
Is the correct approach? Does a better one exist?
An example might be a study of year's advanced education effect on income. There is inherently a different level of treatment exposure (education) from associates, bachelors, masters, and PhD.
Likewise, it could not be guaranteed that every individual started or completed their advanced degree at the exact same time. So they would have differing levels of pre-degree duration and post-degree duration.