iode.dynamic_adjustment
- iode.dynamic_adjustment(method: AdjustmentMethod | str, eqs: str, c1: str = 'c1', c2: str = 'c2') str[source]
Transform a LEC equation to add a dynamic adjustment.
Two methods can be used. Given the equation \(LHS = RHS\), we have:
Partial Adjustment (PARTIAL): \(d(LHS) = c1 * (RHS - (LHS)[-1])\)
Error Correction Model (ERROR_CORRECTION): \(d(LHS) = c1 * d(RHS) + c2 * (RHS -LHS)[-1]\)
- Parameters:
- method: AdjustmentMethod or str
Method used for the dynamic adjustment. Possible values are PARTIAL or ERROR_CORRECTION.
- eqs: str
LEC equation to dynamically adjust.
- c1: str, optional
Name of the first coefficient. Default to “c1”.
- c2: str, optional
Name of the second coefficient. Not used with the Partial Adjustment method. Default to “c2”.
- Returns:
- str
Dynamically adjusted equation.
Examples
>>> from iode import SAMPLE_DATA_DIR, equations, dynamic_adjustment, AdjustmentMethod >>> equations.load(f"{SAMPLE_DATA_DIR}/fun.eqs") Loading .../fun.eqs 274 objects loaded >>> lec = equations["ACAF"].lec >>> lec '(ACAF/VAF[-1]) :=acaf1+acaf2*GOSF[-1]+\nacaf4*(TIME=1995)'
Partial Adjustment
>>> partial_adjust_eq = dynamic_adjustment(AdjustmentMethod.PARTIAL, lec) >>> partial_adjust_eq 'd((ACAF/VAF[-1])) := c1 * (acaf1+acaf2*GOSF[-1]+\nacaf4*(TIME=1995) -((ACAF/VAF[-1]))[-1])'
Error Correction Model
>>> error_corr_adjust_eq = dynamic_adjustment(AdjustmentMethod.ERROR_CORRECTION, lec) >>> error_corr_adjust_eq 'd((ACAF/VAF[-1])) := c1 * d(acaf1+acaf2*GOSF[-1]+\nacaf4*(TIME=1995)) + c2 * (acaf1+acaf2*GOSF[-1]+\nacaf4*(TIME=1995) -(ACAF/VAF[-1]))[-1]'