linearmodels.iv.model.IVLIML.from_formula

static IVLIML.from_formula(formula, data, *, weights=None, fuller=0, kappa=None)[source]
Parameters
formulastr

Formula modified for the IV syntax described in the notes section

dataDataFrame

DataFrame containing the variables used in the formula

weightsarray_like

Observation weights used in estimation

fullerfloat

Fuller’s alpha to modify LIML estimator. Default returns unmodified LIML estimator.

kappafloat

Parameter value for k-class estimation. If not provided, computed to produce LIML parameter estimate.

Returns
IVLIML

Model instance

Notes

The IV formula modifies the standard formula syntax to include a block of the form [endog ~ instruments] which is used to indicate the list of endogenous variables and instruments. The general structure is dependent ~ exog [endog ~ instruments] and it must be the case that the formula expressions constructed from blocks dependent ~ exog endog and dependent ~ exog instruments are both valid formulas.

A constant must be explicitly included using ‘1 +’ if required.

Examples

>>> import numpy as np
>>> from linearmodels.datasets import wage
>>> from linearmodels.iv import IVLIML
>>> data = wage.load()
>>> formula = "np.log(wage) ~ 1 + exper + exper ** 2 + brthord + [educ ~ sibs]"
>>> mod = IVLIML.from_formula(formula, data)
Return type

IVLIML