A generalized model for forecasting technological substitution