larch.numba.Model.quantity_ca

larch.numba.Model.quantity_ca

Model.quantity_ca

The portion of the quantity function computed from idca data.

Data expressions in this utility function can actually reference both idca and idco format variables. Except in unusual model designs, every complete data expression should have at least one idca component.

Note that for the quantity function, the actual computed linear function uses the exponential of the parameter value(s), not the raw values. Thus, if the quantity function is given as P.Param1 * X.Data1 + P.Param2 * X.Data2, the computed values will actually be exp(P.Param1) * X.Data1 + exp(P.Param2) * X.Data2. This transformation ensures that the outcome from the quantity function is always positive, so long as at all of the data terms in the function are positive. The LinearFunction_C class itself is not intrinsically aware of this implementation detail, but the Model.utility_functions() method is, and will render the complete utility function in a mathematically correct form.

Examples

>>> from larch import Model, P, X
>>> m = Model()
>>> m.quantity_ca = P.Param1 * X.Data1 + P.Param2 * X.Data2
>>> print(m.quantity_ca)
P.Param1 * X.Data1 + P.Param2 * X.Data2
>>> m.quantity_ca += P.Param3 * X.Data3 / X.DataCO4
>>> print(m.quantity_ca)
P.Param1 * X.Data1 + P.Param2 * X.Data2 + P.Param3 * X('Data3/DataCO4')
Type

LinearFunction_C