A repeatedly measured outcome in longitudinal studies allows researchers to monitor how the outcome changes over time. When an intervention affects the outcome and subjects initiate the intervention at different times during the course of the studies, it is essential to account for the varying time to intervention (TTI) in modeling changes in the outcome over time. In this paper, we develop a piecewise polynomial regression model with TTIvarying coefficients that describes the population mean outcome over time. The TTI-varying coefficients in the model enable us to capture the population mean outcome trajectory influenced by not only the intervention, but also the varying TTI. In observational studies where the influences are confounded by other covariates, it can result in estimation bias without accounting for them properly. A double-weighted estimation procedure is proposed on the basis of a kernel function and a generalized propensity score. The estimation procedure effectively corrects estimation bias of the TTI-varying coefficients and provides valid statistical inference about the coefficients. We apply our approach to assess changes in the population mean of an inflammation biomarker for HIV-infected adults in Haiti who initiate antiretroviral therapy following the World Health Organization guideline.