Skip to content

Commit eee583c

Browse files
committed
TYP: Typing improvements
Clarify types in some cases
1 parent 6e58578 commit eee583c

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

linearmodels/iv/results.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def conf_int(self, level: float = 0.95) -> DataFrame:
286286
-----
287287
Uses a t(df_resid) if ``debiased`` is True, else normal.
288288
"""
289-
ci_quantiles = [(1 - level) / 2, 1 - (1 - level) / 2]
289+
ci_quantiles = array([(1 - level) / 2, 1 - (1 - level) / 2])
290290
if self._debiased:
291291
q = stats.t.ppf(ci_quantiles, self.df_resid)
292292
else:
@@ -1348,6 +1348,7 @@ def anderson_rubin(self) -> InvalidTestStatistic | WaldTestStatistic:
13481348
"Test requires more instruments than " "endogenous variables.",
13491349
name=name,
13501350
)
1351+
assert self._liml_kappa is not None
13511352
stat = nobs * log(self._liml_kappa)
13521353
df = ninstr - nendog
13531354
null = "The model is not overidentified."
@@ -1385,6 +1386,7 @@ def basmann_f(self) -> InvalidTestStatistic | WaldTestStatistic:
13851386
)
13861387
df = ninstr - nendog
13871388
df_denom = nobs - (nexog + ninstr)
1389+
assert self._liml_kappa is not None
13881390
stat = (self._liml_kappa - 1) * df_denom / df
13891391
null = "The model is not overidentified."
13901392
return WaldTestStatistic(stat, null, df, df_denom=df_denom, name=name)

linearmodels/panel/model.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,6 +1521,8 @@ def _lsmr_path(
15211521
cond_mean = lsmr(wd, wx[:, i], atol=1e-8, btol=1e-8)[0]
15221522
cond_mean /= cond
15231523
wx_mean_l.append(cond_mean)
1524+
wx_mean: linearmodels.typing.data.Float64Array | csc_matrix
1525+
wy_mean: linearmodels.typing.data.Float64Array | csc_matrix
15241526
wx_mean = np.column_stack(wx_mean_l)
15251527
wy_mean = lsmr(wd, wy, atol=1e-8, btol=1e-8)[0]
15261528
wy_mean /= cond

linearmodels/panel/results.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ def conf_int(self, level: float = 0.95) -> DataFrame:
333333
-----
334334
Uses a t(df_resid) if ``debiased`` is True, else normal.
335335
"""
336-
ci_quantiles = [(1 - level) / 2, 1 - (1 - level) / 2]
336+
ci_quantiles = np.array([(1 - level) / 2, 1 - (1 - level) / 2])
337337
if self._debiased:
338338
q = stats.t.ppf(ci_quantiles, self.df_resid)
339339
else:

0 commit comments

Comments
 (0)