Results

class dpd_stream.DPDResult[source]

A fitted difference or system GMM model.

Attributes:
  • fml, depvar, coefnames, beta, vcov, vcov_type, df_t, n_obs, all_vcovs, n_clusters, collin_vars, diagnostics, weights, weights_type – As in hdfe_stream.HDFEResult. n_obs counts the observations of the levels equation in system GMM, of the transformed equation in difference GMM (as xtabond2). vcov_type is "iid" or "robust" ("CRV1:<vars>" when clustered); for a two-step fit, robust means Windmeijer-corrected, and "iid" the uncorrected two-step variance.

  • estimator (str) – "difference" or "system".

  • steps (int or str) – 1, 2 or "iterated".

  • transform (str) – "fd" or "fod".

  • n_groups (int) – Panels with observations.

  • obs_per_group (dict) – min, avg and max.

  • n_instruments (int) – Instruments, less any the generalized inverse drops (xtabond2’s count).

  • ar (list of dict) – Arellano-Bond tests for AR(1), AR(2), … in the first-differenced residuals: order, z, p.

  • sargan (dict) – Sargan test of the overidentifying restrictions (statistic, df, p): not robust, from the one-step residuals.

  • hansen (dict or None) – Hansen’s J test (robust); None for a one-step non-robust fit.

  • diff_hansen (list of dict) – Difference-in-Hansen (or -Sargan) tests of each instrument group’s exogeneity: group, the test of the model without it (excluded, excluded_df, excluded_p) and of the difference (difference, difference_df, difference_p).

  • model_test (dict or None) – Wald test that all coefficients are zero: chi2, or F with small.

  • sigma2 (float) – xtabond2’s sigma^2 (e(sig2)).

  • mmsc (dict or None) – Andrews and Lu’s (2001) model and moment selection criteria (bic, aic, hqic; lower is better), from Hansen’s J.

  • onestep (DPDResult or None) – For two-step and iterated fits, the one-step estimates (free).

  • idtests (dict or None) – Identification tests (Windmeijer 2025; Stata’s underid kp sw), robust to the fit’s clustering, with the regressors that are their own IV-style instruments (and any absorbed effect) partialled out: kp_lm, Kleibergen and Paap’s rk LM test of underidentification (rank of the first stage K - 1; rejecting means identified); kp_wald, its Wald form, with F the weak-identification statistic with ivreg2’s small-sample factor (no Stock-Yogo critical values apply with robust variances and many instruments); sanderson_windmeijer, the conditional underidentification test of each endogenous regressor; partial_r2, each one’s first-stage partial R^2 and Shea’s partial R^2; effective_f, Montiel Olea and Pflueger’s effective F with its 2SLS critical value (one endogenous regressor; else None); anderson_rubin, the weak-instrument-robust test that the endogenous regressors’ coefficients are 0 (from the moment conditions, with the reduced form of y), and with one of them its 95% confidence set (confidence_set["intervals"]). No endogeneity test: the lagged dependent variable is endogenous in the transformed equation by construction, and the other regressors’ exogeneity is what the difference-in-Hansen test of their IV-style group checks. None with no endogenous regressor, or when skipped (see idtests=). The algebra is hdfe_stream.core.ivtests.

  • nl (dict or None) – With Ahn-Schmidt moments: their kind ("noserial" or "iid"), number (moments), the first step’s weight on them, and whether the nonlinear step converged.

  • absorbed (dict or None) – The absorbed fixed effect: its term, the number of effects estimated (cells with observations), and the method: "dummies" for time effects (| year), estimated as dummies and not reported, so every statistic is exact; "cells" for a period effect by group (| g^year, difference GMM), partialled out of the moments (see the user guide).

  • pca (dict or None) – With pca=True: the number of components, the eigenvalues, kmo and r2 (the share of the variance kept).

summary(logger=None, level=20)[source]

Print the report, or write it to logger (one record, at level).

tidy()[source]

Coefficient table. p-values use the t distribution with df_t degrees of freedom, or the normal for GLMs, as in pyfixest.

coef()[source]

The coefficients, as {name: estimate}.

confint(alpha=0.05, keep=None, drop=None, exact_match=False, joint=False, reps=10000, seed=None)[source]

Confidence intervals, one coefficient at a time or simultaneous.

Pointwise intervals use the t distribution with df_t degrees of freedom, or the normal for GLMs, as tidy does. With joint=True, the intervals cover all the selected coefficients at once with probability 1 - alpha: the critical value is the 1 - alpha quantile of the largest absolute t statistic, simulated from the normal with the coefficients’ correlation (the multiplier bootstrap of pyfixest’s confint(joint=True); Chernozhukov et al., Applied Causal Inference Powered by ML and AI, remark 4.4.1).

Parameters:
  • alpha (float, default 0.05) – One minus the coverage.

  • keep (str or list of str, optional) – Regular expressions selecting coefficients by name, as in pyfixest: those matching a keep pattern, in the order of the patterns (all, by default), less those matching a drop pattern. A joint interval covers exactly these.

  • drop (str or list of str, optional) – Regular expressions selecting coefficients by name, as in pyfixest: those matching a keep pattern, in the order of the patterns (all, by default), less those matching a drop pattern. A joint interval covers exactly these.

  • exact_match (bool, default False) – Match names exactly instead of as regular expressions.

  • joint (bool, default False) – Simultaneous intervals.

  • reps (int, default 10000) – Draws for the joint critical value.

  • seed (int, optional) – Seed for those draws.

Returns:

polars.DataFrame – Coefficient and the lower and upper bounds, in columns named by their percentiles ("2.5%", "97.5%").

wald_test(R=None, q=None, distribution=None, keep=None, drop=None, exact_match=False)[source]

Wald test of the linear hypothesis R beta = q, under the current vcov (see with_vcov).

By default the hypothesis is that every coefficient is zero; keep and drop narrow it to some of them (the coefficients of an event study’s leads, say), and R and q state any other.

The statistic is W = (R b - q)’ (R V R’)^+ (R b - q), and F = W / m for m restrictions. F is referred to the F distribution with m and df_t degrees of freedom, so that for one coefficient the p-value is the one tidy reports; W, to the chi-squared with m. Two differences from pyfixest’s wald_test: it reports chi-squared whenever R is not the identity or q is not zero, where this test reports what is asked for; and its F’s denominator degrees of freedom, without clustering, subtract every fixed-effect level, including the redundant ones that df_t does not.

Parameters:
  • R (array-like, optional) – m x k, one row per restriction, one column per coefficient in the order of coefnames; a 1-d array is one restriction.

  • q (float or array-like, optional) – The m right-hand sides; zero by default.

  • distribution ({"F", "chi2"}, optional) – Default “F” for OLS and “chi2” for GLMs, whose tidy p-values are normal.

  • keep – Without R: test that the coefficients they select are zero (or q), as in confint.

  • drop – Without R: test that the coefficients they select are zero (or q), as in confint.

  • exact_match – Without R: test that the coefficients they select are zero (or q), as in confint.

Returns:

dict – statistic (F or W), pvalue, df1 (m), df2 (df_t for F, None for chi-squared) and distribution.

with_vcov(vcov)[source]

A copy with the other variance computed at fit time: "iid" (for two-step: uncorrected) or "robust" (the fit’s clustering, Windmeijer-corrected for two-step).

ar_test(order=2)[source]

The Arellano-Bond test for AR(order) in first differences.

long_run(var, ldv=None)[source]

The long-run effect of var: the sum of its coefficients (the variable and its lags) over one minus the sum of the lagged dependent variable’s, with a delta-method standard error.

Parameters:
  • var (str) – A regressor’s base name: "x" collects x, l(x, 1), l(x, 2), …

  • ldv (str, optional) – The dependent variable’s name in its lags (default the outcome), collecting l(<ldv>, k).

predict(newdata=None)[source]

The linear prediction x_it’b in levels (without the panel effect), as a lazy frame of the panel, time and fitted, over the fit’s data or newdata (which must have the columns the formula uses). Lags are taken by time value, as in the fit.

resid(transform='levels', newdata=None)[source]

Residuals as a lazy frame of the panel, time and resid: "levels", y - x’b (which includes the panel effect), or "fd", their first differences (the transformed equation’s residuals in difference GMM).

sample()[source]

The estimation sample, as a lazy frame of the panel, time and whether the observation enters the transformed equation (its first difference, or its forward orthogonal deviation) and, in system GMM, the levels equation; one row per observation of the fit’s data that enters either. Computed from the data as the fit selects its rows: the outcome, the regressors (with the lags they take by time) and the weight present, and the IV-style instruments (unless mz) in the equation they instrument.

instruments()[source]

The instrument columns (a list of names), as xtabond2 lists them.

summary_text()[source]

The summary() report as a string.

summary_dict(coefficients=False)[source]

The model-level information of summary() as a dict of plain Python types (JSON-ready; nan is None). Fit statistics not defined for the model (e.g. r2 for a GLM) are absent. coefficients=True adds the tidy() table as a list of row dicts.

summary_json(path=None, indent=2, coefficients=False)[source]

The model-level information of summary() as a JSON string (see summary_dict); with path, also written there as UTF-8. Reload with json.loads or json.load.

to_pyfixest()[source]

A pyfixest Feols (Feiv for IV) view of this result, for pf.etable, pf.summary, pf.coefplot and pf.iplot. Only the stored results are available; methods that need the data (recomputing the vcov, the wild bootstrap) are not, and predict is this result’s own predict.

__init__(*, fml, depvar, coefnames, beta, vcov, vcov_type, df_t, n_obs, all_vcovs=<factory>, n_clusters=<factory>, collin_vars=<factory>, diagnostics=<factory>, weights=None, weights_type='aweights', estimator='difference', steps=2, transform='fd', n_groups=0, obs_per_group=<factory>, n_instruments=0, ar=<factory>, sargan=<factory>, hansen=None, diff_hansen=<factory>, model_test=None, sigma2=nan, mmsc=None, onestep=None, pca=None, small=False, instrument_list=<factory>, time_effects=None, absorbed=None, idtests=None, nl=None, _model=<factory>)
classmethod __new__(*args, **kwargs)
class dpd_stream.DPDMulti[source]

Several DPDResult`s, e.g. from a loop over specifications; the reporting methods of `hdfe_stream.HDFEMulti.

__init__(results)[source]
classmethod __new__(*args, **kwargs)