# Bug in LifeCycleModel38 and WorkshopModel11

**URL:** https://discourse.vfitoolkit.com/t/bug-in-lifecyclemodel38-and-workshopmodel11/602
**Category:** Uncategorized
**Created:** [March 7, 2026, 8:50am UTC](https://discourse.vfitoolkit.com/t/bug-in-lifecyclemodel38-and-workshopmodel11/602 "2026-03-07T08:50:19Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![yechen](https://discourse.vfitoolkit.com/letter_avatar_proxy/v4/letter/y/5fc32e/32.png) [@yechen](https://discourse.vfitoolkit.com/u/yechen)
#### Post date: [March 7, 2026, 8:50am UTC](https://discourse.vfitoolkit.com/t/bug-in-lifecyclemodel38-and-workshopmodel11/602/1 "2026-03-07T08:50:19Z")

</div>

Both models aim to introduce loss-aversion preferences into the life-cycle model.

The following are the error messages from the LifeCycleModel38.

```auto
>> LifeCycleModel38
Test ValueFnIter
File: ValueFnIter_Case1_FHorz_ResidAsset_nod_raw.m Line: 96 Column:
88
Invalid expression. When calling a function or indexing a variable,
use parentheses. Otherwise, check for mismatched delimiters.

Error in ValueFnIter_Case1_FHorz_ResidAsset (line 53)
            [VKron, PolicyKron]=ValueFnIter_Case1_FHorz_ResidAsset_nod_raw(n_a1,n_r,n_z, N_j, a1_grid, r_grid, z_gridvals_J, pi_z_J, ReturnFn, rprimeFn, Parameters, DiscountFactorParamNames, ReturnFnParamNames, rprimeFnParamNames, vfoptions);
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in ValueFnIter_Case1_FHorz (line 443)
    [V,Policy]=ValueFnIter_Case1_FHorz_ResidAsset(n_d,n_a1,n_r,n_z, N_j, d_grid, a1_grid, r_grid, z_gridvals_J, pi_z_J, ReturnFn, Parameters, DiscountFactorParamNames, ReturnFnParamNames, vfoptions);
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in LifeCycleModel38 (line 124)
[V, Policy]=ValueFnIter_Case1_FHorz(n_d,n_a,n_z,N_j, d_grid, a_grid, z_grid, pi_z, ReturnFn, Params, DiscountFactorParamNames, [], vfoptions);
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

```

The following are the error messages from the WorkshopModel11. The WorkshopModel12 for ambiguity aversion shared the same errors.

```auto
>> WorkshopModel11
Unrecognized field name "paroverz".

Error in ValueFnIter_Case1_FHorz_ResidAsset_raw (line 208)
        if vfoptions.paroverz==1
           ^^^^^^^^^^^^^^^^^^
Error in ValueFnIter_Case1_FHorz_ResidAsset (line 59)
            [VKron, PolicyKron]=ValueFnIter_Case1_FHorz_ResidAsset_raw(n_d,n_a1,n_r,n_z, N_j, d_grid, a1_grid, r_grid, z_gridvals_J, pi_z_J, ReturnFn, rprimeFn, Parameters, DiscountFactorParamNames, ReturnFnParamNames, rprimeFnParamNames, vfoptions);
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in ValueFnIter_Case1_FHorz (line 443)
    [V,Policy]=ValueFnIter_Case1_FHorz_ResidAsset(n_d,n_a1,n_r,n_z, N_j, d_grid, a1_grid, r_grid, z_gridvals_J, pi_z_J, ReturnFn, Parameters, DiscountFactorParamNames, ReturnFnParamNames, vfoptions);
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in WorkshopModel11 (line 114)
[V, Policy]=ValueFnIter_Case1_FHorz(n_d,n_a,n_z,N_j, d_grid, a_grid, z_grid, pi_z, ReturnFn, Params, DiscountFactorParamNames, [], vfoptions);
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

```

---

<div class="post-metadata">

### Author: ![robertdkirkby](https://discourse.vfitoolkit.com/user_avatar/discourse.vfitoolkit.com/robertdkirkby/32/287_2.png) [@robertdkirkby](https://discourse.vfitoolkit.com/u/robertdkirkby)
#### Post date: [March 9, 2026, 12:43am UTC](https://discourse.vfitoolkit.com/t/bug-in-lifecyclemodel38-and-workshopmodel11/602/2 "2026-03-09T00:43:12Z")

</div>

Fixed LifeCycleModel38. Thanks for telling me.

I will go check the other two now.

---

<div class="post-metadata">

### Author: ![robertdkirkby](https://discourse.vfitoolkit.com/user_avatar/discourse.vfitoolkit.com/robertdkirkby/32/287_2.png) [@robertdkirkby](https://discourse.vfitoolkit.com/u/robertdkirkby)
#### Post date: [March 9, 2026, 12:58am UTC](https://discourse.vfitoolkit.com/t/bug-in-lifecyclemodel38-and-workshopmodel11/602/3 "2026-03-09T00:58:20Z")

</div>

Fixed WorkshopModel11 and WorkshopModel12. Was all very minor stuff. Thanks again. That is all of them working 🙂
