function r = ge_resid_aftershock(xvec, params, alphaF, alphaOf_all, alphaJ_all, ...
                                 Q_after_all, W_before_all, zbar0, Ybar0, Wbar0, Ybar0_dup, Wof_fun)
% Residuals for the 2D GE fixed point: want implied Wbar,Ybar to match Wbar0*gW, Ybar0*gY.

[Wbar_imp, Ybar_imp] = ge_forward_eval_aftershock(xvec, params, alphaF, alphaOf_all, ...
                    alphaJ_all, Q_after_all, W_before_all, zbar0, Ybar0, Wof_fun);

rW = log(Wbar_imp) - log(Wbar0 * exp(xvec(1)));
rY = log(Ybar_imp) - log(Ybar0_dup * exp(xvec(2)));
r  = [rW; rY];
end
