A flexible parametric approach for estimating switching regime models and treatment effect parameters