Hi, running the WorkshopOLGModel4, I get the error hints from the calibrating section below:
Unrecognized function or variable ‘nCalibParams’.
Error in [CalibrateOLGModel](matlab:matlab.lang.internal.introspective.errorDocCallback(‘CalibrateOLGModel’, ‘C:\Program Files\MATLAB\VFIToolkit\Estimation\Calibration\CalibrateOLGModel.m’, 215)) ([line 215](matlab: opentoline(‘C:\Program Files\MATLAB\VFIToolkit\Estimation\Calibration\CalibrateOLGModel.m’,215,0)))
CalibParamNames{nCalibParams+pp}=GEPriceParamNames{pp};
^^^^^^^^^^^^
Error in [WorkshopOLGModel4](matlab:matlab.lang.internal.introspective.errorDocCallback(‘WorkshopOLGModel4’, ‘C:\Downloads_20251105\2025Workshop-LSE\VFIWorkshop2025\Part4\WorkshopOLGModel4.m’, 191)) ([line 191](matlab: opentoline(‘C:\Downloads_20251105\2025Workshop-LSE\VFIWorkshop2025\Part4\WorkshopOLGModel4.m’,191,0)))
[CalibParams,calibsummary]=CalibrateOLGModel(CalibParamNames,TargetMoments,n_d,n_a,n_z,N_j,d_grid, a_grid, z_grid, pi_z, ReturnFn, Params, DiscountFactorParamNames, jequaloneDist, AgeWeightParamNames, , GEPriceParamNames, FnsToEvaluate, GeneralEqmEqns, heteroagentoptions, caliboptions, vfoptions,simoptions);
^^^^^^^^^^^^^^^^^^^^
By the way, there is a typo in the ReturnFn for the WorkshopOLGModel1 and 3:
w=(1-alpha)*((r+delta)/alpha)^(alpha/(1-alpha));
I think the power would be ^(alpha/(alpha-1))?