# Error in LifeCycleModel30

**URL:** <https://discourse.vfitoolkit.com/t/error-in-lifecyclemodel30/288>\
**Category:** Uncategorized\
**Created:** [June 15, 2024, 3:22pm UTC](https://discourse.vfitoolkit.com/t/error-in-lifecyclemodel30/288 "2024-06-15T15:22:21Z")\
**Posts on this page:** 2\
**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:** [June 15, 2024, 3:22pm UTC](https://discourse.vfitoolkit.com/t/error-in-lifecyclemodel30/288/1 "2024-06-15T15:22:21Z")

</div>

I tried to run LifeCycleModel30 (model with semi-exogenous shocks and fertility decision) in the introduction to lifecycle models, but I got this error:

```matlab
Finite horizon: 80 of 81 
Error using kron
Inputs must be 2-D.

Error in ValueFnIter_Case1_FHorz_SemiExo_raw (line 192)
                entireEV=kron(EV,ones(N_d1,1));

Error in ValueFnIter_Case1_FHorz (line 749)
                    [VKron, Policy3]=ValueFnIter_Case1_FHorz_SemiExo_raw(n_d1,n_d2,n_a,n_z,vfoptions.n_semiz, N_j, d1_grid, d2_grid, a_grid, z_gridvals_J, semiz_gridvals_J, pi_z_J, pi_semiz_J, ReturnFn, Parameters, DiscountFactorParamNames, ReturnFnParamNames, vfoptions);

```

The reason is that EV is not a 2-dim array but it has size (201,1,88). Adding `squeeze(EV)` avoids the error when calling the `kron` function but generates another error in the next line (incompatible size for the + operation).

---

<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:** [June 17, 2024, 12:36am UTC](https://discourse.vfitoolkit.com/t/error-in-lifecyclemodel30/288/2 "2024-06-17T00:36:02Z")

</div>

fixed. thanks for letting me know.

(Was doing kron() when needed to be repelem() because it has more than 2 dimensions; kron can only be used in 2-D.)
