ijive¶
- weak_instruments.ijive.IJIVE(Y: ndarray[tuple[int, ...], dtype[float64]], W: ndarray[tuple[int, ...], dtype[float64]], X: ndarray[tuple[int, ...], dtype[float64]], Z: ndarray[tuple[int, ...], dtype[float64]], talk: bool = False)¶
Calculates the Instrumental Variable estimator using the IJIVE method.
- Parameters:
Y (NDArray[np.float64]) – The dependent variable.
W (NDArray[np.float64]) – The matrix of controls.
X (NDArray[np.float64]) – The matrix of endogenous regressors.
Z (NDArray[np.float64]) – The matrix of instruments.
talk (bool, optional) – If True, prints additional information. Default is False.
- Returns:
beta (NDArray[np.float64]) – The estimated coefficients.
r2 (NDArray[np.float64]) – The R-squared value of the model.
F (NDArray[np.float64]) – The F-statistic of the model.
ar2 (NDArray[np.float64]) – The adjusted R-squared value of the model.
root_mse (NDArray[np.float64]) – The root mean square error of the model.
pvals (np.float64) – The p-values for the hypothesis tests.
tstats (np.float64) – The t-statistics for the hypothesis tests.
cis (NDArray[np.float64]) – The confidence intervals for the coefficients.
Example
>>> Y = np.array([1, 2, 3]) >>> W = np.array([[1, 0], [0, 1], [1, 1]]) >>> X = np.array([[1], [2], [3]]) >>> Z = np.array([[1], [2], [3]]) >>> result = IJIVE(Y, W, X, Z) >>> print(result.beta) [0.5]
- class weak_instruments.ijive.IJIVEResult(beta: ndarray[tuple[int, ...], dtype[float64]], f_stat: ndarray[tuple[int, ...], dtype[float64]], r_squared: float64, adjusted_r_squared: float64, root_mse: float64, pvals: float64, tstats: ndarray[tuple[int, ...], dtype[float64]], cis: ndarray[tuple[int, ...], dtype[float64]])¶
Bases:
object
Stores results for the IJIVE estimator.
- beta¶
Estimated coefficients for the IJIVE model.
- Type:
NDArray[np.float64]
- f_stat¶
F-statistic of the model.
- Type:
float
- r_squared¶
R-squared value of the model.
- Type:
float
- adjusted_r_squared¶
Adjusted R-squared value of the model.
- Type:
float
- root_mse¶
Root mean squared error of the model.
- Type:
float
- pvals¶
p-values for the estimated coefficients.
- Type:
list of float
- tstats¶
t-statistics for the estimated coefficients.
- Type:
list of float
- cis¶
Confidence intervals for the estimated coefficients.
- Type:
list of tuple
- summary()¶
Prints a summary of the IJIVE results in a tabular format similar to statsmodels OLS and UJIVE1.