Panel Fixed Effects Filtered and Variance Decomposition Estimation
Overview
Implements fixed effects estimators for time-invariant variables in panel data models. Provides three estimation methods: FEVD (Fixed Effects Vector Decomposition) from Plumper and Troeger (2007) doi:10.1093/pan/mpm002, and FEF (Fixed Effects Filtered) and FEF-IV (instrumental variables variant) from Pesaran and Zhou (2018) doi:10.1080/07474938.2016.1222225. All methods use the Pesaran and Zhou variance estimators, which account for generated regressor uncertainty, and report the full covariance matrix of the time-varying, time-invariant and intercept coefficients.
- Formula handling: the right-hand side is now split at the top-level
|and each part is built withmodel.frame()andmodel.matrix(), so transformations such aslog(x),I(x^2),x:wandlog(y)and factors (with their contrasts) are handled as inlm(). Previouslyall.vars()was used and the raw columns were read, so transformations were silently dropped or split. Intercept columns are removed from both parts. A factoridwith unused levels now works (levels are dropped). Duplicated(id, time)pairs are now an error. - Variance of the time-varying coefficients
beta: the reported block ofvcov()was the homoskedasticsigma2_e (X'MX)^-1, while the variance ofgammaused the panel-robust matrix of Pesaran and Zhou (2018, eq. 18). The robust matrix is now reported forbetaeverywhere. New argumentvcov_beta = c("robust", "classical")inxtfifevd(),fevd(),fef()andfef_iv(); the chosen matrix is also used inside the Pesaran and Zhou variance ofgammaand of the intercept. Both matrices are returned inV_beta_robustandV_beta_classical.
Show all changes in 1.1.0Hide the rest of the changes in 1.1.0
- Full covariance matrix:
vcov()was block diagonal. It now contains the covariance betweengammaandbetafrom Pesaran and Zhou (2018, eq. A.11),Cov(gamma, beta) = -Qzz^-1 Qzxbar Var(beta), and the variance of and covariances with the interceptalpha = ubar - zbar' gamma(eq. 5) by the delta method. The same derivation is applied to FEF-IV with the instrument projections (eq. 48 and 51). The previous intercept standard errors (stage 2 OLS for FEF,s^2 ginv([1, R]'[1, R])[1, 1]for FEF-IV) are no longer used. fevd()now runs the three stages of Plumper and Troeger (2007) literally: within FE regression, unit-level regression of the time-averaged FE residuals on an intercept and z, and pooled OLS of y on an intercept, x, z and the unexplained unit effect h_i. Previously no stage 3 was run andfevd()returned the FEF results. The stage 3 coefficients are returned instage3$coefficients, the coefficient on h_i indelta(equal to 1 by construction, Pesaran and Zhou 2018, Proposition 3, also in unbalanced panels), and the naive stage 3 standard errors instage3$se_naivefor reference only. Inference continues to use the Pesaran and Zhou standard errors; the documentation states that the naive stage 3 standard errors are too small for the time-invariant coefficients (Breusch, Ward, Nguyen and Kompas 2010, Theorem 3; Greene 2011) and why an intercept is included in stage 2. Stage 2 is unit-level and unweighted in unbalanced panels; Plumper and Troeger are silent on unbalanced panels.- Rarely changing variables after
|: the unit (panel) mean is now used in all stages (previously the first-period value was used silently); the warning is kept and documented. bw_ratio(): the print header now says "SD Ratios" (Plumper and Troeger 2007 define the b/w ratio as the between SD over the within SD). The guidance no longer states a single 1.7 threshold: the thresholds of Plumper and Troeger (2007, Fig. 4; N = 30, T = 20) are about 0.2, 1.7, 2.8 and 3.8 for corr(z, u) of 0, 0.3, 0.5 and 0.8, the correlation is not observable or testable, the coefficient is biased whenever it is non-zero, and Plumper and Troeger offer no simple rule of thumb.sigma2_uis now the variance of the unexplained unit effect (stage 2 residual variance minussigma2_e * mean(1 / T_i), truncated at zero). Previously it was the variance of the time-averaged FE residuals, which includesz'gammaandsigma2_e / T. The summary label says so.print(summary())now shows the installed package version (previously a hard-coded "1.0.0") and cites Pesaran and Zhou (2018) (previously 2016).MASSis no longer imported;utilsis.- New tests pin the FEF and FEF-IV coefficients and the full covariance matrix to hand computations of the Pesaran and Zhou formulas, the formula parser to
lm()on the transformed data, the robustbetacovariance toplm::vcovHC(method = "arellano", type = "HC0")(skipped whenplmis not available), anddelta = 1.
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-04
- NOTE12 OK, 1 NOTE2026-08-01
- OK5 OK2026-04-29
Documentation
- Help pages
- 5 (3 internal)includes a package overview page
- Examples that run
- 100%2 run in a plain check
- Exported functions with examples
- 100%
- Documented parameters
- 100%
- Return-value docs
- 100%
- Help pages citing references
- 60%
Downloads
Repository
Stars over time
Releases over time
Commits over time
Commit identities over time
2 development-tooling and community-health practices detected across 2 families in the upstream repository
Checks run against github.com/muhammedalkhalaf/xtfifevd on 2026-10-22.
The repository owner accepts GitHub Sponsors
This repository shows signs of AI coding tools.
- Claude Codefirst seen 2026-09-27Commits: at least 2 crediting it in the message
- Claude Fable 5.12 commits · Sep to Oct 2026
Dependencies
Installing xtfifevd adds no packages beyond those that come with R.
Code & Tests
People & History
Pick two releases to compare their code metrics.
- 1.1.0Latest
- 1.0.22026-04-28
- RR 4.6.0 released · 2026-04-24
Package metadata
- First published
- 2026-04-28
- Total releases
- 2 / 1 yrs
- License
- GPL-3 OSI
- Minimum R
- ≥ 4.1.0
- Download size
- 28 KB
Cite
Cite this package
Run in R for the authors' entry:
citation("xtfifevd")The package provides a citation file, so citation() returns the authors' own entry.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-24, which the citation names so these numbers can be found later. More on citing and the projects behind them.