comparing states with resid