API
Estimation
PanelLocalProjections.panellp — Function
panellp(f, data; id, time, horizon, estimator = WithinFE(), shock = nothing,
frequency = nothing, subset = nothing, sample = :horizon, singletons = :drop,
absorb = AlternatingProjections(), clusters = (), weights = nothing,
pooled = false)Estimate a panel local projection: for each horizon h, regress the response defined by the left-hand side of f on its right-hand side, absorbing the fe() terms.
Formula
- Left-hand side:
leads(y)(y{i,t+h}),ldiff(y)(y{i,t+h} − y{i,t−1}),anchor(y, z)(y{i,t+h} − z{i,t}),cumul(y)(Σ{k≤h} y_{i,t+k}), or a plain column (a pre-built outcome) withhorizon = 0. - Right-hand side: columns and functions of columns, interactions
s & X,lags(x, p),lags(x, a:b),leads(x, a:b),firstdiff(x), and fixed effectsfe(v),fe(a) & fe(b). An intercept is included when there are no fixed effects (unless0 +).leads(x)without a range adds the pathx_{i,t+1}, …, x_{i,t+h}at horizonh(nothing ath ≤ 0): the response tox_{i,t}holding its later values fixed. - Panel LP-IV: one block
(endo ~ inst), e.g.(s & ffr ~ s & mp), makes the fit two-stage least squares (Almuzara & Sancibrián 2026, §3.4) on each horizon's fixed-effects design: the endogenous regressors on the left (listed first among the coefficients, and the defaultshock), the excluded instruments on the right; the other regressors are exogenous and instrument themselves. Every variance applies to the IV scores X̂ ξ̂ (ξ̂ the structural residual);TLAHR(refine = false)is the paper's LP-IV variance. An instrument absorbed by the fixed effects or collinear with the exogenous regressors (or with earlier instruments) is left out of the first stage, with a note; a horizon with fewer instruments than endogenous regressors left is:underidentified. WithWithinFEorLagAugmented(whose lags of an endogenous shock are instrumented by lags of the instruments).
Keywords
id,time: the unit and period columns. Integer periods are consecutive integers;Date/DateTimeperiods needfrequency(:year,:halfyear,:quarter,:month).fe(time)and clusters ontimegroup by period, not by date.horizon:H(horizons0:H) or a range of consecutive horizons such as1:6. Negative horizons put the response before the regressors (pre-trends): withhorizon = -6:12,ldiff(y)isy_{i,t−|h|} − y_{i,t−1}ath < 0, identically zero ath = −1(coefficient and standard error 0). Not withcumulorLagAugmented.estimator:WithinFE(fixed effects; pooled OLS without them),SplitPanelJackknife,CDOLS,LagAugmentedorLPDiD(difference-in-differences with clean controls).shock: coefficient name(s) of the shock; by default the columns of the first regressor (the endogenous ones with an IV block). Required when the formula has interaction terms and other regressors.subset: a Bool column or vector restricting the estimation sample after leads and lags are computed (they may read outside it).sample::horizon(each horizon its own complete cases) or:common(the intersection over horizons).singletons::drop(iteratively, asreghdfeandxtlp) or:keep.absorb:AlternatingProjectionsorOneSweep.clusters: extra columns (or tuples of columns, for intersections) whose score sums are stored for clustered variances, e.g.clusters = (:region, (:sector, :quarter)); unit, time and the fixed-effect dimensions always are.weights: a column of observation weights (weighted least squares, as Stata's[pweight]/[aweight]: weighted fixed-effect means, scoresw x̃ ê, and the number of rows in every degrees-of-freedom factor). Rows with a missing or zero weight leave the sample. WithWithinFE,CDOLSandLPDiD.pooled = true: one regression of the response averaged over the horizons (every one required), instead of one per horizon: the average response over the window, on the rows where the whole window is observed (the pooled LP-DiD estimate of Dube, Girardi, Jordà & Taylor 2025, Section 3.5, withLPDiD). The horizons must be all ≥ 0 or all < 0; the result has one fit, at the far end of the window, andr.pooledholds the window. WithWithinFEandLPDiD.
Leads, lags and differences are taken on the (unit, calendar period) grid: an absent period makes them undefined, and rows where the response or any regressor is undefined (missing, NaN, or a missing input of a function term) leave that horizon's sample.
Horizons without observations, horizons where the shock is absorbed by the fixed effects or collinear in the horizon's sample (status :singular), omitted regressors and non-convergence are reported in one warning each per call, and their coefficients are NaN; it is an error when no horizon identifies the shock.
PanelLocalProjections.PanelLocalProjection — Type
PanelLocalProjectionResult of panellp: one fit per horizon. Variances are computed afterwards with vcov(spec, r); see Robust, Clustered, DriscollKraaySE.
PanelLocalProjections.WithinFE — Type
WithinFE()Fixed-effects (within/LSDV) estimator: OLS after absorbing the fe() terms of the formula; pooled OLS with an intercept when there are none.
PanelLocalProjections.SplitPanelJackknife — Type
SplitPanelJackknife(; split = :ceil)Split-panel jackknife correction of the fixed-effects estimator (Mei, Sheng & Shi 2026, eq. 16): θ̂ = 2θ̂full − ½(θ̂a + θ̂_b). The halves are formed per unit on each horizon's estimation sample, from its rows in time order:
split = :ceilputs the first ⌈n_i/2⌉ rows in half a, as the authors' R code andxtlpdo;split = :floorputs the first ⌊ni/2⌋ there, the paper's 𝒯a = {t ≤ T_h/2}.
Every fixed effect, time effects included, is re-estimated inside each half. The variance uses the full-sample bread, the SPJ residuals and the scores d = 2X̃ − X̃half, which reduce to the paper's d* on balanced panels with an even number of periods. Requires a unit fixed effect, fe(id). A horizon where a half is rank-deficient (a regressor absorbed inside it) is `:spjhalf_singular`, with NaN coefficients.
PanelLocalProjections.CDOLS — Type
CDOLS(; validate = true)Cumulative-difference OLS (Ugarte-Ruiz 2026): pooled OLS, with an intercept (unless 0 +) and without unit effects, of the long difference y{i,t+h} − y{i,t−1} on the shock and its first lag. The long difference removes the unit effect, so there is no within transformation and no Nickell bias.
With validate = true the formula must follow the method:
- the response is
ldiff(y), orcumul(g)of a growth rateg; - each shock is dated t, right after the base period t − 1 of the long difference (t − ℓ with a lagged response,
ldiff(lags(y, ℓ))), and its first lag is a regressor, however it is written (lags(s, 1),lags(s, 0:1), …); - the outcome enters the right-hand side only lagged beyond the response's start and, when the response differences it (
ldiff(y),cumul(firstdiff(y))), only in differences,lags(firstdiff(y), 1:p): a level of y carries the unit effect; - no fixed effect is nested in the units, in the data or in any horizon's sample (time effects are allowed); fixed-effect groups with a single unit give a warning.
The paper also gives every control the lags of the shock (it is not checked). validate = false skips the checks, e.g. for a pre-built long-difference column.
PanelLocalProjections.LagAugmented — Type
LagAugmented(rule = ICLags())Lag-augmented fixed-effects estimator of Almuzara & Sancibrián (2026): at horizon h, the regression adds p(h) lags of the outcome and of every shock column to the formula (rule sets p(h)), so that the scores are serially uncorrelated and inference clustered by period is valid (TLAHR). The lagged outcome is y for leads(y) and anchor(y, z), Δy for ldiff(y) and leads(firstdiff(y)), and g for cumul(g). Lags of a shock lag the whole column (s{i,t−ℓ}X{t−ℓ} for an exposure that varies over time). A lag already among the regressors, whatever its name (columns are compared numerically: s & L1.X is the lag of the shock s & L0.X), is not added again; one that the formula's columns span (Δy lags with lags(y, 1:2) in the formula) is left out of the regression. Requires unit fixed effects, fe(id), or finer ones nested in the units (e.g. fe(id) & fe(state)).
With an IV block (panel LP-IV, Almuzara & Sancibrián 2026, §3.4), the lags of an endogenous shock are endogenous, instrumented by the same lags of every excluded instrument; the lags of the outcome are exogenous. ICLags then works on the reduced form, the instruments in place of the endogenous regressors.
PanelLocalProjections.ICLags — Type
ICLags(; criterion = :aic, pmax = nothing, vars = :outcome, sample = :perp)Almuzara–Sancibrián (2026) rule p(h) = max{1, min(h, p̂)} (eq. 15; supplement B.7), with p̂ chosen by an information criterion on the synthetic time series (fn 11; supplement B.3–B.4). For each p = 0, …, pmax, the outcome is regressed at h = 0 on the formula's right-hand side and p of its own lags, with the formula's fixed effects; the residuals are averaged across units with the first shock's exposure weights, ξ̄_t(p), and
IC(p) = log σ̂²(p) + k(p) · g, σ̂²(p) = Σ_t ω_t ξ̄_t(p)² / Σ_t ω_t,with ωt the synthetic weight of period t (constant on balanced panels with a time-invariant exposure, where σ̂² is the mean of ξ̄t²), k(p) the lags candidate p adds to the regression (none for a lag already among the regressors, or spanned by them), and g = 2/T (:aic) or log(T)/T (:bic), T the periods of the p = 0 sample. Ties go to the smaller p, except between candidates that are the same regression (their lags are already in the formula): p̂ is then the larger, so the formula's lags count towards it.
pmax: largest candidate; default max{1, ⌈(T − H)^{1/3}⌉}, T the distinct periods in the data and H the largest horizon.vars = :outcome_and_shockalso adds p lags of each shock to candidate p (each counted in k(p)).sample = :commonfits every candidate on thepmax-lag sample.
For panel LP-IV the criterion is that of the reduced form: the excluded instruments take the place of the endogenous regressors, as if the formula were the OLS regression of the outcome on them, and the instrument with the exposure of the (first) endogenous shock (s & mp for s & ffr) is its shock, whose exposure weights the residuals. With no such instrument, use ConstantLags or CappedLags.
PanelLocalProjections.CappedLags — Type
CappedLags(pmax = nothing)p(h) = min(h, pmax): no lag at h = 0. The rule of the Almuzara–Sancibrián code (panel_LP.m/panel_LP.R), whose default pmax is ⌈(T − H)^{1/3}⌉ (T the distinct periods in the data, H the largest horizon). A compatibility switch: the paper recommends ICLags.
PanelLocalProjections.ConstantLags — Type
ConstantLags(p)The same number of lags p at every horizon ("plain" t-LAHR, p = 1, in Almuzara & Sancibrián's Table 1).
PanelLocalProjections.LagSelection — Type
LagSelectionThe lag rule of a LagAugmented fit: the rule, its largest lag, the selected order, and for ICLags the criterion, residual variance and number of synthetic periods for each candidate p = 0, …, pmax.
PanelLocalProjections.lagorder — Function
lagorder(r) -> Vector{Int}The number of lags of the outcome and of each shock added at each horizon by LagAugmented (zeros for the other estimators). The rule and, for ICLags, the criterion of each candidate are in r.lags, a LagSelection.
PanelLocalProjections.LPDiD — Type
LPDiD(; control = :clean, nonabsorbing = nothing, firsttreat = false, oneoff = false,
untreated_before = false, reweight = false, pmd = nothing)LP-DiD, the local-projections difference-in-differences estimator of Dube, Girardi, Jordà & Taylor (2025): at each horizon h the long difference y{i,t+h} − y{i,t−1} is regressed on the treatment switch ΔDit and time effects, on the rows that enter treatment at t (ΔDit = 1) and the clean controls of horizon h. The formula is the regression,
ldiff(y) ~ firstdiff(D) + fe(time) (+ covariates, lags(y, …), further fe())with D the 0/1 treatment column; negative horizons give the pre-treatment coefficients (horizon = -5:8; h = −1 is zero by construction). The default is a variance-weighted average effect on the treated of the cohorts, with positive weights. sample = :common in panellp keeps the same rows at every horizon (no composition change; lpdid's nocomp), pooled = true gives the pooled estimate over the horizons, and weights the observation weights. Standard errors: Clustered(:unit) (the paper and lpdid).
Clean controls:
- absorbing treatment (the default): rows with D{i,t+h} = 0 (Dit = 0 at h < 0), the not-yet-treated and the never-treated. A treatment that switches off is an error.
nonabsorbing = L: treatment can switch on and off, and its effects are assumed to stabilise within L periods (DGJT Section 4.2.3). Rows with ΔDit ∈ {0, 1}, no switch in the L periods before t and none in t + 1, …, t + h (at h < 0: the same from t − |h| + 1 to t).oneoff = trueis a treatment that lasts one period by construction (Dit = 1 is an event): events in place of switches.control = :nevertreatedkeeps as controls only units never treated in the data;control = :notyet(non-absorbing) only units untreated from their first row through t + h.firsttreat = true(non-absorbing) keeps a unit's rows up to its first treatment spell (at most one switch, or one event, through t + h). Withcontrol = :notyetor:nevertreatedit is the estimator of the effect of entering treatment for the first time (DGJT Section 4.2.2), which needs no stabilisation window:nonabsorbing = true.untreated_before = true(non-absorbing) takes a unit as untreated before its first row; by default a row whose window reaches before it is left out.
Estimands and outcomes:
reweight = true: the equally weighted average effect on the treated (Section 3.3). With no covariates and no fixed effects besides time it is a weighted regression (each period's rows weighted by 1/(1 − pt), pt its share of treated rows); otherwise it is regression adjustment (Section 4.1.1): the outcome model is fitted on the clean controls, and the estimate is the mean over the treated rows of the outcome less its prediction. A regression-adjustment fit reports the treatment coefficient only, and its scores are its influence function: useClustered(:unit; ssc = :none).reweight = :lpdidcounts the controls of the weighted regression aslpdid1.1.0 does (also clean rows whose ΔD is undefined, which are not in the regression).pmd = kor:max: the pre-mean-differenced version (Section 3.4), with the mean of y over t − k, …, t − 1 (all required), or over every earlier row of the unit, as the base period instead of y_{i,t−1}. With a non-absorbing treatment the base window must also be free of switches (events).
See averageeffect and pretrendtest.
PanelLocalProjections.averageeffect — Function
averageeffect(r; cluster = :unit, level = 0.95)The average of the LP-DiD event-study coefficients over the post-treatment horizons (h ≥ 0) and over the pre-treatment ones (h ≤ −2), each horizon weighted by its number of treated rows N₁ₕ: θ̂ = Σₕ N₁ₕ β̂ₕ / Σₕ N₁ₕ, the average effect over all treated observations of the window (the equally weighted ATT with reweight, its variance-weighted counterpart without). As lpdid's aggregate_average: the standard error is that of the influence function of θ̂, which includes the estimated weights,
A_i = [Σₕ N₁ₕ ψ_ih + Σₕ (β̂ₕ − θ̂) 1{i is a treated row of horizon h}] / Σₕ N₁ₕ,summed by cluster, with no small-sample factor and t(M − 1) critical values, M the clusters in the samples of the window. A window with a horizon that was not estimated is NaN. Returns a column table with rows :post and :pre.
PanelLocalProjections.pretrendtest — Function
pretrendtest(r; cluster = :unit, horizons = h ≤ −2, term = first shock)Joint test that the coefficients of term are zero at the pre-treatment horizons: the Wald statistic b'V⁻¹b/P, with V the covariance of the P coefficients across horizons clustered by cluster (from the stored score sums; no small-sample factor), referred to F(P, M − 1), M the clusters in the samples of the tested horizons. As lpdid's pretrend_test. Horizons that were not estimated, and those whose coefficient is zero by construction (h = −1 with ldiff; a difference spanned by the lagged outcomes), are left out. Returns (F, p, df, df_r, horizons); F is NaN when V is singular or M ≤ P.
PanelLocalProjections.AlternatingProjections — Type
AlternatingProjections(; tol = 1e-12, maxiter = 10_000, accelerate = true)Within transformation by alternating projections (Gauss–Seidel sweeps over the fixed-effect dimensions), with an Irons–Tuck extrapolation after every two sweeps when accelerate. A single dimension is demeaned exactly in one pass. Iteration stops when a sweep moves no element by more than tol · max|v₁|, where v₁ is the column after its first sweep (which has removed its level): the rule does not depend on the units or the level of the data. On slowly mixing panels the remaining error can exceed the last step by a factor 1/(1 − ρ), with ρ the convergence rate of the sweeps.
PanelLocalProjections.OneSweep — Type
OneSweep()One demeaning pass per fixed-effect dimension, in formula order. With fe(id) + fe(t) this is the unit-then-time sweep of the Mei–Sheng–Shi replication code (LP_panel_all.r), which is the exact two-way within transformation only on balanced samples. A compatibility switch for reproducing published numbers; prefer AlternatingProjections.
Formula helpers
PanelLocalProjections.leads — Function
leads(y)
leads(x, a:b)On the left-hand side, the response y_{i,t+h} at horizon h.
On the right-hand side, leads of a regressor. leads(x, a:b) (or leads(x, p) for 1:p) adds x_{i,t+a}, …, x_{i,t+b} at every horizon, named F1.x, F2.x, …. leads(x) without a range is the path of x between the shock and the response: x_{i,t+1}, …, x_{i,t+h} at horizon h and nothing at h ≤ 0, so that the coefficient of x_{i,t} is the response to x at t holding its later values fixed (as Ilzetzki 2024 and the future-treatment controls of Dube, Girardi, Jordà & Taylor 2025, Section 4.3). A path term is an exogenous regressor of its own: it cannot be nested in another term nor in an IV block.
PanelLocalProjections.ldiff — Function
ldiff(y)Long-difference response y_{i,t+h} − y_{i,t−1} at horizon h (Stata xtlp ytransf(cmltdiff), locproj tr(cmlt)).
PanelLocalProjections.anchor — Function
anchor(y, z)Anchored response y_{i,t+h} − z_{i,t}; anchor(y, y) is the h-difference y_{i,t+h} − y_{i,t}.
PanelLocalProjections.cumul — Function
cumul(y)Cumulated response Σ_{k=0}^{h} y_{i,t+k} (Stata xtlp ytransf(cmltsum)); with a growth rate g, cumul(g) is the long difference of the level.
PanelLocalProjections.lags — Function
lags(x, p)
lags(x, a:b)Lagged regressors x_{i,t−1}, …, x_{i,t−p} (or x_{i,t−a}, …, x_{i,t−b}, with a ≥ 0). x may be an interaction (lags(s & X, 1)) or a first difference (lags(firstdiff(y), 1:4)). Columns are named L1.x, L2.x, ….
PanelLocalProjections.firstdiff — Function
firstdiff(x)First difference x_{i,t} − x_{i,t−1} (named D.x).
PanelLocalProjections.fe — Function
fe(v)Absorbed fixed effect for the groups of column v; fe(a) & fe(b) absorbs the interaction (e.g. sector × quarter).
Inference
PanelLocalProjections.Robust — Type
Robust(; ssc = :stata)Heteroskedasticity-robust (Eicker–Huber–White) variance. ssc = :none is HC0; :stata is HC1 with the factor n/(n − K − df_a) of regress, vce(robust), reghdfe and xtlp vce(robust), and t(n − K − df_a) critical values.
PanelLocalProjections.Homoskedastic — Type
Homoskedastic(; ssc = :stata)Classical variance under homoskedastic, uncorrelated errors: σ̂²(X̃'X̃)⁻¹, with (X̂'X̂)⁻¹ and the structural residuals for panel LP-IV. ssc = :stata is σ̂² = RSS/(n − K − dfa) with t(n − K − dfa) critical values (regress, reghdfe, ivreg2 …, small); :none is σ̂² = RSS/n with normal critical values (ivreg2 without options). Not defined for the split-panel jackknife nor for regression-adjustment LP-DiD fits.
PanelLocalProjections.Clustered — Type
Clustered(dims...; ssc = :stata, psd = length(dims) == 2)Cluster-robust variance, one- or two-way (Cameron–Gelbach–Miller). Each dimension is :unit, :time, a fixed-effect or declared cluster column, or a tuple of columns for their intersection (e.g. (:sic3, :quarter)).
ssc sets the small-sample correction:
:none: no factor; normal critical values.:stata:(n−1)/(n − a − K − df_a_eff) · G/(G−1)withGthe smallest number of clusters, absorbed effects nested in a cluster dimension not counted (a = 1if any is); t(G − 1) critical values. Asxtlp,reghdfe,xtreg, fe vce(cluster).:mss:N/(N−1) · (n−1)/(n−K)forClustered(:unit), orG/(G−1) · (n−1)/(n−N−K)withG = min(N, T)forClustered(:unit, :time), with N and T the numbers of units and periods in the data, as in the Mei–Sheng–Shi replication code withrobust = T; normal critical values. Only these two specifications exist in that code.
psd repairs a two-way variance that is not positive semi-definite by clipping its negative eigenvalues to zero:
:stata(ortrue, the default for two dimensions) clips in the metric scaled by the standard deviations of the raw regressors (floored at 1e-3), asreghdfeandxtlpdo. With an intercept, the slopes are clipped on their own and the intercept enters the metric with scale 1, as inreghdfe.:rawclips V itself, as the Mei–Sheng–Shi code witheigens = Tandfixest's defaultvcov_fix = TRUE(which floors the eigenvalues at 1e-16 instead of 0).:none(orfalse) leaves V unchanged; a negative variance then has a NaN standard error.
PanelLocalProjections.DriscollKraaySE — Type
DriscollKraaySE(bw = :nw94; ssc = :stata, timelags = :calendar)Driscoll–Kraay variance: Bartlett-weighted long-run variance of the cross-sectional sums of the scores, ordered by calendar period.
bw sets the number of lags m (weights 1 − j/(m+1)):
:nw94:⌊4(T/100)^{2/9}⌋(xtscc,xtlp).:as2026:⌈4(T/100)^{2/9}⌉ − 1, Almuzara–Sancibrián's kernel bandwidth M = ⌈⋯⌉ with weights1 − j/M.:mss2026:⌊T^{1/4}⌋(Mei–Sheng–Shi, appendix B.2.2).- an integer.
ssc:
:none: no factor; normal critical values.:stata:(n−1)/(n − K − df_a^{DK}) · T/(T−1), asxtlp's default; t(T − 1).:xtscc:(n−1)/(n − K − 1{FE}) · T/(T−1), asxtsccandxtlp …, nodfadj; t(T − 1).
timelags = :position lags over the periods present in the sample (as xtlp/xtscc) instead of calendar periods.
PanelLocalProjections.TLAHR — Type
TLAHR(; refine = true, weights = :residual)t-LAHR inference of Almuzara & Sancibrián (2026): the variance clustered by period, with no small-sample factor, of a lag-augmented regression (LagAugmented), whose scores are serially uncorrelated.
refine = false: CR0 by period (eq. 11), normal critical values. Equal toClustered(:time; ssc = :none); withWithinFEand no lags, the paper's "t-HR".refine = true(the paper's recommendation, supplement B.2): HC2 with the leverage of the synthetic time-series regression, and Student-t critical values with the Bell–McCaffrey/Imbens–Kolesár degrees of freedom ν of each coefficient. Needs every shock to be an aggregate series times a unit-level exposure (s & X, orXalone).
weights sets the synthetic regressions. :residual (the paper's) averages with the exposure residualised per period, on an intercept when a time-type fixed effect is absorbed (the paper's ŝi) and on the exposures of the other regressors of the same aggregate series, and weights each period by ωt = Σi wi² (fn 24: with every regressor an aggregate series times the exposure, the HC2 variance is then CR2 clustered by period). :raw averages with the raw exposure and leaves the periods unweighted, as the authors' code (panel_LP.m/.R). They agree on balanced panels with time effects and a time-invariant exposure. A shock and its lags use the shock's synthetic regression, another aggregate series times an exposure its own, every other coefficient the first shock's.
PanelLocalProjections.CosineHAR — Type
CosineHAR(B = :llsw)Equal-weighted cosine (EWC) variance of the scores summed by period (Lazarus, Lewis, Stock & Watson 2018): Ω = B⁻¹ Σ{j=1}^{B} Λj Λj', Λj = √2 Σt cos(πj(t − ½)/T) St, over the calendar periods from the first to the last of the sample (absent ones contribute zero); Student-t(B) critical values; no small-sample factor. B = :llsw is ⌊0.41 T^{2/3}⌋, as Stata's harreg; an integer fixes it. A comparator of TLAHR (the paper's "t-HAR").
StatsAPI.vcov — Method
vcov(spec::PanelVcov, r::PanelLocalProjection) -> PanelLPVcovVariance of the coefficients at every horizon, for a Robust, Clustered, DriscollKraaySE, TLAHR or CosineHAR specification. Omitted coefficients have NaN rows and columns. Horizons where the variance is undefined (a single cluster or period, no residual degrees of freedom, or a period with leverage one in the t-LAHR synthetic regression) are NaN, with a warning; so are, in the standard errors, negative variances of a two-way variance without PSD repair.
PanelLocalProjections.PanelLPVcov — Type
PanelLPVcovVariances of a PanelLocalProjection for one specification: a matrix per horizon (NaN for omitted coefficients, and where the variance is undefined), the degrees of freedom of the critical values per coefficient (Inf = normal), and per-horizon details.
StatsAPI.stderror — Method
stderror(cv::PanelLPVcov; term) -> Vector{Float64}Standard errors of term across horizons (NaN where the variance is negative or undefined).
PanelLocalProjections.firststage — Function
firststage(r; vcov = TLAHR(refine = false)) -> FirstStageSummaryFirst-stage diagnostics of a panel LP-IV result, per horizon, with the variance specification vcov (any of Robust, Clustered, DriscollKraaySE, CosineHAR, TLAHR(refine = false)) applied to the first-stage scores, with its small-sample factor computed from the first stage's degrees of freedom (its regressors: the exogenous ones and the excluded instruments), as ivreg2, ivreghdfe and weakivtest do:
kpF: the Kleibergen–Paap (2006) rk Wald F for weak identification, rk/L, with rk the Wald statistic of the test that Π (instruments × endogenous, net of the fixed effects and the exogenous regressors) has rank m − 1, from the singular value decomposition of Θ̂ = G Π̂ F′, G'G = Z̃'Z̃/n, F'F = (X̃'X̃/n)⁻¹ (their eqs. 11–14). With one endogenous regressor it is the Wald F of Π = 0. ivreg2'swidstat.effF(one endogenous regressor): the Montiel Olea & Pflueger (2013) effective F, π̂'Z̃'Z̃π̂ / tr(V̂(π̂) Z̃'Z̃); equal tokpFwith one instrument.coef,se: the first-stage coefficients of the instruments and their standard errors (instruments × endogenous) per horizon.
Two-way clustered variances are not repaired (psd is ignored, as in ivreg2): where the variance that a statistic needs is not positive definite, the statistic is NaN, with a warning.
PanelLocalProjections.FirstStageSummary — Type
FirstStageSummaryFirst-stage diagnostics of a panel LP-IV result (firststage), per horizon: the Kleibergen–Paap rk Wald F, the Montiel Olea–Pflueger effective F (one endogenous regressor), the Cragg–Donald Wald F (homoskedastic errors), the first-stage coefficients of the instruments and their standard errors. A Tables.jl table of the per-horizon statistics.
Results
PanelLocalProjections.summarize — Function
summarize(r, spec_or_vcov; term = first shock, level = 0.95, scale = 1, dist = :auto)Impulse response of term: coefficient, standard error and level confidence bounds at every horizon. spec_or_vcov is a variance specification (e.g. Clustered(:unit)) or the result of vcov. Critical values come from the specification (t with its degrees of freedom, or normal); dist = :normal forces normal ones (e.g. the 1.96 bands of xtlp). scale multiplies coefficients and standard errors.
PanelLocalProjections.IRFSummary — Type
IRFSummaryImpulse response of one coefficient across horizons, with standard errors and confidence bounds; a Tables.jl table (DataFrame(s) works).
PanelLocalProjections.coefpath — Function
coefpath(r; term = first shock) -> Vector{Float64}The coefficient of term across horizons (NaN where it was not estimated).
PanelLocalProjections.nobspath — Function
Number of observations at each horizon.
PanelLocalProjections.horizons — Function
Estimated horizons.
PanelLocalProjections.esample — Function
Estimation sample of horizon h, as a mask over the data rows.
PanelLocalProjections.synthetic — Function
synthetic(r, h; term = first shock, weights = :residual) -> NamedTupleThe synthetic time series of coefficient term at horizon h (Almuzara & Sancibrián 2026, Remark 1): per period of the sample, the weighted cross-sectional averages Σi wi zit / Σi wi² of the within-transformed regressor term (x), response (y) and residuals (resid), and the weight ωt = Σi wi² (weight; 0 for a period without weight, where y and resid are NaN and x is 0). The weights are those of the synthetic regression that the TLAHR refinement of term uses: the exposure of term for a shock (or another aggregate series times an exposure), of its shock for a lag of a shock, of the first shock otherwise, residualised per period (weights = :raw: the raw exposure, for x only). period holds the period labels (integers, or Dates with a frequency). A Tables.jl column table.
PanelLocalProjections.irfplot — Function
irfplot(s::IRFSummary; kw...)
irfplot!(ax, s::IRFSummary; kw...)Impulse response with its confidence band, drawn with Makie. Load Makie (e.g. using CairoMakie) to enable these methods. With Plots.jl, plot(s) works directly.
PanelLocalProjections.irfplot! — Function
irfplot(s::IRFSummary; kw...)
irfplot!(ax, s::IRFSummary; kw...)Impulse response with its confidence band, drawn with Makie. Load Makie (e.g. using CairoMakie) to enable these methods. With Plots.jl, plot(s) works directly.