# Possible bug in the Castañeda et al. (2003) replication

**URL:** <https://discourse.vfitoolkit.com/t/possible-bug-in-the-castaneda-et-al-2003-replication/742>\
**Category:** Uncategorized\
**Created:** [November 28, 2026, 5:08pm UTC](https://discourse.vfitoolkit.com/t/possible-bug-in-the-castaneda-et-al-2003-replication/742 "2026-11-28T17:08:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aledinola](https://discourse.vfitoolkit.com/letter_avatar_proxy/v4/letter/a/3ec8ea/32.png) [@aledinola](https://discourse.vfitoolkit.com/u/aledinola)\
**Post date:** [November 28, 2026, 5:08pm UTC](https://discourse.vfitoolkit.com/t/possible-bug-in-the-castaneda-et-al-2003-replication/742/1 "2026-11-28T17:08:51Z")

</div>

I was using the toolkit routine for inheritance assets ( `vfoptions.inheritanceasset = 1`) and came across a possible bug in the Castaneda replication.

**Possible estate-tax timing error in the Castañeda et al. (2003) replication**

In `CDGRR2003_aprimeFn.m`, the estate tax applies whenever `z > J` and savings exceed the exemption. The function takes `zprime` as an argument but never uses it. As written, a retiree who survives into the next period pays the same estate tax as one who dies. [Asset-transition function](https://github.com/vfitoolkit/vfitoolkit-matlab-replication/blob/8fede8142fe425811d1bac88ab728223baacf99c/CastanedaDiazGimenezRiosRull2003/CDGRR2003_aprimeFn.m#L1-L12)

My reading is that death corresponds to a transition from retirement (`z > J`) to a working-age successor (`zprime <= J`). This also agrees with the government budget, which multiplies estate-tax receipts by the probability of death, `1-p_gg`. [Transition matrix](https://github.com/vfitoolkit/vfitoolkit-matlab-replication/blob/8fede8142fe425811d1bac88ab728223baacf99c/CastanedaDiazGimenezRiosRull2003/CDGRR2003_ExogShockFn.m#L83-L88) · [Estate-tax revenue](https://github.com/vfitoolkit/vfitoolkit-matlab-replication/blob/8fede8142fe425811d1bac88ab728223baacf99c/CastanedaDiazGimenezRiosRull2003/CastanedaDiazGimenezRiosRull2003.m#L124)

Should line 7 therefore read `if z > J && zprime <= J`? This would leave a surviving retiree’s savings intact and apply the existing tax formula only when assets pass to the successor.
