Generalized Encouragement-Based Instrumental Variables for Counterfactual Regression