The covariate-adjusted residual estimator and its use in both randomized trials and observational settings