estimation.Feiv

estimation.Feiv(self, Y, X, endogvar, Z, weights, coefnames_x, coefnames_z, collin_tol, weights_name, weights_type, solver='np.linalg.solve')

Non user-facing class to estimate an IV model using a 2SLS estimator.

Inherits from the Feols class. Users should not directly instantiate this class, but rather use the feols() function. Note that no demeaning is performed in this class: demeaning is performed in the FixestMulti class (to allow for caching of demeaned variables for multiple estimation).

Parameters

Name Type Description Default
Y np.ndarray Dependent variable, a two-dimensional np.array. required
X np.ndarray Independent variables, a two-dimensional np.array. required
endgvar np.ndarray Endogenous Indenpendent variables, a two-dimensional np.array. required
Z np.ndarray Instruments, a two-dimensional np.array. required
weights np.ndarray Weights, a one-dimensional np.array. required
coefnames_x list Names of the coefficients of X. required
coefnames_z list Names of the coefficients of Z. required
collin_tol float Tolerance for collinearity check. required
solver str Solver to use for the estimation. Alternative is ‘np.linalg.lstsq’. 'np.linalg.solve'
weights_name Optional[str] Name of the weights variable. required
weights_type Optional[str] Type of the weights variable. Either “aweights” for analytic weights or “fweights” for frequency weights. required

Attributes

Name Type Description
_Z np.ndarray Processed instruments after handling multicollinearity.
_coefnames_z list Names of coefficients for Z after handling multicollinearity.
_collin_vars_z list Variables identified as collinear in Z.
_collin_index_z list Indices of collinear variables in Z.
_is_iv bool Indicator if instrumental variables are used.
_support_crv3_inference bool Indicator for supporting CRV3 inference.
_support_iid_inference bool Indicator for supporting IID inference.
_tZX np.ndarray Transpose of Z times X.
_tXZ np.ndarray Transpose of X times Z.
_tZy np.ndarray Transpose of Z times Y.
_tZZinv np.ndarray Inverse of transpose of Z times Z.
_beta_hat np.ndarray Estimated regression coefficients.
_Y_hat_link np.ndarray Predicted values of the regression model.
_u_hat np.ndarray Residuals of the regression model.
_scores np.ndarray Scores used in the regression.
_hessian np.ndarray Hessian matrix used in the regression.
_bread np.ndarray Bread matrix used in the regression.
_pi_hat np.ndarray Estimated coefficients from 1st stage regression
_X_hat np.ndarray Predicted values of the 1st stage regression
_v_hat np.ndarray Residuals of the 1st stage regression

Raises

Type Description
ValueError If Z is not a two-dimensional array.

Methods

Name Description
get_fit Fit a IV model using a 2SLS estimator.

get_fit

estimation.Feiv.get_fit()

Fit a IV model using a 2SLS estimator.