Generalized Instrumental Variables