iode.Scalar

class iode.Scalar(value: float = 0.9, relax: float = 1.0)[source]

Scalars are essentially estimated coefficients of econometric equations. For this reason, each scalar contains in its definition:

  • its value

  • the relaxation parameter, set to 0 to lock the coefficient during estimation

  • its standard deviation, result of the last estimation

Only the values of the scalars are relevant when calculating a LEC expression. The other two values (relaxation and standard deviation) are only meaningful for estimation.

The names of scalars must be in lowercase so that variables are distinct from scalars in LEC formulas.

Parameters:
value: float

value of the scalar. Defaults to 0.9.

relax: float

relax value of the scalar. The value must be between 0.0 and 1.0. Defaults to 1.0

Attributes:
value: float

Value of the scalar.

relax: float

Relaxation parameter used in the context of equations estimation. For example, setting the relaxation parameter to 0 will ‘lock’ the coefficient during the estimation process.

std: float

Standard deviation. Calculated during the estimation process.

Methods

copy()

Return a copy of the current Scalar.

from_cython_obj

Examples

>>> import numpy as np
>>> from iode import Scalar
>>> # default value and relax
>>> scalar = Scalar()
>>> scalar
Scalar(0.9, 1, na)
>>> # default relax
>>> scalar = Scalar(0.5)
>>> scalar
Scalar(0.5, 1, na)
>>> # specific value and relax
>>> scalar = Scalar(0.5, 0.8)
>>> scalar
Scalar(0.5, 0.8, na)
>>> # Python nan are converted to IODE NA
>>> scalar = Scalar(np.nan)
>>> scalar
Scalar(na, 1, na)
>>> # Python inf are not accepted
>>> scalar = Scalar(np.inf)
Traceback (most recent call last):
...
ValueError: Expected 'value' to be a finite number
>>> # relax must be between 0.0 and 1.0
>>> scalar = Scalar(0.5, 1.1)
Traceback (most recent call last):
...
ValueError: Expected 'relax' value between 0.0 and 1.0
__init__(value: float = 0.9, relax: float = 1.0) Self[source]

Methods

__init__([value, relax])

copy()

Return a copy of the current Scalar.

from_cython_obj(obj)

Attributes

relax

std

value