Robust and consistent variable selection for generalized linear and additive models