diff --git a/.gitignore b/.gitignore index 8176c49de..f7c9d7843 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,7 @@ dist .mypy_cache .pytest_cache .vscode -.coverage +.coverage* *.pyc __pycache__/ #docs/figures diff --git a/pyfixest/estimation/feols_.py b/pyfixest/estimation/feols_.py index e2a9ae2d8..f0bd33217 100644 --- a/pyfixest/estimation/feols_.py +++ b/pyfixest/estimation/feols_.py @@ -2506,38 +2506,6 @@ def update( return beta_n_plus_1 -def _feols_input_checks(Y: np.ndarray, X: np.ndarray, weights: np.ndarray): - """ - Perform basic checks on the input matrices Y and X for the FEOLS. - - Parameters - ---------- - Y : np.ndarray - FEOLS input matrix Y. - X : np.ndarray - FEOLS input matrix X. - weights : np.ndarray - FEOLS weights. - - Returns - ------- - None - """ - if not isinstance(Y, (np.ndarray)): - raise TypeError("Y must be a numpy array.") - if not isinstance(X, (np.ndarray)): - raise TypeError("X must be a numpy array.") - if not isinstance(weights, (np.ndarray)): - raise TypeError("weights must be a numpy array.") - - if Y.ndim != 2: - raise ValueError("Y must be a 2D array") - if X.ndim != 2: - raise ValueError("X must be a 2D array") - if weights.ndim != 2: - raise ValueError("weights must be a 2D array") - - def _get_vcov_type(vcov: str, fval: str): """ Get variance-covariance matrix type. diff --git a/pyfixest/estimation/fepois_.py b/pyfixest/estimation/fepois_.py index ee0cb0b1a..4a4ebbe7b 100644 --- a/pyfixest/estimation/fepois_.py +++ b/pyfixest/estimation/fepois_.py @@ -170,7 +170,7 @@ def prepare_model_matrix(self): self._fe.drop(na_separation, axis=0, inplace=True) self._data.drop(na_separation, axis=0, inplace=True) self._N = self._Y.shape[0] - self._N_rows = self._N # ok as weights not supported + self._N_rows = self._N # ok as weights not supported self.na_index = np.concatenate([self.na_index, np.array(na_separation)]) self.n_separation_na = len(na_separation) @@ -178,7 +178,6 @@ def prepare_model_matrix(self): self._k_fe = self._fe.nunique(axis=0) if self._has_fixef else None self._n_fe = np.sum(self._k_fe > 1) if self._has_fixef else 0 - def to_array(self): "Turn estimation DataFrames to np arrays." self._Y, self._X, self._Z = ( diff --git a/pyfixest/estimation/vcov_utils.py b/pyfixest/estimation/vcov_utils.py index 414f0a28c..c96aab6d2 100644 --- a/pyfixest/estimation/vcov_utils.py +++ b/pyfixest/estimation/vcov_utils.py @@ -60,6 +60,7 @@ def _count_G_for_ssc_correction( return G + def _get_vcov_type( vcov: Union[str, dict[str, str], None], fval: str ) -> Union[str, dict[str, str]]: @@ -96,7 +97,6 @@ def _get_vcov_type( return vcov_type # type: ignore - def _prepare_twoway_clustering(clustervar: list, cluster_df: pd.DataFrame): cluster_one = clustervar[0] cluster_two = clustervar[1] diff --git a/pyfixest/utils/dev_utils.py b/pyfixest/utils/dev_utils.py index f509a3d58..a55d0ecd9 100644 --- a/pyfixest/utils/dev_utils.py +++ b/pyfixest/utils/dev_utils.py @@ -191,3 +191,35 @@ def _extract_variable_level(fe_string: str): level = match.group(2) return f"C({variable})", level + + +def _feols_input_checks(Y: np.ndarray, X: np.ndarray, weights: np.ndarray): + """ + Perform basic checks on the input matrices Y and X for the FEOLS. + + Parameters + ---------- + Y : np.ndarray + FEOLS input matrix Y. + X : np.ndarray + FEOLS input matrix X. + weights : np.ndarray + FEOLS weights. + + Returns + ------- + None + """ + if not isinstance(Y, (np.ndarray)): + raise TypeError("Y must be a numpy array.") + if not isinstance(X, (np.ndarray)): + raise TypeError("X must be a numpy array.") + if not isinstance(weights, (np.ndarray)): + raise TypeError("weights must be a numpy array.") + + if Y.ndim != 2: + raise ValueError("Y must be a 2D array") + if X.ndim != 2: + raise ValueError("X must be a 2D array") + if weights.ndim != 2: + raise ValueError("weights must be a 2D array") diff --git a/tests/.coverage b/tests/.coverage deleted file mode 100644 index 29f0509cb..000000000 Binary files a/tests/.coverage and /dev/null differ