This post explains why Euler Equation Residuals are not a valid measure of numerical error in Heterogeneous Agent models.
The basic idea of Euler Equation Residuals is that for some Economic models an Euler equation, such as
c_t=\beta (1+r) E[c_{t+1}^{-\sigma} ]
must hold (it is a necessary condition of the model solution concept). So we can evaluate the accuracy of our model solution by calculating,
EER \equiv \tilde{c}_t-\beta (1+r) \tilde{E}[\tilde{c}_{t+1}^{-\sigma} ]
where the \tilde{ \, } indicates that this is based on the numerical solution of our model. The closer the Euler Equation Residuals, EER, is to zero, the more accurate the model solution. Santos (2000) provides a formal proof that bounding the EER provides a bound on numerical error in the policy function, so small EER implies small numerical error in the model outputs that we actually care about.
This is a good idea for, e.g., a Representative Agent Real Business Cycle model. The main problem here is that EER does not apply to (essentially all) heterogeneous agent models. A lesser problem is that EER is highly biased about what kinds of numerical error it is measuring.
The reason that EER is not valid for heterogenous agent models is that they do not have an Euler equation like the above, instead they will have an inequality like,
c_t \leq \beta (1+r) E[c_{t+1}^{-\sigma} ]
You can immediately see that the EER should be non-zero where this inequality does not bind (where it is <), and EER should be zero where this inequality does bind (where it is =). Theory tells us that it will bind in some parts of the model state space and not in others, so we will definitely have both situations. If you knew where the = must hold, you could evaluate EER on that part of the state-space and get a partial measure of model accuracy. The problem is that we do not know where the Euler Equation does and does not bind, and obviously we cannot just use our model solution for this as we don’t know that it is correct. It is actually possible to rescue EERs with a modification for models where the Euler Equation is an inequality: Li (2015) does this under widely applicable assumptions, but unfortunately the resulting error bounds are too loose to be useful in practice.
So conceptually, Euler Equation Residuals just don’t work for Heterogeneous Agent models, because they have these inequalities, e.g., from a borrowing constraint or collateral constraint.
The other problem with Euler Equation Residuals is their bias. Go back to the second equation and look closely. You will notice there is not just a tilde on c, but also a tilde on E, the expectations operator. EERs can evaluate error in the policy function, but they take as given (and so ignore) any numerical error in the discretization of shocks. So if you solve the Aiyagari (1994) model using huge numbers of points for assets, but just 3 points to discretize the AR(1) process then the EERs will tell you the solution is highly accurate. Obviously the solution would be much more accurate if you used one quarter the number of points on assets and four times the number of points on the AR(1) process, but the EERs will tell you that the numerical error has increased! This is why if you look at papers from the 1990s and early 2000s when EERs were widely used they regularly have a ridiculous combination of lots of points on assets with just 3/5/7 points on shocks, because the EERs tell you to do that, even though it is giving an inaccurate solution to the model you want to solve. This is partly because EERs, like essentially every measure of numerical error is about ‘internal consistency’ of the model solution. They do not measure how far the model solution is from the true solution, they measure how far the model solution is from being internally consistent.
This is not to say that internal model consistency is not a good thing. It is a necessary condition for being accurate, but it is not sufficient. While EERs are not valid for Heterogenous Agent models, Den Haan & Marcet (1994) have a measure of internal model consistency that can be used.
What about if we want to go beyond internal model consistency and find out if we are close to the true solution? The only option I am aware of is to analytically prove that a given numerical method applied to a given model type will (eventually as the accuracy is turned up) converge to the true solution. For example, Kirkby (2018) proves that pure discretization applied to Bewley-Imrohoroglu-Huggett-Aiyagari models will converge to the true solution as the grid spacing goes to zero (so number of grid points goes to infinity). Of course this still leaves the issue of typos, so you would want to have two or more people separately code up the model before you could confidently declare that you have found the true solution.
Three final comments: (i) Very rarely will anyone ever check they have the true solution to the model because of the insane amount of work that would be required to do so, so just think of the above as an explanation of what is required rather than as a suggestion [the only papers I know that do so tend to be written by multiple authors each of whom codes the model with a different algorithm, and the focus is on comparing algorithms not on finding the true solution]. This is an appropriate place for the profession to be, as the benefit of such checks is most definitely not worth the cost. (ii) This is why we do replication, because even if the model passes internal consistency tests of numerical error we still cannot conclude that the model solution is the true solution. Try to make sure your own codes are correct, but don’t fully trust other people’s until it has been replicated. (iii) Please don’t use Euler Equation Residuals for your Heterogeneous Agent model!