From 11bec3a43a57d2d407968355cc061a670e9f88c1 Mon Sep 17 00:00:00 2001 From: "Joao.Macosso" Date: Tue, 17 Mar 2026 12:34:23 +0100 Subject: [PATCH 01/10] Add bibliographic refs --- .Rbuildignore | 1 + CRAN-SUBMISSION | 3 + R/csdm.R | 14 ++-- R/utils_cd.R | 16 ++--- references.bib | 107 +++++++++++++++++++++++++++++ vignettes/introduction_to_csdm.Rmd | 16 ++--- 6 files changed, 124 insertions(+), 33 deletions(-) create mode 100644 CRAN-SUBMISSION create mode 100644 references.bib diff --git a/.Rbuildignore b/.Rbuildignore index cd5125e..39fa2e8 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -5,3 +5,4 @@ ^doc$ ^Meta$ ^\.github$ +^CRAN-SUBMISSION$ diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION new file mode 100644 index 0000000..e321a82 --- /dev/null +++ b/CRAN-SUBMISSION @@ -0,0 +1,3 @@ +Version: 1.0.0 +Date: 2026-02-17 20:27:31 UTC +SHA: 9ff062df4af4e5572f66abfeca5e27fa2f7b3886 diff --git a/R/csdm.R b/R/csdm.R index 38cd9bd..fad6058 100644 --- a/R/csdm.R +++ b/R/csdm.R @@ -69,19 +69,13 @@ #' } #' #' @references -#' Pesaran, M.H. and Smith, R. (1995). "Estimating long-run relationships from -#' dynamic heterogeneous panels." Journal of Econometrics, 68(1), 79-113. +#' \insertRef{PesaranSmith1995}{csdm} #' -#' Pesaran, M.H. (2006). "Estimation and inference in large heterogeneous panels -#' with multifactor error structure." Econometrica, 74(4), 967-1012. +#' \insertRef{Pesaran2006}{csdm} #' -#' Chudik, A. and Pesaran, M.H. (2015). "Common correlated effects estimation of -#' heterogeneous dynamic panel data models with weakly exogenous regressors." -#' Journal of Econometrics, 188(2), 393-420. +#' \insertRef{ChudikPesaran2015a}{csdm} #' -#' Chudik, A. and Pesaran, M.H. (2015). "Large panel data models with -#' cross-sectional dependence: A survey." Annals of Economics and Finance, 16(1), -#' 53-78. +#' \insertRef{ChudikPesaran2015b}{csdm} #' #' @examples #' library(csdm) diff --git a/R/utils_cd.R b/R/utils_cd.R index fb7c8b1..384315f 100644 --- a/R/utils_cd.R +++ b/R/utils_cd.R @@ -53,21 +53,15 @@ #' } #' #' @references -#' Pesaran, M.H. (2015). "Testing weak cross-sectional dependence in large panels." -#' \emph{Econometric Reviews}, 34(6-10), 1089-1117. +#' \insertRef{Pesaran2015}{csdm} #' -#' Pesaran, M.H. (2021). "General diagnostic tests for cross-sectional dependence -#' in panels." \emph{Empirical Economics}, 60, 13-50. +#' \insertRef{Pesaran2021}{csdm} #' -#' Juodis, A., & Reese, S. (2021). "The incidental parameters problem in testing for -#' remaining cross-sectional correlation." \emph{Journal of Business and Economic Statistics}, -#' 40(3), 1193-1203. +#' \insertRef{JuodisReese2021}{csdm} #' -#' Fan, J., Liao, Y., & Yao, J. (2015). "Power Enhancement in High-Dimensional -#' Cross-Sectional Tests." \emph{Econometric Reviews}, 34(6-10), 742-779. +#' \insertRef{FanLiaoYao2015b}{csdm} #' -#' Pesaran, M.H., & Xie, Y. (2021). "A bias-corrected CD test for error cross-sectional -#' dependence in panel models." \emph{Econometric Reviews}, 41(6), 649-677. +#' \insertRef{PesaranXie2021b}{csdm} #' #' @examples #' # Simulate independent and dependent panels diff --git a/references.bib b/references.bib new file mode 100644 index 0000000..2d9c5b0 --- /dev/null +++ b/references.bib @@ -0,0 +1,107 @@ +@article{PesaranSmith1995, + author = {Pesaran, M. Hashem and Smith, Ron}, + title = {Estimating long-run relationships from dynamic heterogeneous panels}, + journal = {Journal of Econometrics}, + year = {1995}, + volume = {68}, + number = {1}, + pages = {79--113} +} + +@article{Pesaran2006, + author = {Pesaran, M. Hashem}, + title = {Estimation and inference in large heterogeneous panels with multifactor error structure}, + journal = {Econometrica}, + year = {2006}, + volume = {74}, + number = {4}, + pages = {967--1012} +} + +@article{ChudikPesaran2015a, + author = {Chudik, Alexander and Pesaran, M. Hashem}, + title = {Common correlated effects estimation of heterogeneous dynamic panel data models with weakly exogenous regressors}, + journal = {Journal of Econometrics}, + year = {2015}, + volume = {188}, + number = {2}, + pages = {393--420} +} + +@article{ChudikPesaran2013, + author = {Chudik, Alexander and Pesaran, M. Hashem}, + title = {Large panel data models with cross-sectional dependence: A survey}, + journal = {Federal Reserve Bank of Dallas}, + year = {2013}, + volume = {153} +} + + +@article{Ditzen2021, + author = {Ditzen, Jan}, + title = {Estimating dynamic common-correlated effects in Stata}, + journal = {The Stata Journal}, + year = {2018}, + volume = {18}, + number = {3}, + pages = {585--617} +} + +@article{FanLiaoYao2015, + author = {Fan, Jianqing and Liao, Yuan and Yao, Jianfeng}, + title = {Power Enhancement in High-Dimensional Cross-Section Tests}, + journal = {Econometrica}, + year = {2015}, + volume = {83}, + number = {4}, + pages = {1497--1541} +} + +@article{Pesaran2007, + author = {Pesaran, M. Hashem}, + title = {A simple unit root test in the presence of cross-section dependence}, + journal = {Journal of Applied Econometrics}, + year = {2007}, + volume = {22}, + number = {2}, + pages = {265--312} +} + +@article{Pesaran2015, + author = {Pesaran, M. Hashem}, + title = {Testing weak cross-sectional dependence in large panels}, + journal = {Econometric Reviews}, + year = {2015}, + volume = {34}, + number = {6-10}, + pages = {1089--1117} +} + +@article{Pesaran2021, + author = {Pesaran, M. Hashem}, + title = {General diagnostic tests for cross-sectional dependence in panels}, + journal = {Empirical Economics}, + year = {2021}, + volume = {60}, + pages = {13--50} +} + +@article{JuodisReese2021, + author = {Juodis, Artūras and Reese, Søren}, + title = {The incidental parameters problem in testing for remaining cross-sectional correlation}, + journal = {Journal of Business and Economic Statistics}, + year = {2021}, + volume = {40}, + number = {3}, + pages = {1191--1203} +} + +@article{PesaranXie2021, + author = {Pesaran, M. Hashem and Xie, Yue}, + title = {A bias-corrected CD test for error cross-sectional dependence in panel models}, + journal = {Econometric Reviews}, + year = {2021}, + volume = {41}, + number = {6}, + pages = {649--677} +} diff --git a/vignettes/introduction_to_csdm.Rmd b/vignettes/introduction_to_csdm.Rmd index ac62a98..09e97bf 100644 --- a/vignettes/introduction_to_csdm.Rmd +++ b/vignettes/introduction_to_csdm.Rmd @@ -3,6 +3,7 @@ title: "Introduction to csdm: Panel Data Models with Cross-Sectional Dependence" author: "Joao Claudio Macosso" date: "`r Sys.Date()`" output: rmarkdown::html_vignette +bibliography: "../references.bib" vignette: > %\VignetteIndexEntry{Introduction to csdm} %\VignetteEngine{knitr::rmarkdown} @@ -209,7 +210,7 @@ fit_csardl <- csdm( vars = c("log_rgdpo", "log_hc", "log_ck", "log_ngd"), lags = 3 ), - lr = csdm_lr(type = "ardl", ylags = 1, xdlags = 1) + lr = csdm_lr(type = "ardl", ylags = 1, xdlags = 0) ) print(fit_csardl) @@ -295,17 +296,8 @@ In practice, models that do not account for cross-sectional dependence (like MG ## References -Chudik, A., & Pesaran, M. H. (2013). Common correlated effects estimation of heterogeneous dynamic panel data models with weakly exogenous regressors. *Journal of Business and Economic Statistics*, 33(2), 232–247. - -Ditzen, J. (2021). Estimating dynamic common-correlated effects in Stata. *The Stata Journal*, 21(1), 39–59. - -Fan, J., Liao, Y., & Yao, J. (2015). Power-enhanced simultaneous test for high-dimensional covariance matrix. *Journal of the American Statistical Association*, 110(510), 325–337. - -Juodis, A., & Reese, S. (2022). The role of the *N/T* ratio in large N, large T panel time-series models. *Econometric Reviews*, 41(2), 221–261. - -Pesaran, M. H. (2007). A simple unit root test in the presence of cross-section dependence. *Journal of Applied Econometrics*, 22(2), 265–312. - -Pesaran, M. H., & Xie, Y. (2021). A bias-adjusted LM test of error cross-section independence. *Econometric Reviews*, 40(1), 7–24. +::: {#refs} +::: --- From f06a34c34e873a8ba9fb1c492d9a76ffc6b5a3fb Mon Sep 17 00:00:00 2001 From: "Joao.Macosso" Date: Tue, 17 Mar 2026 12:37:50 +0100 Subject: [PATCH 02/10] Bump version to 1.0.1; add repo links Update DESCRIPTION: increment package Version from 1.0.0 to 1.0.1 and add URL and BugReports fields pointing to the GitHub repository. This provides metadata for locating the source and reporting issues. --- DESCRIPTION | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index dbdc4bf..e087f5f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: csdm Title: Cross-Sectional Dependence Models -Version: 1.0.0 +Version: 1.0.1 Depends: R (>= 4.0.0) Imports: MASS Suggests: @@ -15,6 +15,8 @@ Authors@R: family = "Macosso", email = "joaoclaudiomacosso@gmail.com", role = c("aut", "cre")) +URL: https://github.com/Macosso/csdm +BugReports: https://github.com/Macosso/csdm/issues Description: Provides estimators and utilities for large panel-data models with cross-sectional dependence, including mean group (MG), common correlated effects (CCE) and dynamic CCE (DCCE) estimators, and cross-sectionally augmented ARDL (CS-ARDL) specifications, plus related inference and diagnostics. License: GPL-3 Encoding: UTF-8 From 27c610433cbfcb807f5566c80efeb468dab3ed7e Mon Sep 17 00:00:00 2001 From: "Joao.Macosso" Date: Wed, 18 Mar 2026 18:24:30 +0100 Subject: [PATCH 03/10] Use insertRef for man page references --- DESCRIPTION | 4 +++- NAMESPACE | 1 + R/csdm.R | 6 ++---- R/zzz_imports.R | 1 + references.bib => inst/REFERENCES.bib | 12 +++++++----- man/cd_test.Rd | 16 +++++----------- man/csdm.Rd | 18 +++++------------- vignettes/introduction_to_csdm.Rmd | 4 +++- 8 files changed, 27 insertions(+), 35 deletions(-) rename references.bib => inst/REFERENCES.bib (93%) diff --git a/DESCRIPTION b/DESCRIPTION index e087f5f..2784300 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,9 @@ Package: csdm Title: Cross-Sectional Dependence Models Version: 1.0.1 Depends: R (>= 4.0.0) -Imports: MASS +Imports: MASS, + Rdpack +RdMacros: Rdpack Suggests: testthat (>= 3.0.0), knitr, diff --git a/NAMESPACE b/NAMESPACE index 0ded606..f1c4642 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -22,6 +22,7 @@ export(get_residuals) export(pooled_vcov) export(prepare_cd_input) export(sandwich_vcov) +importFrom(Rdpack,reprompt) importFrom(stats,aggregate) importFrom(stats,cor) importFrom(stats,model.matrix.lm) diff --git a/R/csdm.R b/R/csdm.R index fad6058..ea5e2cc 100644 --- a/R/csdm.R +++ b/R/csdm.R @@ -29,8 +29,8 @@ #' #' @return An object of class \code{csdm_fit} containing estimated coefficients, #' residuals, variance-covariance estimates, model metadata, and diagnostics. -#' Use \code{summary()}, \code{coef()}, \code{residuals()}, \code{vcov()}, and -#' \code{cd_test()} to access standard outputs. +#' Use [summary()], [coef()], [residuals()], [vcov()], and +#' [cd_test()] to access standard outputs. #' #' @details #' ## Model equations @@ -75,8 +75,6 @@ #' #' \insertRef{ChudikPesaran2015a}{csdm} #' -#' \insertRef{ChudikPesaran2015b}{csdm} -#' #' @examples #' library(csdm) #' data(PWT_60_07, package = "csdm") diff --git a/R/zzz_imports.R b/R/zzz_imports.R index ea29b6e..53dc5a4 100644 --- a/R/zzz_imports.R +++ b/R/zzz_imports.R @@ -1,2 +1,3 @@ #' @importFrom stats aggregate cor model.matrix.lm pt residuals sd setNames symnum terms +#' @importFrom Rdpack reprompt NULL diff --git a/references.bib b/inst/REFERENCES.bib similarity index 93% rename from references.bib rename to inst/REFERENCES.bib index 2d9c5b0..6644bdf 100644 --- a/references.bib +++ b/inst/REFERENCES.bib @@ -32,19 +32,20 @@ @article{ChudikPesaran2013 author = {Chudik, Alexander and Pesaran, M. Hashem}, title = {Large panel data models with cross-sectional dependence: A survey}, journal = {Federal Reserve Bank of Dallas}, - year = {2013}, - volume = {153} + type = {Globalization Institute Working Papers}, + number = {153}, + year = {2013} } - -@article{Ditzen2021, +@article{Ditzen2018, author = {Ditzen, Jan}, title = {Estimating dynamic common-correlated effects in Stata}, journal = {The Stata Journal}, year = {2018}, volume = {18}, number = {3}, - pages = {585--617} + pages = {585--617}, + doi = {10.1177/1536867X1801800306} } @article{FanLiaoYao2015, @@ -83,6 +84,7 @@ @article{Pesaran2021 journal = {Empirical Economics}, year = {2021}, volume = {60}, + number = {1}, pages = {13--50} } diff --git a/man/cd_test.Rd b/man/cd_test.Rd index 9e1f508..8775edc 100644 --- a/man/cd_test.Rd +++ b/man/cd_test.Rd @@ -136,19 +136,13 @@ cd_test(fit, type = "all") } \references{ -Pesaran, M.H. (2015). "Testing weak cross-sectional dependence in large panels." -\emph{Econometric Reviews}, 34(6-10), 1089-1117. +\insertRef{Pesaran2015}{csdm} -Pesaran, M.H. (2021). "General diagnostic tests for cross-sectional dependence -in panels." \emph{Empirical Economics}, 60, 13-50. +\insertRef{Pesaran2021}{csdm} -Juodis, A., & Reese, S. (2021). "The incidental parameters problem in testing for -remaining cross-sectional correlation." \emph{Journal of Business and Economic Statistics}, -40(3), 1193-1203. +\insertRef{JuodisReese2021}{csdm} -Fan, J., Liao, Y., & Yao, J. (2015). "Power Enhancement in High-Dimensional -Cross-Sectional Tests." \emph{Econometric Reviews}, 34(6-10), 742-779. +\insertRef{FanLiaoYao2015b}{csdm} -Pesaran, M.H., & Xie, Y. (2021). "A bias-corrected CD test for error cross-sectional -dependence in panel models." \emph{Econometric Reviews}, 41(6), 649-677. +\insertRef{PesaranXie2021b}{csdm} } diff --git a/man/csdm.Rd b/man/csdm.Rd index 8e838bc..c63030c 100644 --- a/man/csdm.Rd +++ b/man/csdm.Rd @@ -54,8 +54,8 @@ provided values are ignored.} \value{ An object of class \code{csdm_fit} containing estimated coefficients, residuals, variance-covariance estimates, model metadata, and diagnostics. -Use \code{summary()}, \code{coef()}, \code{residuals()}, \code{vcov()}, and -\code{cd_test()} to access standard outputs. +Use \code{\link[=summary]{summary()}}, \code{\link[=coef]{coef()}}, \code{\link[=residuals]{residuals()}}, \code{\link[=vcov]{vcov()}}, and +\code{\link[=cd_test]{cd_test()}} to access standard outputs. } \description{ Estimate panel data models that allow for cross-sectional dependence and @@ -145,17 +145,9 @@ cs_ardl <- csdm( summary(cs_ardl) } \references{ -Pesaran, M.H. and Smith, R. (1995). "Estimating long-run relationships from -dynamic heterogeneous panels." Journal of Econometrics, 68(1), 79-113. +\insertRef{PesaranSmith1995}{csdm} -Pesaran, M.H. (2006). "Estimation and inference in large heterogeneous panels -with multifactor error structure." Econometrica, 74(4), 967-1012. +\insertRef{Pesaran2006}{csdm} -Chudik, A. and Pesaran, M.H. (2015). "Common correlated effects estimation of -heterogeneous dynamic panel data models with weakly exogenous regressors." -Journal of Econometrics, 188(2), 393-420. - -Chudik, A. and Pesaran, M.H. (2015). "Large panel data models with -cross-sectional dependence: A survey." Annals of Economics and Finance, 16(1), -53-78. +\insertRef{ChudikPesaran2015a}{csdm} } diff --git a/vignettes/introduction_to_csdm.Rmd b/vignettes/introduction_to_csdm.Rmd index 09e97bf..a65f0ff 100644 --- a/vignettes/introduction_to_csdm.Rmd +++ b/vignettes/introduction_to_csdm.Rmd @@ -3,7 +3,9 @@ title: "Introduction to csdm: Panel Data Models with Cross-Sectional Dependence" author: "Joao Claudio Macosso" date: "`r Sys.Date()`" output: rmarkdown::html_vignette -bibliography: "../references.bib" +bibliography: "`r system.file('REFERENCES.bib', package = 'csdm')`" +nocite: | + @* vignette: > %\VignetteIndexEntry{Introduction to csdm} %\VignetteEngine{knitr::rmarkdown} From 2c105ff851e06a945afcac53f26a87525eda066f Mon Sep 17 00:00:00 2001 From: "Joao.Macosso" Date: Mon, 23 Mar 2026 11:26:57 +0100 Subject: [PATCH 04/10] Add APA CSL and update DESCRIPTION --- DESCRIPTION | 3 +- inst/apa.csl | 2273 ++++++++++++++++++++++++++++ vignettes/introduction_to_csdm.Rmd | 1 + 3 files changed, 2276 insertions(+), 1 deletion(-) create mode 100644 inst/apa.csl diff --git a/DESCRIPTION b/DESCRIPTION index 2784300..5089572 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -16,7 +16,8 @@ Authors@R: person(given = c("Joao", "Claudio"), family = "Macosso", email = "joaoclaudiomacosso@gmail.com", - role = c("aut", "cre")) + role = c("aut", "cre"), + comment = c(ORCID = "0009-0006-5051-9312")) URL: https://github.com/Macosso/csdm BugReports: https://github.com/Macosso/csdm/issues Description: Provides estimators and utilities for large panel-data models with cross-sectional dependence, including mean group (MG), common correlated effects (CCE) and dynamic CCE (DCCE) estimators, and cross-sectionally augmented ARDL (CS-ARDL) specifications, plus related inference and diagnostics. diff --git a/inst/apa.csl b/inst/apa.csl new file mode 100644 index 0000000..9bc45ef --- /dev/null +++ b/inst/apa.csl @@ -0,0 +1,2273 @@ + + diff --git a/vignettes/introduction_to_csdm.Rmd b/vignettes/introduction_to_csdm.Rmd index a65f0ff..0cadb52 100644 --- a/vignettes/introduction_to_csdm.Rmd +++ b/vignettes/introduction_to_csdm.Rmd @@ -4,6 +4,7 @@ author: "Joao Claudio Macosso" date: "`r Sys.Date()`" output: rmarkdown::html_vignette bibliography: "`r system.file('REFERENCES.bib', package = 'csdm')`" +csl: "`r system.file('apa.csl', package = 'csdm')`" nocite: | @* vignette: > From 2cd9acf289b4dd4ddc36609061f9d601cd6135f5 Mon Sep 17 00:00:00 2001 From: "Joao.Macosso" Date: Mon, 23 Mar 2026 12:59:19 +0100 Subject: [PATCH 05/10] Improve csdm documentation and vignette --- R/csdm.R | 130 +++++++++++++++++----- vignettes/introduction_to_csdm.Rmd | 169 +++++++++++++++++++++++------ 2 files changed, 242 insertions(+), 57 deletions(-) diff --git a/R/csdm.R b/R/csdm.R index ea5e2cc..1a0a044 100644 --- a/R/csdm.R +++ b/R/csdm.R @@ -1,12 +1,13 @@ # csdm.R -#' Panel Model Estimation with Cross Section Dependence +#' Panel Model Estimation with Cross-Sectional Dependence #' -#' Estimate panel data models that allow for cross-sectional dependence and -#' heterogeneous slopes. The interface supports Mean Group (MG), Common -#' Correlated Effects (CCE), Dynamic CCE (DCCE), and Cross-Sectionally -#' Augmented ARDL (CS-ARDL) estimators with consistent handling of -#' cross-sectional averages, dynamic structure, and robust inference. +#' Estimate heterogeneous panel data models with optional cross-sectional +#' augmentation and dynamic structure. The interface supports Mean Group (MG), +#' Common Correlated Effects (CCE), Dynamic CCE (DCCE), and +#' Cross-Sectionally Augmented ARDL (CS-ARDL) estimators with a consistent +#' specification workflow for cross-sectional averages, lag structure, and +#' variance-covariance estimation. #' #' @param formula Model formula of the form \code{y ~ x1 + x2}. #' @param data A \code{data.frame} (or \code{plm::pdata.frame}) containing the @@ -33,39 +34,118 @@ #' [cd_test()] to access standard outputs. #' #' @details -#' ## Model equations +#' Let \eqn{i = 1, \ldots, N} index cross-sectional units and +#' \eqn{t = 1, \ldots, T} index time. A baseline heterogeneous panel model is +#' +#' \deqn{ +#' y_{it} = \alpha_i + x_{it}^{\top}\beta_i + u_{it}, +#' } +#' +#' where \eqn{\alpha_i} is a unit-specific intercept, \eqn{x_{it}} is a vector +#' of regressors, \eqn{\beta_i} is a vector of unit-specific slopes, and +#' \eqn{u_{it}} is an error term that may exhibit cross-sectional dependence. +#' The inner product \eqn{x_{it}^{\top}\beta_i} is scalar-valued. The estimators +#' implemented in \code{csdm()} differ in how they handle slope heterogeneity, +#' common factors, and dynamic adjustment. +#' +#' \strong{Cross-sectional averages and dynamic structure} +#' +#' Cross-sectional averages are specified through [csdm_csa()] and dynamic or +#' long-run structure is specified through [csdm_lr()]. This keeps the model +#' interface consistent across estimators while allowing the degree of +#' cross-sectional augmentation and lag structure to vary by application. +#' +#' \strong{Implemented estimators} #' #' \describe{ #' \item{MG (Pesaran and Smith, 1995)}{ -#' \deqn{y_{it} = x_{it}^\top \beta_i + u_{it}} +#' Unit-by-unit estimation with heterogeneous slopes: +#' +#' \deqn{ +#' y_{it} = \alpha_i + x_{it}^{\top}\beta_i + u_{it}. +#' } +#' +#' The reported coefficients are cross-sectional averages of the +#' unit-specific estimates: +#' +#' \deqn{ +#' \hat{\beta}_{MG} = \frac{1}{N}\sum_{i=1}^N \hat{\beta}_i. +#' } +#' +#' This estimator accommodates slope heterogeneity but does not explicitly +#' model cross-sectional dependence. #' } #' \item{CCE (Pesaran, 2006)}{ -#' \deqn{y_{it} = x_{it}^\top \beta_i + \lambda_i^\top F_t + u_{it}} +#' Regressions are augmented with cross-sectional averages to proxy +#' unobserved common factors: +#' +#' \deqn{ +#' y_{it} = \alpha_i + x_{it}^{\top}\beta_i + \bar{z}_{t}^{\top}\gamma_i + v_{it}, +#' } +#' +#' where \eqn{\bar{z}_t} collects the cross-sectional averages specified in +#' \code{csa}, for example averages of the dependent variable and +#' regressors. This estimator is suitable when cross-sectional dependence is +#' driven by latent common factors. #' } #' \item{DCCE (Chudik and Pesaran, 2015)}{ -#' \deqn{\Delta y_{it} = \Delta x_{it}^\top \beta_i + \lambda_i^\top \Delta F_t + u_{it}} +#' Dynamic CCE extends CCE by allowing lagged dependent variables and lagged +#' cross-sectional averages: +#' +#' \deqn{ +#' y_{it} = +#' \alpha_i +#' + \sum_{p=1}^{P} \phi_{ip} y_{i,t-p} +#' + x_{it}^{\top}\beta_i +#' + \sum_{q=0}^{Q} \bar{z}_{t-q}^{\top}\delta_{iq} +#' + e_{it}. +#' } +#' +#' The lag structure is controlled through \code{lr} and \code{csa}. This +#' estimator is designed for dynamic panels with persistent outcomes and +#' common factor dependence. #' } #' \item{CS-ARDL (Chudik and Pesaran, 2015)}{ -#' \deqn{y_{it} = \phi_i y_{it-1} + x_{it}^\top \theta_i + \lambda_i^\top F_t + u_{it}} +#' Cross-sectionally augmented ARDL combines distributed-lag dynamics with +#' cross-sectional augmentation. A convenient error-correction +#' representation is +#' +#' \deqn{ +#' \Delta y_{it} +#' = +#' \alpha_i +#' + \phi_i \left( y_{i,t-1} - \theta_i^{\top} x_{i,t-1} \right) +#' + \sum_{j=1}^{P-1} \lambda_{ij} \Delta y_{i,t-j} +#' + \sum_{j=0}^{Q-1} \psi_{ij}^{\top} \Delta x_{i,t-j} +#' + \sum_{s=0}^{S} \bar{z}_{t-s}^{\top} \omega_{is} +#' + e_{it}. +#' } +#' +#' Here \eqn{\theta_i} denotes the unit-specific long-run relationship, +#' \eqn{\phi_i} is the speed of adjustment, and the remaining terms capture +#' short-run dynamics and common cross-sectional components. The lag +#' structure is controlled through \code{lr} and \code{csa}. #' } #' } #' -#' ## Estimation, identification, and assumptions +#' \strong{Identification and assumptions} #' #' \describe{ -#' \item{MG}{Unit-by-unit estimation with heterogeneous slopes. The reported -#' coefficients are cross-sectional averages of unit estimates. Requires -#' sufficient time series per unit and weak serial dependence in errors.} -#' \item{CCE}{Augments regressions with cross-sectional averages (CSA) to proxy -#' unobserved common factors. Identification relies on large N and T, weak -#' dependence in idiosyncratic errors after CSA, and weak exogeneity of -#' regressors.} -#' \item{DCCE}{Extends CCE to dynamic settings with lagged dependent variables -#' and CSA lags. Identification relies on weak exogeneity, adequate time length -#' for dynamic lags, and a stable factor structure.} -#' \item{CS-ARDL}{Specifies dynamic distributed lags with CSA terms. Estimation -#' follows ARDL-style dynamics in each unit and aggregates to panel averages. -#' Assumes weak exogeneity and sufficient time length for lag structure.} +#' \item{MG}{ +#' Requires sufficient time-series variation within each unit. Consistency is +#' based on unit-by-unit estimation and averaging across units.} +#' \item{CCE}{ +#' Identification relies on cross-sectional averages acting as proxies for +#' latent common factors, together with adequate cross-sectional and time +#' dimensions and weak dependence in the remaining idiosyncratic component.} +#' \item{DCCE}{ +#' In addition to the CCE assumptions, dynamic identification requires enough +#' time periods to support lagged dependent variables and lagged +#' cross-sectional averages.} +#' \item{CS-ARDL}{ +#' Requires sufficient time length for the distributed-lag structure and is +#' intended for applications where both short-run dynamics and long-run +#' relationships are of interest in the presence of common factors.} #' } #' #' @references diff --git a/vignettes/introduction_to_csdm.Rmd b/vignettes/introduction_to_csdm.Rmd index 0cadb52..867b76c 100644 --- a/vignettes/introduction_to_csdm.Rmd +++ b/vignettes/introduction_to_csdm.Rmd @@ -28,73 +28,178 @@ library(csdm) The `csdm` package implements econometric methods for panel data with cross-sectional dependence (CSD). In many applications, observations across units (e.g., countries, firms, regions) are not independent—macroeconomic shocks, trade relationships, or spillovers create correlation across cross-sectional units. The `csdm` package provides robust estimators that account for this dependence structure, plus diagnostic tests to detect and characterize it. This vignette demonstrates four core estimation methods and related inference tools on real panel data from the Penn World Table (PWT). - ## Methodology: Four Estimators - ### Model Specification -Consider a panel model with $T$ time periods and $N$ cross-sectional units (e.g., countries): +The `csdm()` interface estimates heterogeneous panel data models with optional cross-sectional augmentation and dynamic structure. Let \(i = 1, \ldots, N\) index cross-sectional units and \(t = 1, \ldots, T\) index time. A baseline heterogeneous panel model is -$$y_{it} = \alpha_i + \beta_i x_{it} + u_{it}, \quad i = 1, \ldots, N; \quad t = 1, \ldots, T$$ +$$ +y_{it} = \alpha_i + \beta_i' x_{it} + u_{it}, +\quad i = 1, \ldots, N,\; t = 1, \ldots, T +$$ where: -- $y_{it}$ is the outcome variable for unit $i$ at time $t$ -- $\alpha_i$ is a unit-specific intercept -- $\beta_i$ is a unit-specific slope (heterogeneous across units) -- $x_{it}$ is explanatory variable(s) -- $u_{it}$ is the idiosyncratic error term -The key feature is **heterogeneity in slopes** ($\beta_i$ varies by unit), which allows each unit to have its own relationship between $x$ and $y$. Four estimators are available to fit this model under different assumptions about cross-sectional dependence. +- \(y_{it}\) is the outcome variable for unit \(i\) at time \(t\) +- \(\alpha_i\) is a unit-specific intercept +- \(\beta_i\) is a \((k \times 1)\) vector of unit-specific slopes +- \(x_{it}\) is a \((k \times 1)\) vector of explanatory variables +- \(u_{it}\) is the error term, which may exhibit cross-sectional dependence + +The inner product \(\beta_i' x_{it}\) is scalar-valued. Heterogeneous slopes allow each unit to respond differently to the regressors. In many applications, cross-sectional dependence arises because the error term contains unobserved common factors. The estimators implemented in `csdm()` differ in how they handle this dependence and whether they allow for dynamic adjustment. + +--- ### 1. Mean Group (MG) Estimator -The Mean Group (MG) estimator fits unit-specific regressions separately and averages the results: +The Mean Group estimator fits separate regressions for each unit and averages the resulting coefficients: -$$\hat{\beta}_{MG} = \frac{1}{N} \sum_{i=1}^{N} \hat{\beta}_i$$ +$$ +\hat{\beta}_{MG} = \frac{1}{N}\sum_{i=1}^N \hat{\beta}_i +$$ -**Interpretation**: The MG coefficient is the simple average of individual unit slopes. It is consistent under mild regularity conditions and allows arbitrary cross-sectional dependence in errors $u_{it}$. +**Key idea**: Estimation is performed unit by unit, with no pooling of slope coefficients across cross-sectional units. -**Use case**: When dependence is present but you only care about average effects. MG is robust to forms of CSD that would break other methods. +**Interpretation**: + +- \(\hat{\beta}_{MG}\) is the cross-sectional average of the unit-specific estimates +- all slope coefficients are allowed to differ across units + +**Properties**: + +- accommodates slope heterogeneity +- requires sufficient time-series information within each unit +- does not explicitly model cross-sectional dependence + +**Use case**: A natural benchmark when the main concern is heterogeneous slopes and no explicit factor structure is imposed. + +--- ### 2. Common Correlated Effects (CCE) Estimator -The Common Correlated Effects (CCE) estimator augments the model with cross-sectional averages of regressors $\bar{x}_t = N^{-1} \sum_{i=1}^{N} x_{it}$: +The CCE estimator augments each unit regression with cross-sectional averages to proxy unobserved common factors: + +$$ +y_{it} = \alpha_i + \beta_i' x_{it} + \gamma_i' \bar{z}_t + v_{it} +$$ + +where \(\bar{z}_t\) collects the cross-sectional averages specified through `csdm_csa()`, for example + +$$ +\bar{z}_t = (\bar{y}_t, \bar{x}_t), +\qquad +\bar{x}_t = \frac{1}{N}\sum_{i=1}^N x_{it}, +\qquad +\bar{y}_t = \frac{1}{N}\sum_{i=1}^N y_{it}. +$$ + +**Key idea**: Cross-sectional averages serve as proxies for latent common factors that induce dependence across units. -$$y_{it} = \alpha_i + \beta_i x_{it} + \gamma_i \bar{x}_t + \gamma_i \bar{y}_t + v_{it}$$ +**Interpretation**: -By including these cross-sectional mean terms, the estimator **controls for common factors** (unobserved shocks that affect all units similarly). The CCE approach is more efficient than MG when common factor structure is strong, while retaining robustness to CSD. +- \(\beta_i\) measures the unit-specific effect conditional on the included cross-sectional averages +- \(\gamma_i\) captures unit-specific exposure to the common components proxied by \(\bar{z}_t\) -**Interpretation**: After accounting for common shocks, the $\beta_i$ coefficients represent unit-specific sensitivities net of factor loadings $\gamma_i$. +**Properties**: -**Use case**: When cross-sectional dependence arises primarily from common shocks or latent factors. +- allows heterogeneous slopes +- augments the regression with cross-sectional averages supplied through `csa` +- suitable when cross-sectional dependence is driven by latent common shocks + +**Use case**: When dependence across units is believed to reflect common unobserved factors. + +--- ### 3. Dynamic CCE (DCCE) Estimator -The Dynamic Common Correlated Effects (DCCE) estimator extends CCE to include lagged dependent variable: +The DCCE estimator extends CCE to dynamic settings by including lagged dependent variables and lagged cross-sectional averages: + +$$ +y_{it} += +\alpha_i ++ \sum_{p=1}^{P} \phi_{ip} y_{i,t-p} ++ \beta_i' x_{it} ++ \sum_{q=0}^{Q} \delta_{iq}' \bar{z}_{t-q} ++ e_{it} +$$ -$$y_{it} = \alpha_i + \lambda_i y_{it-1} + \beta_i x_{it} + \gamma_i \bar{x}_t + \gamma_i \bar{y}_t + v_{it}$$ +where the lag structure is controlled through `csdm_lr()` and the cross-sectional averages and their lags are controlled through `csdm_csa()`. -where $\lambda_i$ is the unit-specific autoregressive coefficient. DCCE is ideal for dynamic panel models (e.g., when studying persistence of outcomes over time). +**Key idea**: Dynamics are introduced directly in the unit equation, while lagged cross-sectional averages help absorb dynamic common factor dependence. -**Interpretation**: $\lambda_i$ captures dynamic adjustment within units, $\beta_i$ measures the long-run effect after accounting for dynamics, and $\gamma_i$ adjusts for common factors. +**Interpretation**: -**Use case**: When the outcome has substantial persistence (lagged effects) and cross-sectional dependence is suspected. +- \(\phi_{ip}\) captures unit-specific persistence +- \(\beta_i\) measures the effect of contemporaneous regressors +- \(\delta_{iq}\) captures the effect of contemporaneous and lagged common components + +**Properties**: + +- allows heterogeneous dynamic adjustment across units +- combines lagged dependent variables with cross-sectional augmentation +- requires enough time periods to support the chosen lag structure + +**Use case**: When the outcome is persistent over time and cross-sectional dependence remains important. + +--- ### 4. Cross-Sectionally Augmented ARDL (CS-ARDL) -The CS-ARDL model extends the ARDL framework with cross-sectional augmentation: +The CS-ARDL estimator combines distributed-lag dynamics with cross-sectional augmentation. A convenient error-correction representation is + +$$ +\Delta y_{it} += +\alpha_i ++ \phi_i \left( y_{i,t-1} - \theta_i' x_{i,t-1} \right) ++ \sum_{j=1}^{P-1} \lambda_{ij} \Delta y_{i,t-j} ++ \sum_{j=0}^{Q-1} \psi_{ij}' \Delta x_{i,t-j} ++ \sum_{s=0}^{S} \omega_{is}' \bar{z}_{t-s} ++ e_{it} +$$ + +where the dynamic structure is controlled through `csdm_lr()` and the cross-sectional averages are supplied through `csdm_csa()`. + +**Key idea**: CS-ARDL separates short-run dynamics from long-run relationships while accounting for common cross-sectional components. + +**Interpretation**: + +- \(\theta_i\) is the unit-specific long-run relationship +- \(\phi_i\) is the speed of adjustment back toward equilibrium +- \(\psi_{ij}\) captures short-run effects of changes in regressors +- \(\omega_{is}\) captures the role of common cross-sectional components -$$\Delta y_{it} = \alpha_i + \lambda_i (y_{it-1} - \theta_i x_{it-1}) + \beta_i \Delta x_{it} + \hat{\gamma}_i \Delta \bar{x}_t + v_{it}$$ +**Properties**: -This model combines **autoregressive and distributed lag** dynamics. It separates short-run effects ($\beta_i$) from long-run cointegrating relationships ($\theta_i$), all while controlling for common factors. +- supports heterogeneous short-run and long-run dynamics +- combines ARDL-style dynamics with cross-sectional augmentation +- useful when long-run relationships and common shocks are both relevant + +**Use case**: When the objective is to study long-run relationships together with heterogeneous short-run adjustment in panels affected by common factors. + +--- + +### Cross-Sectional Averages and Dynamic Structure + +Two helper specifications control the main extensions in `csdm()`: + +- `csdm_csa()` defines which variables enter as cross-sectional averages and how many lags of those averages are included +- `csdm_lr()` defines the dynamic or long-run structure, such as lagged dependent variables and distributed lags + +This design keeps the estimation interface consistent across the four estimators while allowing the model specification to vary by application. + +--- -**Interpretation**: -- $\theta_i$ is the long-run equilibrium relationship (cointegrating coefficient) -- $\beta_i$ is the short-run adjustment to shocks -- $\lambda_i$ governs speed of reversion to equilibrium +### Summary -**Use case**: When studying long-run relationships in non-stationary panels with complex short-run dynamics. +| Estimator | Heterogeneous Slopes | Cross-Sectional Averages | Dynamics | Long-Run Structure | +|-----------|----------------------|--------------------------|----------|--------------------| +| MG | Yes | No | Optional via `lr` if specified | No | +| CCE | Yes | Yes | Optional via `lr` if specified | No | +| DCCE | Yes | Yes | Yes | No | +| CS-ARDL | Yes | Yes | Yes | Yes | ## Data: Penn World Table Subset From d34b1f7a41fabd95763871017639c48e6df707a9 Mon Sep 17 00:00:00 2001 From: "Joao.Macosso" Date: Mon, 23 Mar 2026 17:11:34 +0100 Subject: [PATCH 06/10] Refactor csdm documentation and vignette --- R/csdm.R | 182 ++++++++++++++--------------- man/csdm.Rd | 148 ++++++++++++++++------- vignettes/introduction_to_csdm.Rmd | 51 +++++--- 3 files changed, 227 insertions(+), 154 deletions(-) diff --git a/R/csdm.R b/R/csdm.R index 1a0a044..5333e0f 100644 --- a/R/csdm.R +++ b/R/csdm.R @@ -37,18 +37,11 @@ #' Let \eqn{i = 1, \ldots, N} index cross-sectional units and #' \eqn{t = 1, \ldots, T} index time. A baseline heterogeneous panel model is #' -#' \deqn{ -#' y_{it} = \alpha_i + x_{it}^{\top}\beta_i + u_{it}, -#' } +#' \deqn{y_{it} = \alpha_i + \beta_i^T x_{it} + u_{it}.} #' -#' where \eqn{\alpha_i} is a unit-specific intercept, \eqn{x_{it}} is a vector +#' Here \eqn{\alpha_i} is a unit-specific intercept, \eqn{x_{it}} is a vector #' of regressors, \eqn{\beta_i} is a vector of unit-specific slopes, and #' \eqn{u_{it}} is an error term that may exhibit cross-sectional dependence. -#' The inner product \eqn{x_{it}^{\top}\beta_i} is scalar-valued. The estimators -#' implemented in \code{csdm()} differ in how they handle slope heterogeneity, -#' common factors, and dynamic adjustment. -#' -#' \strong{Cross-sectional averages and dynamic structure} #' #' Cross-sectional averages are specified through [csdm_csa()] and dynamic or #' long-run structure is specified through [csdm_lr()]. This keeps the model @@ -57,96 +50,93 @@ #' #' \strong{Implemented estimators} #' -#' \describe{ -#' \item{MG (Pesaran and Smith, 1995)}{ -#' Unit-by-unit estimation with heterogeneous slopes: -#' -#' \deqn{ -#' y_{it} = \alpha_i + x_{it}^{\top}\beta_i + u_{it}. -#' } -#' -#' The reported coefficients are cross-sectional averages of the -#' unit-specific estimates: -#' -#' \deqn{ -#' \hat{\beta}_{MG} = \frac{1}{N}\sum_{i=1}^N \hat{\beta}_i. -#' } -#' -#' This estimator accommodates slope heterogeneity but does not explicitly -#' model cross-sectional dependence. -#' } -#' \item{CCE (Pesaran, 2006)}{ -#' Regressions are augmented with cross-sectional averages to proxy -#' unobserved common factors: -#' -#' \deqn{ -#' y_{it} = \alpha_i + x_{it}^{\top}\beta_i + \bar{z}_{t}^{\top}\gamma_i + v_{it}, -#' } -#' -#' where \eqn{\bar{z}_t} collects the cross-sectional averages specified in -#' \code{csa}, for example averages of the dependent variable and -#' regressors. This estimator is suitable when cross-sectional dependence is -#' driven by latent common factors. -#' } -#' \item{DCCE (Chudik and Pesaran, 2015)}{ -#' Dynamic CCE extends CCE by allowing lagged dependent variables and lagged -#' cross-sectional averages: -#' -#' \deqn{ -#' y_{it} = -#' \alpha_i -#' + \sum_{p=1}^{P} \phi_{ip} y_{i,t-p} -#' + x_{it}^{\top}\beta_i -#' + \sum_{q=0}^{Q} \bar{z}_{t-q}^{\top}\delta_{iq} -#' + e_{it}. -#' } -#' -#' The lag structure is controlled through \code{lr} and \code{csa}. This -#' estimator is designed for dynamic panels with persistent outcomes and -#' common factor dependence. -#' } -#' \item{CS-ARDL (Chudik and Pesaran, 2015)}{ -#' Cross-sectionally augmented ARDL combines distributed-lag dynamics with -#' cross-sectional augmentation. A convenient error-correction -#' representation is -#' -#' \deqn{ -#' \Delta y_{it} -#' = -#' \alpha_i -#' + \phi_i \left( y_{i,t-1} - \theta_i^{\top} x_{i,t-1} \right) -#' + \sum_{j=1}^{P-1} \lambda_{ij} \Delta y_{i,t-j} -#' + \sum_{j=0}^{Q-1} \psi_{ij}^{\top} \Delta x_{i,t-j} -#' + \sum_{s=0}^{S} \bar{z}_{t-s}^{\top} \omega_{is} -#' + e_{it}. -#' } -#' -#' Here \eqn{\theta_i} denotes the unit-specific long-run relationship, -#' \eqn{\phi_i} is the speed of adjustment, and the remaining terms capture -#' short-run dynamics and common cross-sectional components. The lag -#' structure is controlled through \code{lr} and \code{csa}. -#' } -#' } +#' \strong{MG (Pesaran and Smith, 1995)} +#' +#' The Mean Group estimator fits separate regressions for each unit and averages +#' the resulting coefficients: +#' +#' \deqn{\hat{\beta}_{MG} = \frac{1}{N}\sum_{i=1}^N \hat{\beta}_i.} +#' +#' This estimator accommodates slope heterogeneity but does not explicitly model +#' cross-sectional dependence. +#' +#' \strong{CCE (Pesaran, 2006)} +#' +#' Regressions are augmented with cross-sectional averages to proxy unobserved +#' common factors: +#' +#' \deqn{y_{it} = \alpha_i + \beta_i^T x_{it} + \gamma_i^T \bar{z}_{t} + v_{it}.} +#' +#' A common choice is +#' +#' \deqn{\bar{z}_t = (\bar{y}_t, \bar{x}_t),} +#' +#' with +#' +#' \deqn{\bar{x}_t = \frac{1}{N}\sum_{i=1}^N x_{it}, \qquad +#' \bar{y}_t = \frac{1}{N}\sum_{i=1}^N y_{it}.} +#' +#' More generally, \eqn{\bar{z}_t} collects the cross-sectional averages +#' specified in \code{csa}. +#' +#' \strong{DCCE (Chudik and Pesaran, 2015)} +#' +#' Dynamic CCE extends CCE by allowing lagged dependent variables and lagged +#' cross-sectional averages: +#' +#' \deqn{y_{it} = \alpha_i + \sum_{p=1}^{P} \phi_{ip} y_{i,t-p} +#' + \beta_i^T x_{it} +#' + \sum_{q=0}^{Q} \delta_{iq}^T \bar{z}_{t-q} +#' + e_{it}.} +#' +#' In the package implementation, lagged dependent variables and distributed +#' lags of regressors are controlled through \code{lr}, while contemporaneous +#' and lagged cross-sectional averages are controlled through \code{csa}. +#' +#' \strong{CS-ARDL (Chudik and Pesaran, 2015)} +#' +#' In the package implementation, \code{model = "cs_ardl"} is obtained by first +#' estimating a cross-sectionally augmented ARDL-style regression in levels, +#' using the same dynamic specification as \code{model = "dcce"}, and then +#' transforming the unit-specific coefficients into adjustment and long-run +#' parameters. +#' +#' The underlying unit-level regression is of the form +#' +#' \deqn{y_{it} = \alpha_i + \sum_{p=1}^{P} \phi_{ip} y_{i,t-p} +#' + \sum_{q=0}^{Q} \beta_{iq}^T x_{i,t-q} +#' + \sum_{s=0}^{S} \omega_{is}^T \bar{z}_{t-s} +#' + e_{it}.} +#' +#' From this dynamic specification, the package recovers the implied +#' error-correction form +#' +#' \deqn{\Delta y_{it} = +#' \alpha_i + +#' \varphi_i \left(y_{i,t-1} - \theta_i^T x_{i,t-1}\right) +#' + \sum_{j=1}^{P-1} \lambda_{ij} \Delta y_{i,t-j} +#' + \sum_{j=0}^{Q-1} \psi_{ij}^T \Delta x_{i,t-j} +#' + \sum_{s=0}^{S} \tilde{\omega}_{is}^T \bar{z}_{t-s} +#' + e_{it},} +#' +#' where \eqn{\varphi_i} is the adjustment coefficient and \eqn{\theta_i} is +#' the implied long-run relationship. In the current implementation, these +#' quantities are computed from the estimated lag polynomials rather than from a +#' direct ECM regression. #' #' \strong{Identification and assumptions} #' -#' \describe{ -#' \item{MG}{ -#' Requires sufficient time-series variation within each unit. Consistency is -#' based on unit-by-unit estimation and averaging across units.} -#' \item{CCE}{ -#' Identification relies on cross-sectional averages acting as proxies for -#' latent common factors, together with adequate cross-sectional and time -#' dimensions and weak dependence in the remaining idiosyncratic component.} -#' \item{DCCE}{ -#' In addition to the CCE assumptions, dynamic identification requires enough -#' time periods to support lagged dependent variables and lagged -#' cross-sectional averages.} -#' \item{CS-ARDL}{ -#' Requires sufficient time length for the distributed-lag structure and is -#' intended for applications where both short-run dynamics and long-run -#' relationships are of interest in the presence of common factors.} -#' } +#' MG requires sufficient time-series variation within each unit. +#' +#' CCE relies on cross-sectional averages acting as proxies for latent common +#' factors, together with adequate cross-sectional and time dimensions. +#' +#' DCCE additionally requires enough time periods to support lagged dependent +#' variables, distributed lags, and lagged cross-sectional averages. +#' +#' CS-ARDL requires sufficient time length for the distributed-lag structure and +#' is intended for applications where both short-run dynamics and long-run +#' relationships are of interest in the presence of common factors. #' #' @references #' \insertRef{PesaranSmith1995}{csdm} diff --git a/man/csdm.Rd b/man/csdm.Rd index c63030c..4afeaec 100644 --- a/man/csdm.Rd +++ b/man/csdm.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/csdm.R \name{csdm} \alias{csdm} -\title{Panel Model Estimation with Cross Section Dependence} +\title{Panel Model Estimation with Cross-Sectional Dependence} \usage{ csdm( formula, @@ -58,49 +58,117 @@ Use \code{\link[=summary]{summary()}}, \code{\link[=coef]{coef()}}, \code{\link[ \code{\link[=cd_test]{cd_test()}} to access standard outputs. } \description{ -Estimate panel data models that allow for cross-sectional dependence and -heterogeneous slopes. The interface supports Mean Group (MG), Common -Correlated Effects (CCE), Dynamic CCE (DCCE), and Cross-Sectionally -Augmented ARDL (CS-ARDL) estimators with consistent handling of -cross-sectional averages, dynamic structure, and robust inference. +Estimate heterogeneous panel data models with optional cross-sectional +augmentation and dynamic structure. The interface supports Mean Group (MG), +Common Correlated Effects (CCE), Dynamic CCE (DCCE), and +Cross-Sectionally Augmented ARDL (CS-ARDL) estimators with a consistent +specification workflow for cross-sectional averages, lag structure, and +variance-covariance estimation. } \details{ -\subsection{Model equations}{ +Let \eqn{i = 1, \ldots, N} index cross-sectional units and +\eqn{t = 1, \ldots, T} index time. A baseline heterogeneous panel model is -\describe{ -\item{MG (Pesaran and Smith, 1995)}{ -\deqn{y_{it} = x_{it}^\top \beta_i + u_{it}} -} -\item{CCE (Pesaran, 2006)}{ -\deqn{y_{it} = x_{it}^\top \beta_i + \lambda_i^\top F_t + u_{it}} -} -\item{DCCE (Chudik and Pesaran, 2015)}{ -\deqn{\Delta y_{it} = \Delta x_{it}^\top \beta_i + \lambda_i^\top \Delta F_t + u_{it}} -} -\item{CS-ARDL (Chudik and Pesaran, 2015)}{ -\deqn{y_{it} = \phi_i y_{it-1} + x_{it}^\top \theta_i + \lambda_i^\top F_t + u_{it}} -} -} -} +\deqn{y_{it} = \alpha_i + \beta_i^T x_{it} + u_{it}.} -\subsection{Estimation, identification, and assumptions}{ - -\describe{ -\item{MG}{Unit-by-unit estimation with heterogeneous slopes. The reported -coefficients are cross-sectional averages of unit estimates. Requires -sufficient time series per unit and weak serial dependence in errors.} -\item{CCE}{Augments regressions with cross-sectional averages (CSA) to proxy -unobserved common factors. Identification relies on large N and T, weak -dependence in idiosyncratic errors after CSA, and weak exogeneity of -regressors.} -\item{DCCE}{Extends CCE to dynamic settings with lagged dependent variables -and CSA lags. Identification relies on weak exogeneity, adequate time length -for dynamic lags, and a stable factor structure.} -\item{CS-ARDL}{Specifies dynamic distributed lags with CSA terms. Estimation -follows ARDL-style dynamics in each unit and aggregates to panel averages. -Assumes weak exogeneity and sufficient time length for lag structure.} -} -} +Here \eqn{\alpha_i} is a unit-specific intercept, \eqn{x_{it}} is a vector +of regressors, \eqn{\beta_i} is a vector of unit-specific slopes, and +\eqn{u_{it}} is an error term that may exhibit cross-sectional dependence. + +Cross-sectional averages are specified through \code{\link[=csdm_csa]{csdm_csa()}} and dynamic or +long-run structure is specified through \code{\link[=csdm_lr]{csdm_lr()}}. This keeps the model +interface consistent across estimators while allowing the degree of +cross-sectional augmentation and lag structure to vary by application. + +\strong{Implemented estimators} + +\strong{MG (Pesaran and Smith, 1995)} + +The Mean Group estimator fits separate regressions for each unit and averages +the resulting coefficients: + +\deqn{\hat{\beta}_{MG} = \frac{1}{N}\sum_{i=1}^N \hat{\beta}_i.} + +This estimator accommodates slope heterogeneity but does not explicitly model +cross-sectional dependence. + +\strong{CCE (Pesaran, 2006)} + +Regressions are augmented with cross-sectional averages to proxy unobserved +common factors: + +\deqn{y_{it} = \alpha_i + \beta_i^T x_{it} + \gamma_i^T \bar{z}_{t} + v_{it}.} + +A common choice is + +\deqn{\bar{z}_t = (\bar{y}_t, \bar{x}_t),} + +with + +\deqn{\bar{x}_t = \frac{1}{N}\sum_{i=1}^N x_{it}, \qquad +\bar{y}_t = \frac{1}{N}\sum_{i=1}^N y_{it}.} + +More generally, \eqn{\bar{z}_t} collects the cross-sectional averages +specified in \code{csa}. + +\strong{DCCE (Chudik and Pesaran, 2015)} + +Dynamic CCE extends CCE by allowing lagged dependent variables and lagged +cross-sectional averages: + +\deqn{y_{it} = \alpha_i + \sum_{p=1}^{P} \phi_{ip} y_{i,t-p} ++ \beta_i^T x_{it} ++ \sum_{q=0}^{Q} \delta_{iq}^T \bar{z}_{t-q} ++ e_{it}.} + +In the package implementation, lagged dependent variables and distributed +lags of regressors are controlled through \code{lr}, while contemporaneous +and lagged cross-sectional averages are controlled through \code{csa}. + +\strong{CS-ARDL (Chudik and Pesaran, 2015)} + +In the package implementation, \code{model = "cs_ardl"} is obtained by first +estimating a cross-sectionally augmented ARDL-style regression in levels, +using the same dynamic specification as \code{model = "dcce"}, and then +transforming the unit-specific coefficients into adjustment and long-run +parameters. + +The underlying unit-level regression is of the form + +\deqn{y_{it} = \alpha_i + \sum_{p=1}^{P} \phi_{ip} y_{i,t-p} ++ \sum_{q=0}^{Q} \beta_{iq}^T x_{i,t-q} ++ \sum_{s=0}^{S} \omega_{is}^T \bar{z}_{t-s} ++ e_{it}.} + +From this dynamic specification, the package recovers the implied +error-correction form + +\deqn{\Delta y_{it} = +\alpha_i + +\varphi_i \left(y_{i,t-1} - \theta_i^T x_{i,t-1}\right) ++ \sum_{j=1}^{P-1} \lambda_{ij} \Delta y_{i,t-j} ++ \sum_{j=0}^{Q-1} \psi_{ij}^T \Delta x_{i,t-j} ++ \sum_{s=0}^{S} \tilde{\omega}_{is}^T \bar{z}_{t-s} ++ e_{it},} + +where \eqn{\varphi_i} is the adjustment coefficient and \eqn{\theta_i} is +the implied long-run relationship. In the current implementation, these +quantities are computed from the estimated lag polynomials rather than from a +direct ECM regression. + +\strong{Identification and assumptions} + +MG requires sufficient time-series variation within each unit. + +CCE relies on cross-sectional averages acting as proxies for latent common +factors, together with adequate cross-sectional and time dimensions. + +DCCE additionally requires enough time periods to support lagged dependent +variables, distributed lags, and lagged cross-sectional averages. + +CS-ARDL requires sufficient time length for the distributed-lag structure and +is intended for applications where both short-run dynamics and long-run +relationships are of interest in the presence of common factors. } \examples{ library(csdm) diff --git a/vignettes/introduction_to_csdm.Rmd b/vignettes/introduction_to_csdm.Rmd index 867b76c..0d37d99 100644 --- a/vignettes/introduction_to_csdm.Rmd +++ b/vignettes/introduction_to_csdm.Rmd @@ -28,6 +28,7 @@ library(csdm) The `csdm` package implements econometric methods for panel data with cross-sectional dependence (CSD). In many applications, observations across units (e.g., countries, firms, regions) are not independent—macroeconomic shocks, trade relationships, or spillovers create correlation across cross-sectional units. The `csdm` package provides robust estimators that account for this dependence structure, plus diagnostic tests to detect and characterize it. This vignette demonstrates four core estimation methods and related inference tools on real panel data from the Penn World Table (PWT). + ## Methodology: Four Estimators ### Model Specification @@ -36,7 +37,7 @@ The `csdm()` interface estimates heterogeneous panel data models with optional c $$ y_{it} = \alpha_i + \beta_i' x_{it} + u_{it}, -\quad i = 1, \ldots, N,\; t = 1, \ldots, T +\qquad i = 1, \ldots, N,\; t = 1, \ldots, T $$ where: @@ -113,32 +114,32 @@ $$ ### 3. Dynamic CCE (DCCE) Estimator -The DCCE estimator extends CCE to dynamic settings by including lagged dependent variables and lagged cross-sectional averages: +The DCCE estimator extends CCE to dynamic settings by including lagged dependent variables, optional distributed lags of regressors, and lagged cross-sectional averages: $$ y_{it} = \alpha_i + \sum_{p=1}^{P} \phi_{ip} y_{i,t-p} -+ \beta_i' x_{it} -+ \sum_{q=0}^{Q} \delta_{iq}' \bar{z}_{t-q} ++ \sum_{q=0}^{Q} \beta_{iq}' x_{i,t-q} ++ \sum_{s=0}^{S} \delta_{is}' \bar{z}_{t-s} + e_{it} $$ -where the lag structure is controlled through `csdm_lr()` and the cross-sectional averages and their lags are controlled through `csdm_csa()`. +where the dynamic structure is controlled through `csdm_lr()` and the cross-sectional averages and their lags are controlled through `csdm_csa()`. -**Key idea**: Dynamics are introduced directly in the unit equation, while lagged cross-sectional averages help absorb dynamic common factor dependence. +**Key idea**: Dynamics are introduced directly in the unit equation, while lagged cross-sectional averages help absorb common factor dependence over time. **Interpretation**: - \(\phi_{ip}\) captures unit-specific persistence -- \(\beta_i\) measures the effect of contemporaneous regressors -- \(\delta_{iq}\) captures the effect of contemporaneous and lagged common components +- \(\beta_{iq}\) captures contemporaneous and lagged effects of regressors +- \(\delta_{is}\) captures the effect of contemporaneous and lagged common components **Properties**: - allows heterogeneous dynamic adjustment across units -- combines lagged dependent variables with cross-sectional augmentation +- combines lagged dependent variables, optional distributed lags, and cross-sectional augmentation - requires enough time periods to support the chosen lag structure **Use case**: When the outcome is persistent over time and cross-sectional dependence remains important. @@ -147,35 +148,49 @@ where the lag structure is controlled through `csdm_lr()` and the cross-sectiona ### 4. Cross-Sectionally Augmented ARDL (CS-ARDL) -The CS-ARDL estimator combines distributed-lag dynamics with cross-sectional augmentation. A convenient error-correction representation is +In the current `csdm()` implementation, `model = "cs_ardl"` is obtained by first estimating a cross-sectionally augmented ARDL-style regression in levels, using the same dynamic specification as `model = "dcce"`, and then transforming the estimated unit-specific coefficients into adjustment and long-run parameters. + +The underlying unit-level regression is + +$$ +y_{it} += +\alpha_i ++ \sum_{p=1}^{P} \phi_{ip} y_{i,t-p} ++ \sum_{q=0}^{Q} \beta_{iq}' x_{i,t-q} ++ \sum_{s=0}^{S} \omega_{is}' \bar{z}_{t-s} ++ e_{it} +$$ + +From this dynamic specification, the implied error-correction form is $$ \Delta y_{it} = \alpha_i -+ \phi_i \left( y_{i,t-1} - \theta_i' x_{i,t-1} \right) ++ \varphi_i \left( y_{i,t-1} - \theta_i' x_{i,t-1} \right) + \sum_{j=1}^{P-1} \lambda_{ij} \Delta y_{i,t-j} + \sum_{j=0}^{Q-1} \psi_{ij}' \Delta x_{i,t-j} -+ \sum_{s=0}^{S} \omega_{is}' \bar{z}_{t-s} ++ \sum_{s=0}^{S} \tilde{\omega}_{is}' \bar{z}_{t-s} + e_{it} $$ where the dynamic structure is controlled through `csdm_lr()` and the cross-sectional averages are supplied through `csdm_csa()`. -**Key idea**: CS-ARDL separates short-run dynamics from long-run relationships while accounting for common cross-sectional components. +**Key idea**: `cs_ardl` reports the implied short-run and long-run quantities from a cross-sectionally augmented ARDL fit. **Interpretation**: - \(\theta_i\) is the unit-specific long-run relationship -- \(\phi_i\) is the speed of adjustment back toward equilibrium +- \(\varphi_i\) is the implied speed of adjustment back toward equilibrium - \(\psi_{ij}\) captures short-run effects of changes in regressors -- \(\omega_{is}\) captures the role of common cross-sectional components +- \(\tilde{\omega}_{is}\) captures the role of common cross-sectional components **Properties**: - supports heterogeneous short-run and long-run dynamics - combines ARDL-style dynamics with cross-sectional augmentation -- useful when long-run relationships and common shocks are both relevant +- recovers adjustment and long-run coefficients from estimated lag polynomials rather than fitting a separate ECM directly **Use case**: When the objective is to study long-run relationships together with heterogeneous short-run adjustment in panels affected by common factors. @@ -196,8 +211,8 @@ This design keeps the estimation interface consistent across the four estimators | Estimator | Heterogeneous Slopes | Cross-Sectional Averages | Dynamics | Long-Run Structure | |-----------|----------------------|--------------------------|----------|--------------------| -| MG | Yes | No | Optional via `lr` if specified | No | -| CCE | Yes | Yes | Optional via `lr` if specified | No | +| MG | Yes | No | No | No | +| CCE | Yes | Yes | No | No | | DCCE | Yes | Yes | Yes | No | | CS-ARDL | Yes | Yes | Yes | Yes | From f5acf412ec2f077ce47ca5a4c820a1cac39b2903 Mon Sep 17 00:00:00 2001 From: "Joao.Macosso" Date: Mon, 23 Mar 2026 18:23:23 +0100 Subject: [PATCH 07/10] add a logo and package down --- .Rbuildignore | 3 + .gitignore | 1 + README.md | 204 +++++++++++++++---- _pkgdown.yml | 13 ++ man/figures/logo.svg | 109 ++++++++++ pkgdown/favicon/apple-touch-icon.png | Bin 0 -> 3902 bytes pkgdown/favicon/favicon-96x96.png | Bin 0 -> 1867 bytes pkgdown/favicon/favicon.ico | Bin 0 -> 15086 bytes pkgdown/favicon/favicon.svg | 108 ++++++++++ pkgdown/favicon/site.webmanifest | 21 ++ pkgdown/favicon/web-app-manifest-192x192.png | Bin 0 -> 4161 bytes pkgdown/favicon/web-app-manifest-512x512.png | Bin 0 -> 11818 bytes 12 files changed, 422 insertions(+), 37 deletions(-) create mode 100644 _pkgdown.yml create mode 100644 man/figures/logo.svg create mode 100644 pkgdown/favicon/apple-touch-icon.png create mode 100644 pkgdown/favicon/favicon-96x96.png create mode 100644 pkgdown/favicon/favicon.ico create mode 100644 pkgdown/favicon/favicon.svg create mode 100644 pkgdown/favicon/site.webmanifest create mode 100644 pkgdown/favicon/web-app-manifest-192x192.png create mode 100644 pkgdown/favicon/web-app-manifest-512x512.png diff --git a/.Rbuildignore b/.Rbuildignore index 39fa2e8..3e6fff7 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -6,3 +6,6 @@ ^Meta$ ^\.github$ ^CRAN-SUBMISSION$ +^_pkgdown\.yml$ +^docs$ +^pkgdown$ diff --git a/.gitignore b/.gitignore index 311da47..f729723 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ inst/doc .Rprofile /doc/ /Meta/ +docs diff --git a/README.md b/README.md index 06fd09a..0d20edf 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +# csdm [![R-CMD-check](https://github.com/Macosso/csdm/workflows/R-CMD-check/badge.svg)](https://github.com/Macosso/csdm/actions) @@ -10,70 +11,190 @@ This vignette demonstrates four core estimation methods and related inference to ## Methodology: Four Estimators - ### Model Specification -Consider a panel model with $T$ time periods and $N$ cross-sectional units (e.g., countries): +The `csdm()` interface estimates heterogeneous panel data models with optional cross-sectional augmentation and dynamic structure. Let \(i = 1, \ldots, N\) index cross-sectional units and \(t = 1, \ldots, T\) index time. A baseline heterogeneous panel model is -$$y_{it} = \alpha_i + \beta_i x_{it} + u_{it}, \quad i = 1, \ldots, N; \quad t = 1, \ldots, T$$ +$$ +y_{it} = \alpha_i + \beta_i' x_{it} + u_{it}, +\qquad i = 1, \ldots, N,\; t = 1, \ldots, T +$$ where: -- $y_{it}$ is the outcome variable for unit $i$ at time $t$ -- $\alpha_i$ is a unit-specific intercept -- $\beta_i$ is a unit-specific slope (heterogeneous across units) -- $x_{it}$ is explanatory variable(s) -- $u_{it}$ is the idiosyncratic error term -The key feature is **heterogeneity in slopes** ($\beta_i$ varies by unit), which allows each unit to have its own relationship between $x$ and $y$. Four estimators are available to fit this model under different assumptions about cross-sectional dependence. +- \(y_{it}\) is the outcome variable for unit \(i\) at time \(t\) +- \(\alpha_i\) is a unit-specific intercept +- \(\beta_i\) is a \((k \times 1)\) vector of unit-specific slopes +- \(x_{it}\) is a \((k \times 1)\) vector of explanatory variables +- \(u_{it}\) is the error term, which may exhibit cross-sectional dependence + +The inner product \(\beta_i' x_{it}\) is scalar-valued. Heterogeneous slopes allow each unit to respond differently to the regressors. In many applications, cross-sectional dependence arises because the error term contains unobserved common factors. The estimators implemented in `csdm()` differ in how they handle this dependence and whether they allow for dynamic adjustment. + +--- ### 1. Mean Group (MG) Estimator -The Mean Group (MG) estimator fits unit-specific regressions separately and averages the results: +The Mean Group estimator fits separate regressions for each unit and averages the resulting coefficients: + +$$ +\hat{\beta}_{MG} = \frac{1}{N}\sum_{i=1}^N \hat{\beta}_i +$$ + +**Key idea**: Estimation is performed unit by unit, with no pooling of slope coefficients across cross-sectional units. -$$\hat{\beta}_{MG} = \frac{1}{N} \sum_{i=1}^{N} \hat{\beta}_i$$ +**Interpretation**: -**Interpretation**: The MG coefficient is the simple average of individual unit slopes. It is consistent under mild regularity conditions and allows arbitrary cross-sectional dependence in errors $u_{it}$. +- \(\hat{\beta}_{MG}\) is the cross-sectional average of the unit-specific estimates +- all slope coefficients are allowed to differ across units -**Use case**: When dependence is present but you only care about average effects. MG is robust to forms of CSD that would break other methods. +**Properties**: + +- accommodates slope heterogeneity +- requires sufficient time-series information within each unit +- does not explicitly model cross-sectional dependence + +**Use case**: A natural benchmark when the main concern is heterogeneous slopes and no explicit factor structure is imposed. + +--- ### 2. Common Correlated Effects (CCE) Estimator -The Common Correlated Effects (CCE) estimator augments the model with cross-sectional averages of regressors $\bar{x}_t = \frac{1}{N} \sum_{i=1}^{N} x_{it}$: +The CCE estimator augments each unit regression with cross-sectional averages to proxy unobserved common factors: + +$$ +y_{it} = \alpha_i + \beta_i' x_{it} + \gamma_i' \bar{z}_t + v_{it} +$$ + +where \(\bar{z}_t\) collects the cross-sectional averages specified through `csdm_csa()`, for example -$$y_{it} = \alpha_i + \beta_i x_{it} + \gamma_i \bar{x}_t + \gamma_i \bar{y}_t + v_{it}$$ +$$ +\bar{z}_t = (\bar{y}_t, \bar{x}_t), +\qquad +\bar{x}_t = \frac{1}{N}\sum_{i=1}^N x_{it}, +\qquad +\bar{y}_t = \frac{1}{N}\sum_{i=1}^N y_{it}. +$$ -By including these cross-sectional mean terms, the estimator **controls for common factors** (unobserved shocks that affect all units similarly). The CCE approach is more efficient than MG when common factor structure is strong, while retaining robustness to CSD. +**Key idea**: Cross-sectional averages serve as proxies for latent common factors that induce dependence across units. -**Interpretation**: After accounting for common shocks, the $\beta_i$ coefficients represent unit-specific sensitivities net of factor loadings $\gamma_i$. +**Interpretation**: -**Use case**: When cross-sectional dependence arises primarily from common shocks or latent factors. +- \(\beta_i\) measures the unit-specific effect conditional on the included cross-sectional averages +- \(\gamma_i\) captures unit-specific exposure to the common components proxied by \(\bar{z}_t\) + +**Properties**: + +- allows heterogeneous slopes +- augments the regression with cross-sectional averages supplied through `csa` +- suitable when cross-sectional dependence is driven by latent common shocks + +**Use case**: When dependence across units is believed to reflect common unobserved factors. + +--- ### 3. Dynamic CCE (DCCE) Estimator -The Dynamic Common Correlated Effects (DCCE) estimator extends CCE to include lagged dependent variable: +The DCCE estimator extends CCE to dynamic settings by including lagged dependent variables, optional distributed lags of regressors, and lagged cross-sectional averages: + +$$ +y_{it} += +\alpha_i ++ \sum_{p=1}^{P} \phi_{ip} y_{i,t-p} ++ \sum_{q=0}^{Q} \beta_{iq}' x_{i,t-q} ++ \sum_{s=0}^{S} \delta_{is}' \bar{z}_{t-s} ++ e_{it} +$$ + +where the dynamic structure is controlled through `csdm_lr()` and the cross-sectional averages and their lags are controlled through `csdm_csa()`. + +**Key idea**: Dynamics are introduced directly in the unit equation, while lagged cross-sectional averages help absorb common factor dependence over time. + +**Interpretation**: + +- \(\phi_{ip}\) captures unit-specific persistence +- \(\beta_{iq}\) captures contemporaneous and lagged effects of regressors +- \(\delta_{is}\) captures the effect of contemporaneous and lagged common components -$$y_{it} = \alpha_i + \lambda_i y_{it-1} + \beta_i x_{it} + \gamma_i \bar{x}_t + \gamma_i \bar{y}_t + v_{it}$$ +**Properties**: -where $\lambda_i$ is the unit-specific autoregressive coefficient. DCCE is ideal for dynamic panel models (e.g., when studying persistence of outcomes over time). +- allows heterogeneous dynamic adjustment across units +- combines lagged dependent variables, optional distributed lags, and cross-sectional augmentation +- requires enough time periods to support the chosen lag structure -**Interpretation**: $\lambda_i$ captures dynamic adjustment within units, $\beta_i$ measures the long-run effect after accounting for dynamics, and $\gamma_i$ adjusts for common factors. +**Use case**: When the outcome is persistent over time and cross-sectional dependence remains important. -**Use case**: When the outcome has substantial persistence (lagged effects) and cross-sectional dependence is suspected. +--- ### 4. Cross-Sectionally Augmented ARDL (CS-ARDL) -The CS-ARDL model extends the ARDL framework with cross-sectional augmentation: +In the current `csdm()` implementation, `model = "cs_ardl"` is obtained by first estimating a cross-sectionally augmented ARDL-style regression in levels, using the same dynamic specification as `model = "dcce"`, and then transforming the estimated unit-specific coefficients into adjustment and long-run parameters. -$$\Delta y_{it} = \alpha_i + \lambda_i (y_{it-1} - \theta_i x_{it-1}) + \beta_i \Delta x_{it} + \hat{\gamma}_i \Delta \bar{x}_t + v_{it}$$ +The underlying unit-level regression is -This model combines **autoregressive and distributed lag** dynamics. It separates short-run effects ($\beta_i$) from long-run cointegrating relationships ($\theta_i$), all while controlling for common factors. +$$ +y_{it} += +\alpha_i ++ \sum_{p=1}^{P} \phi_{ip} y_{i,t-p} ++ \sum_{q=0}^{Q} \beta_{iq}' x_{i,t-q} ++ \sum_{s=0}^{S} \omega_{is}' \bar{z}_{t-s} ++ e_{it} +$$ -**Interpretation**: -- $\theta_i$ is the long-run equilibrium relationship (cointegrating coefficient) -- $\beta_i$ is the short-run adjustment to shocks -- $\lambda_i$ governs speed of reversion to equilibrium +From this dynamic specification, the implied error-correction form is -**Use case**: When studying long-run relationships in non-stationary panels with complex short-run dynamics. +$$ +\Delta y_{it} += +\alpha_i ++ \varphi_i \left( y_{i,t-1} - \theta_i' x_{i,t-1} \right) ++ \sum_{j=1}^{P-1} \lambda_{ij} \Delta y_{i,t-j} ++ \sum_{j=0}^{Q-1} \psi_{ij}' \Delta x_{i,t-j} ++ \sum_{s=0}^{S} \tilde{\omega}_{is}' \bar{z}_{t-s} ++ e_{it} +$$ + +where the dynamic structure is controlled through `csdm_lr()` and the cross-sectional averages are supplied through `csdm_csa()`. + +**Key idea**: `cs_ardl` reports the implied short-run and long-run quantities from a cross-sectionally augmented ARDL fit. + +**Interpretation**: + +- \(\theta_i\) is the unit-specific long-run relationship +- \(\varphi_i\) is the implied speed of adjustment back toward equilibrium +- \(\psi_{ij}\) captures short-run effects of changes in regressors +- \(\tilde{\omega}_{is}\) captures the role of common cross-sectional components + +**Properties**: + +- supports heterogeneous short-run and long-run dynamics +- combines ARDL-style dynamics with cross-sectional augmentation +- recovers adjustment and long-run coefficients from estimated lag polynomials rather than fitting a separate ECM directly + +**Use case**: When the objective is to study long-run relationships together with heterogeneous short-run adjustment in panels affected by common factors. + +--- + +### Cross-Sectional Averages and Dynamic Structure + +Two helper specifications control the main extensions in `csdm()`: + +- `csdm_csa()` defines which variables enter as cross-sectional averages and how many lags of those averages are included +- `csdm_lr()` defines the dynamic or long-run structure, such as lagged dependent variables and distributed lags + +This design keeps the estimation interface consistent across the four estimators while allowing the model specification to vary by application. + +--- + +### Summary + +| Estimator | Heterogeneous Slopes | Cross-Sectional Averages | Dynamics | Long-Run Structure | +|-----------|----------------------|--------------------------|----------|--------------------| +| MG | Yes | No | No | No | +| CCE | Yes | Yes | No | No | +| DCCE | Yes | Yes | Yes | No | +| CS-ARDL | Yes | Yes | Yes | Yes | ## Package installation To install the `csdm` package from CRAN, run: @@ -239,15 +360,24 @@ In practice, models that do not account for cross-sectional dependence (like MG ## References -Chudik, A., & Pesaran, M. H. (2013). Common correlated effects estimation of heterogeneous dynamic panel data models with weakly exogenous regressors. *Journal of Business and Economic Statistics*, 33(2), 232–247. +Chudik, A., & Pesaran, M. H. (2013). Large panel data models with cross-sectional dependence: A survey [Globalization Institute Working Papers]. Federal Reserve Bank of Dallas, (153). + +Chudik, A., & Pesaran, M. H. (2015). Common correlated effects estimation of heterogeneous dynamic panel data models with weakly exogenous regressors. Journal of Econometrics, 188(2), 393–420. + +Ditzen, J. (2018). Estimating dynamic common-correlated effects in stata. The Stata Journal, 18(3), 585–617. https://doi.org/10.1177/1536867X1801800306 + +Fan, J., Liao, Y., & Yao, J. (2015). Power enhancement in high-dimensional cross-section tests. Econometrica, 83(4), 1497–1541. + +Juodis, A., & Reese, S. (2021). The incidental parameters problem in testing for remaining cross-sectional correlation. Journal of Business and Economic Statistics, 40(3), 1191–1203. -Ditzen, J. (2021). Estimating dynamic common-correlated effects in Stata. *The Stata Journal*, 21(1), 39–59. +Pesaran, M. H. (2006). Estimation and inference in large heterogeneous panels with multifactor error structure. Econometrica, 74(4), 967–1012. -Fan, J., Liao, Y., & Yao, J. (2015). Power-enhanced simultaneous test for high-dimensional covariance matrix. *Journal of the American Statistical Association*, 110(510), 325–337. +Pesaran, M. H. (2007). A simple unit root test in the presence of cross-section dependence. Journal of Applied Econometrics, 22(2), 265–312. -Juodis, A., & Reese, S. (2022). The role of the *N/T* ratio in large N, large T panel time-series models. *Econometric Reviews*, 41(2), 221–261. +Pesaran, M. H. (2015). Testing weak cross-sectional dependence in large panels. Econometric Reviews, 34(6-10), 1089–1117. -Pesaran, M. H. (2007). A simple unit root test in the presence of cross-section dependence. *Journal of Applied Econometrics*, 22(2), 265–312. +Pesaran, M. H. (2021). General diagnostic tests for cross-sectional dependence in panels. Empirical Economics, 60(1), 13–50. -Pesaran, M. H., & Xie, Y. (2021). A bias-adjusted LM test of error cross-section independence. *Econometric Reviews*, 40(1), 7–24. +Pesaran, M. H., & Smith, R. (1995). Estimating long-run relationships from dynamic heterogeneous panels. Journal of Econometrics, 68(1), 79–113. +Pesaran, M. H., & Xie, Y. (2021). A bias-corrected CD test for error cross-sectional dependence in panel models. Econometric Reviews, 41(6), 649–677. diff --git a/_pkgdown.yml b/_pkgdown.yml new file mode 100644 index 0000000..dc70839 --- /dev/null +++ b/_pkgdown.yml @@ -0,0 +1,13 @@ +url: ~ +template: + bootstrap: 5 + +navbar: + structure: + left: [home, reference, articles] + right: [github] + +home: + title: "csdm" + tagline: "Cross-sectional dependence modelling" + diff --git a/man/figures/logo.svg b/man/figures/logo.svg new file mode 100644 index 0000000..6bc16b8 --- /dev/null +++ b/man/figures/logo.svg @@ -0,0 +1,109 @@ + + + + + + + + + cs-ardl + cce + dcce + ccemg + cs-ardl + ccemg + dcce + + + + + + + + + + + + + + + + + + + + + + + + + csdm + + + + + + + + + + + + + + + + + + + + + + id + t + y + x + + + 1 + 1960 + + y(1,1960) + + + x(1,1960) + + + + 2 + 1980 + + y(2,1980) + + + x(2,1980) + + + + ... + ... + ... + ... + + + N + T + + y(N,T) + + + x(N,T) + + + + + + cross-sectional dependence modelling + + + \ No newline at end of file diff --git a/pkgdown/favicon/apple-touch-icon.png b/pkgdown/favicon/apple-touch-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..d92ba328668c9f78fa78cbf82d36b97968f49a01 GIT binary patch literal 3902 zcmZu!XHXMb(+*WSD$)(0UIpdSixMFOF%+pv6QpQB4ENGOkN`1=h7tlOgc?ain)C}? zB47ZeMF=G*AOu7NLYE#|z&ASYk8kFCXU;x*X3y@<&Y5#|_DQg{HWe0-5dZ)H!scez zZ?SdVFX7{5qd_mPCR_0bnmLC60D@w_gaeR+mjVDp*37RP*+0Usyu1^5%0aI4SlOS2 zvbG<9*TPXxU4^(Q=+sYQ!HQ1<;~>{l!(-6~mnmK$G<;!6}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+gVd!dBy^0lOso3>^cG zSRuxo)^Ig-h85kz)fhDnD5?5YZ?J$()(Kh0?>EZ)Q-g*q%NMkdiJ*OY8?pPQ6JaZv z2wSO}nKN+f-MR?eYBt#_89`QBRJN`dOjcS)wn|2pmG%7s2Y%nck#Or*wn`Way3Hi9 zpzBPwJ}_-GbkoaLS|{%VsJ(1u;ze#Im8~llla?5(PgV->=!K5mq~PRw?z5p zgz`U>7dp%AYkV7@-u1GYtr4#@7bZ-YFk!-k32QK^{SPSUBt@n!5ljF8002ovPDHLk FV1h&=gD3z1 literal 0 HcmV?d00001 diff --git a/pkgdown/favicon/favicon.ico b/pkgdown/favicon/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..00d6ebb02cbd4ff804655bddefb059706630cd36 GIT binary patch literal 15086 zcmeHOYiL|W6rQx&HurA2Nz*n>n!R`P+Ps=ayJ@rUyW2MJN9`k)P)UlSeF%c0wZ%S! zTE*5MQV>B9#EOW2^k>CC1r-EE^p7ZNiSMf50~8Ck9nYD~+)ifiZtiaGCRy#maAxM7 zIp;fP9(U%e?CVtq(c{|;;Fn+cEF zx{!7Rs!4HBD}ExRyM7Sy+093Ecy>w^5XD0NMSl$_Eqz85;=x)G;X%|mmC+FL@Z4<@Bo(c8*Ia1Uk z+V2#8*)LYU#=3Z2Dc#<*CKUtt7Jc8}u^#4s`tdI7nQ#0lz7yv1Kxef%e$w&f3;*on z$467g6d!MmY|QZSBaRn2pYQRrC(_EsM!NAM`<2b#>9rQe51+p>A1^N^|D%nVxQ`cu z|GA%L^FO}dqS8E-{g3ZLeE)KpNb}`?S+0z~ueAc!&1QxL-v?G}ObUKj|K|(;W4ogC z_`oJJotqdm^T!AL^!QL0JvTW-PYiZJJ(LAroT4vZgJ4`Mf9-=57rI%hkw z#XrmW9dRV;%PjYgvYl4tZ0yM8{Elbku%~#$DxS>FFSTnC${7`+_!T6zQ2APiEzEx=P+Zjec z!O8eJ+>w0}){5^3v3ZZ5i+0TQ{sQi6eqN~iigZrBAV6A$od#zd_^Atk4P`@821m7+ejFkNdxk+z87Ry(S zB%N|6>80gKN{Sf0M#w4TyGn?Tbczr+(#Hu|3iJjV2o%_Wkq}@b#3&rfadSJkU8bGf zZte#B=FR)h(A}l*y~;DNNBRaS zmgfmX5!_+k1L-sI{R{ca@IH75Ff7Rzj-b~SgYS>t23_ns9*jfDu_$={Zq%dnI*B2w zDV6Z;!1<6@`IFm>dhxDG){oEeT#4^S=o9Z;aQOY?_K>#X5s>*U*P9jfsz1WFEKeIc zS&=P{s8%urd)W80(g(I%@k5_{7}8w3?O-r!)eRBd^}2WtO88dMp5`^|?jswD?F2m6 zp z!nXbd#K7_XbKK~lXDoTgig&Bxy(rIPJ@SmlJLqIj@;-Guv5}%2!H2f>i*fKl z=zpB+7`GpSydV$aY{`4lVSf$d!8i)Wf_mW&+JIP=Cr^nSQ9-6dHx)!$ur%CKSMbJ9^3uDKj<^>L7wVwx6F%o93qcc zk8*O+-vf786VVoy_QSUvld%>^trYXT9%-_^C8eJ8pqyOv3vJjMmhn3rm}j^)*@*dP z^uN{n7h|~Dd{=}RjC%Ksu?e==djImZQQUuI`~E>c#C>I^e%yZqHP;?4+b*5+{!3S` zHW8agPlJh{`9$|Kkw%c5r@CF z%pLKlr{VndHJrbmjcD#N@%en^7wY`!q|Odf>Hc-_ugT z_IUW+p`7@>5P49SRr|iSD)F6czAHrijK^ksu^rE6YCjCPhkb6AMjA`$XmgoaHuJ!f z4*!m}b@agIYI>+!XH?E(8F{SQ^Zt|fj~q8rzOS_EKlEp&@q=xHy7FbZ@x%KALZ&O= zzX(SF$fc#36Y?N0w!yal0@t`y A>Hq)$ literal 0 HcmV?d00001 diff --git a/pkgdown/favicon/favicon.svg b/pkgdown/favicon/favicon.svg new file mode 100644 index 0000000..50bb121 --- /dev/null +++ b/pkgdown/favicon/favicon.svg @@ -0,0 +1,108 @@ + + + + + + + + cs-ardl + cce + dcce + ccemg + cs-ardl + ccemg + dcce + + + + + + + + + + + + + + + + + + + + + + + + + csdm + + + + + + + + + + + + + + + + + + + + + + id + t + y + x + + + 1 + 1960 + + y(1,1960) + + + x(1,1960) + + + + 2 + 1980 + + y(2,1980) + + + x(2,1980) + + + + ... + ... + ... + ... + + + N + T + + y(N,T) + + + x(N,T) + + + + + + cross-sectional dependence modelling + + + \ No newline at end of file diff --git a/pkgdown/favicon/site.webmanifest b/pkgdown/favicon/site.webmanifest new file mode 100644 index 0000000..4ebda26 --- /dev/null +++ b/pkgdown/favicon/site.webmanifest @@ -0,0 +1,21 @@ +{ + "name": "", + "short_name": "", + "icons": [ + { + "src": "/web-app-manifest-192x192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "/web-app-manifest-512x512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ], + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone" +} \ No newline at end of file diff --git a/pkgdown/favicon/web-app-manifest-192x192.png b/pkgdown/favicon/web-app-manifest-192x192.png new file mode 100644 index 0000000000000000000000000000000000000000..a2ce71fdb48071990882a661b5914fd9b47e66ba GIT binary patch literal 4161 zcmZ`+2T)T@yFLj4LN!Q75s;=J5RIW2k)ZV70MbK|CY=aKFG>LEQbYx*BE6%O0MY^i zQUnRoYv7YAT{;3cdhgtsJOBN6W}n@&=Xu_<`_8^I=ZVzTRAr*)p$7nfNnK4zhcXiX zbSMo4btau@DFdCW8rB^E7+C*w5Rj6_1pw!MsVgb!`J}CxIk~dWb8F`6S6+ZV$KOqu zdUYK7FMLAJSnr938b7BRSO`)#nrZY|g7Cc%%-*eR@9Y#R28uG4@XCul`eN)^gxFJE zzW>u>Cm(Tt?fywF;wuDt;597;NqF1Sl`&OWvzY9=FxgyLKXbf#y!OjXTI|nW|5Jl9 zeAFOa6k!%5BdYo$n3tv!ik|lVSp1zaWkL-k3W~t4y<|Jl#gfXpiZp|xyv%fVz8xU+ zKxB0#Q4SF`$4w-bu8qU;q~QMHe5+sn1AU9S7bmf1&&R z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8CTvo^DJzBus^un^Y!Zqc;JeyfHcr&UE}NCVwCSqgPURa2R@^f@Y$I6%3yxx+&W_;@FJFmX3*h;`rHP@GqwYDmmnw(N;s~;h4U6 zlb!!2f&@u9Rs5$*G(g(K^iyPFqIZ-HHLhHZHhz)zLlCi8^VdbICUriU=()!XmOdpg z1?KXbmM8(hnpRS{92>ze+>HI&SJ8NxS0y9ubI7dh=3)i>;OjS5`^V)WmLik?2xW&_p{gr3gaOlekwFn>;{m6?xcAx z0xJW>GwGR9kuP(N0h}$aLGetFYSAAQUov@&W-ig9rQ=EG@UiemRJ^>FOLQufN7fhb zVVyL$!tPpJgH;5*_=x6W40q17hF=T@#?X6<_Wc%(B}+0k%FQ4aG~|hWOJIm~n6+p( z!&~nD8^X$g<_6V@*rDbi7(c`}*qZ<9cxKKLUk}BqWH*E@2|bM|Svh-|Pz8zrF2}2; z?^c7=@NJXFs6J3!30B^ z0@ZD#3V`D^fi zPyIh%xA3@?+{&f}Gm1$eN_$>sZ>E?YDnem>-$9WU4pR)87~E>0HbI=fOCf$;hy|M< z67V=j@BZQsNF1%R?nH1PjF1-sOx#Scd&)$})1?UJyqf4uz8_L(>)hs{rOO&bX(rTx zOUv*MV3Eq>ynf{avJoIen;1zJXqbYd4zi9p!wf=48zd8TT+;6F&PGCFv{(w-JW%fnLgQ#ks&cfSYFRXu@ w()G=)ho9&jp&zvXUz=wBPqrEW@K=)lIg9NY)s2n`5%@z>SJqT2yK52rUp2+X6aWAK literal 0 HcmV?d00001 diff --git a/pkgdown/favicon/web-app-manifest-512x512.png b/pkgdown/favicon/web-app-manifest-512x512.png new file mode 100644 index 0000000000000000000000000000000000000000..2a6162b40aa3f25e87b5c3a88d189606342e573b GIT binary patch literal 11818 zcmeHtXH-*J*YF8JLPQ7yBE2{|z+eGI2uMj#$4XOBuuv2fl`bHigaHK^1r!TPi(^5M zs?tknf(jx^Riq;=LP80Fkn)}j&ht3mkMGaBzJDKUv2N};yPv)HIeXu8&C-0I=xVvu z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*^Qur;oXVXu z2+AI4g*r3ruk~zDzg^ch9DUGlI-SSc7d*0NGwUm+3kMY)O#U-E-&H!91h2R2j;Z80i*M_|SPCKR3=8}bcDFxt zQ6lsvEx3^1t?jz%!nZ?8_{*+jG>OWr>Y_Bx*bz84m?&#_`^bbM5=DiKOSK^2+Bqxa zw;Y0GI`79*W;V$Nync0|HT7QUHB{ner-)u9-o*ssnOOT@)3lFeT%< zXwY$J2BMFwyqmK)G-#E$Q-s;?P><`-Us|`rfofU#rgSKw*5P^~8qbPa27j)CKQA-N zPAY>xw&~hNTq-gKrFC77zctz_gKt{8w)fN6J=r+&C%A^b40#$_#mFh*n<5XgekSJ> z(ZkDt(g3M*Zh4GG?sB5L&t6&$FfML+(f9@Ke=g{j-$hf7T^BW Date: Mon, 23 Mar 2026 18:35:13 +0100 Subject: [PATCH 08/10] Refine mathematical expressions in README.md --- README.md | 63 +++++++++++++++++++------------------------------------ 1 file changed, 21 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 0d20edf..2f2c75c 100644 --- a/README.md +++ b/README.md @@ -13,22 +13,22 @@ This vignette demonstrates four core estimation methods and related inference to ### Model Specification -The `csdm()` interface estimates heterogeneous panel data models with optional cross-sectional augmentation and dynamic structure. Let \(i = 1, \ldots, N\) index cross-sectional units and \(t = 1, \ldots, T\) index time. A baseline heterogeneous panel model is +The `csdm()` interface estimates heterogeneous panel data models with optional cross-sectional augmentation and dynamic structure. A baseline heterogeneous panel model is: $$ y_{it} = \alpha_i + \beta_i' x_{it} + u_{it}, -\qquad i = 1, \ldots, N,\; t = 1, \ldots, T +\qquad i = 1, \ldots, N\; t = 1, \ldots, T $$ where: -- \(y_{it}\) is the outcome variable for unit \(i\) at time \(t\) -- \(\alpha_i\) is a unit-specific intercept -- \(\beta_i\) is a \((k \times 1)\) vector of unit-specific slopes -- \(x_{it}\) is a \((k \times 1)\) vector of explanatory variables -- \(u_{it}\) is the error term, which may exhibit cross-sectional dependence +- $y_{it}$ is the outcome variable for unit \(i\) at time \(t\) +- $\alpha_i$ is a unit-specific intercept +- $\beta_i$ is a \((k \times 1)\) vector of unit-specific slopes +- $x_{it}$ is a \((k \times 1)\) vector of explanatory variables +- $u_{it}$ is the error term, which may exhibit cross-sectional dependence -The inner product \(\beta_i' x_{it}\) is scalar-valued. Heterogeneous slopes allow each unit to respond differently to the regressors. In many applications, cross-sectional dependence arises because the error term contains unobserved common factors. The estimators implemented in `csdm()` differ in how they handle this dependence and whether they allow for dynamic adjustment. +The inner product $\beta_i' x_{it}$ is scalar-valued. Heterogeneous slopes allow each unit to respond differently to the regressors. In many applications, cross-sectional dependence arises because the error term contains unobserved common factors. The estimators implemented in `csdm()` differ in how they handle this dependence and whether they allow for dynamic adjustment. --- @@ -44,7 +44,7 @@ $$ **Interpretation**: -- \(\hat{\beta}_{MG}\) is the cross-sectional average of the unit-specific estimates +- $\hat{\beta}_{MG}$ is the cross-sectional average of the unit-specific estimates - all slope coefficients are allowed to differ across units **Properties**: @@ -79,8 +79,8 @@ $$ **Interpretation**: -- \(\beta_i\) measures the unit-specific effect conditional on the included cross-sectional averages -- \(\gamma_i\) captures unit-specific exposure to the common components proxied by \(\bar{z}_t\) +- $\beta_i$ measures the unit-specific effect conditional on the included cross-sectional averages +- $\gamma_i$ captures unit-specific exposure to the common components proxied by \(\bar{z}_t\) **Properties**: @@ -96,15 +96,7 @@ $$ The DCCE estimator extends CCE to dynamic settings by including lagged dependent variables, optional distributed lags of regressors, and lagged cross-sectional averages: -$$ -y_{it} -= -\alpha_i -+ \sum_{p=1}^{P} \phi_{ip} y_{i,t-p} -+ \sum_{q=0}^{Q} \beta_{iq}' x_{i,t-q} -+ \sum_{s=0}^{S} \delta_{is}' \bar{z}_{t-s} -+ e_{it} -$$ +$$ y_{it} = \alpha_i + \sum_{p=1}^{P} \phi_{ip} y_{i,t-p} + \sum_{q=0}^{Q} \beta_{iq}' x_{i,t-q} + \sum_{s=0}^{S} \delta_{is}' \bar{z}_{t-s} + e_{it} $$ where the dynamic structure is controlled through `csdm_lr()` and the cross-sectional averages and their lags are controlled through `csdm_csa()`. @@ -112,9 +104,9 @@ where the dynamic structure is controlled through `csdm_lr()` and the cross-sect **Interpretation**: -- \(\phi_{ip}\) captures unit-specific persistence -- \(\beta_{iq}\) captures contemporaneous and lagged effects of regressors -- \(\delta_{is}\) captures the effect of contemporaneous and lagged common components +- $\phi_{ip}$ captures unit-specific persistence +- $\beta_{iq}$ captures contemporaneous and lagged effects of regressors +- $\delta_{is}$ captures the effect of contemporaneous and lagged common components **Properties**: @@ -133,26 +125,13 @@ In the current `csdm()` implementation, `model = "cs_ardl"` is obtained by first The underlying unit-level regression is $$ -y_{it} -= -\alpha_i -+ \sum_{p=1}^{P} \phi_{ip} y_{i,t-p} -+ \sum_{q=0}^{Q} \beta_{iq}' x_{i,t-q} -+ \sum_{s=0}^{S} \omega_{is}' \bar{z}_{t-s} -+ e_{it} +y_{it} = \alpha_i + \sum_{p=1}^{P} \phi_{ip} y_{i,t-p} + \sum_{q=0}^{Q} \beta_{iq}' x_{i,t-q} + \sum_{s=0}^{S} \omega_{is}' \bar{z}_{t-s} + e_{it} $$ From this dynamic specification, the implied error-correction form is $$ -\Delta y_{it} -= -\alpha_i -+ \varphi_i \left( y_{i,t-1} - \theta_i' x_{i,t-1} \right) -+ \sum_{j=1}^{P-1} \lambda_{ij} \Delta y_{i,t-j} -+ \sum_{j=0}^{Q-1} \psi_{ij}' \Delta x_{i,t-j} -+ \sum_{s=0}^{S} \tilde{\omega}_{is}' \bar{z}_{t-s} -+ e_{it} +\Delta y_{it} = \alpha_i + \varphi_i \left( y_{i,t-1} - \theta_i' x_{i,t-1} \right) + \sum_{j=1}^{P-1} \lambda_{ij} \Delta y_{i,t-j} + \sum_{j=0}^{Q-1} \psi_{ij}' \Delta x_{i,t-j} + \sum_{s=0}^{S} \tilde{\omega}_{is}' \bar{z}_{t-s} + e_{it} $$ where the dynamic structure is controlled through `csdm_lr()` and the cross-sectional averages are supplied through `csdm_csa()`. @@ -161,10 +140,10 @@ where the dynamic structure is controlled through `csdm_lr()` and the cross-sect **Interpretation**: -- \(\theta_i\) is the unit-specific long-run relationship -- \(\varphi_i\) is the implied speed of adjustment back toward equilibrium -- \(\psi_{ij}\) captures short-run effects of changes in regressors -- \(\tilde{\omega}_{is}\) captures the role of common cross-sectional components +- $\theta_i$ is the unit-specific long-run relationship +- $\varphi_i$ is the implied speed of adjustment back toward equilibrium +- $\psi_{ij}$ captures short-run effects of changes in regressors +- $\tilde{\omega}_{is}$ captures the role of common cross-sectional components **Properties**: From 445bf2219ecddc466d19e66ad8d91f24420ec631 Mon Sep 17 00:00:00 2001 From: "Joao.Macosso" Date: Mon, 23 Mar 2026 19:49:56 +0100 Subject: [PATCH 09/10] Polish docs: pkgdown theme, refs, and vignette --- R/utils_cd.R | 4 +- README.md | 2 - _pkgdown.yml | 125 +++++++++++++++++++++++++++-- man/cd_test.Rd | 4 +- vignettes/introduction_to_csdm.Rmd | 9 ++- 5 files changed, 131 insertions(+), 13 deletions(-) diff --git a/R/utils_cd.R b/R/utils_cd.R index 384315f..ec66205 100644 --- a/R/utils_cd.R +++ b/R/utils_cd.R @@ -59,9 +59,9 @@ #' #' \insertRef{JuodisReese2021}{csdm} #' -#' \insertRef{FanLiaoYao2015b}{csdm} +#' \insertRef{FanLiaoYao2015}{csdm} #' -#' \insertRef{PesaranXie2021b}{csdm} +#' \insertRef{PesaranXie2021}{csdm} #' #' @examples #' # Simulate independent and dependent panels diff --git a/README.md b/README.md index 2f2c75c..6206866 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,6 @@ The `csdm` package implements econometric methods for panel data with cross-sectional dependence (CSD). In many applications, observations across units (e.g., countries, firms, regions) are not independent—macroeconomic shocks, trade relationships, or spillovers create correlation across cross-sectional units. The `csdm` package provides robust estimators that account for this dependence structure, plus diagnostic tests to detect and characterize it. -This vignette demonstrates four core estimation methods and related inference tools on real panel data from the Penn World Table (PWT). - ## Methodology: Four Estimators ### Model Specification diff --git a/_pkgdown.yml b/_pkgdown.yml index dc70839..259c401 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,13 +1,126 @@ -url: ~ template: bootstrap: 5 - -navbar: - structure: - left: [home, reference, articles] - right: [github] + bootswatch: flatly + bslib: + primary: "#0b1f3b" + secondary: "#1f3c88" + success: "#2c7fb8" + info: "#d0d8e8" + base_font: + google: "Inter" + heading_font: + google: "Inter" + code_font: + google: "Fira Code" home: title: "csdm" + description: > + Cross-sectional dependence modelling for heterogeneous panel data in R. tagline: "Cross-sectional dependence modelling" +url: https://macosso.github.io/csdm/ + +development: + mode: auto + +authors: + footer: + roles: [aut, cre] + sidebar: + roles: [aut, cre] + +navbar: + bg: primary + type: dark + structure: + left: [home, reference, articles, news] + right: [search, github] + components: + home: + text: "Home" + href: index.html + reference: + text: "Reference" + href: reference/index.html + articles: + text: "Articles" + menu: + - text: "Introduction to csdm" + href: articles/introduction_to_csdm.html + news: + text: "News" + href: news/index.html + github: + icon: fab fa-github + href: https://github.com/Macosso/csdm + aria-label: "GitHub repository" + +footer: + structure: + left: developed_by + right: built_with + components: + developed_by: "Developed by Joao Claudio Macosso" + built_with: "Built with pkgdown" + +reference: + - title: "Main modelling interface" + desc: > + Core user-facing functions for estimating heterogeneous panel models. + contents: + - csdm + - summary.csdm_fit + - print.summary.csdm_fit + - coef.csdm_fit + - fitted.csdm_fit + - residuals.csdm_fit + - vcov.csdm_fit + + - title: "Estimators" + desc: > + Estimation methods implemented in the package. + contents: + - cce_mean_group + - dynamic_cce + - dcce + - cs_ardl + - mg_estimator + - pmg_estimator + + - title: "Diagnostics and testing" + desc: > + Tools for cross-sectional dependence and related diagnostics. + contents: + - cd_test + - get_residuals + - starts_with("test_") + - starts_with("check_") + + - title: "Utilities" + desc: > + Supporting functions for extraction, formatting, and internal workflows. + contents: + - starts_with("get_") + - starts_with("as_") + - starts_with("plot_") + - starts_with("tidy_") + +articles: + - title: "Get started" + navbar: "Articles" + contents: + - introduction_to_csdm + +news: + one_page: true + +toc: + depth: 3 + +figures: + dev: ragg_png + dpi: 150 + fig.width: 7 + fig.height: 5 + fig.retina: 2 diff --git a/man/cd_test.Rd b/man/cd_test.Rd index 8775edc..263b444 100644 --- a/man/cd_test.Rd +++ b/man/cd_test.Rd @@ -142,7 +142,7 @@ cd_test(fit, type = "all") \insertRef{JuodisReese2021}{csdm} -\insertRef{FanLiaoYao2015b}{csdm} +\insertRef{FanLiaoYao2015}{csdm} -\insertRef{PesaranXie2021b}{csdm} +\insertRef{PesaranXie2021}{csdm} } diff --git a/vignettes/introduction_to_csdm.Rmd b/vignettes/introduction_to_csdm.Rmd index 0d37d99..52a44dd 100644 --- a/vignettes/introduction_to_csdm.Rmd +++ b/vignettes/introduction_to_csdm.Rmd @@ -2,7 +2,8 @@ title: "Introduction to csdm: Panel Data Models with Cross-Sectional Dependence" author: "Joao Claudio Macosso" date: "`r Sys.Date()`" -output: rmarkdown::html_vignette +output: + rmarkdown::html_vignette bibliography: "`r system.file('REFERENCES.bib', package = 'csdm')`" csl: "`r system.file('apa.csl', package = 'csdm')`" nocite: | @@ -13,6 +14,7 @@ vignette: > %\VignetteEncoding{UTF-8} --- + ```{r setup, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, @@ -20,9 +22,14 @@ knitr::opts_chunk$set( warning = FALSE, message = FALSE ) + library(csdm) ``` + + +--- + ## Overview The `csdm` package implements econometric methods for panel data with cross-sectional dependence (CSD). In many applications, observations across units (e.g., countries, firms, regions) are not independent—macroeconomic shocks, trade relationships, or spillovers create correlation across cross-sectional units. The `csdm` package provides robust estimators that account for this dependence structure, plus diagnostic tests to detect and characterize it. From 1b80faca3973c454127e6442c48780f87a12ef7e Mon Sep 17 00:00:00 2001 From: "Joao.Macosso" Date: Mon, 23 Mar 2026 21:50:03 +0100 Subject: [PATCH 10/10] Improve documentation, pkgdown, and references --- NEWS.md | 13 ++++ R/data.R | 6 +- README.md | 6 +- _pkgdown.yml | 108 +---------------------------- inst/REFERENCES.bib | 4 +- inst/WORDLIST | 4 ++ man/PWT_60_07.Rd | 6 +- vignettes/introduction_to_csdm.Rmd | 2 +- 8 files changed, 31 insertions(+), 118 deletions(-) diff --git a/NEWS.md b/NEWS.md index 01ec072..a5beb02 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,3 +11,16 @@ ### Inference and diagnostics - Cross-sectional dependence (CD) tests - Summary and printing methods + + +# csdm 1.0.1 + +## Documentation and References enhancement + +### References +- Added references for the implemented estimators and methods, including key papers and textbooks in the field + +### Documentation +- Improved documentation for all functions, including detailed descriptions of the estimators, their assumptions, and +- Ensured consistency in the documentation style across different documents +- Added link for reporting bugs diff --git a/R/data.R b/R/data.R index 238a3b3..8c5d3c5 100644 --- a/R/data.R +++ b/R/data.R @@ -1,13 +1,13 @@ -#' Penn World Tables panel (93 countries, 1960–2007) +#' Penn World Tables panel (93 countries, 1960-2007) #' -#' A panel of 93 countries (unit id) observed annually over 1960–2007 (time/year), +#' A panel of 93 countries (unit id) observed annually over 1960-2007 (time/year), #' with the log-transformed variables used in #' xtdcce2-style examples. #' #' @format A data frame with 4464 rows and 6 variables: #' \describe{ #' \item{id}{Unit identifier (country id).} -#' \item{year}{Time identifier (year, 1960–2007).} +#' \item{year}{Time identifier (year, 1960-2007).} #' \item{log_rgdpo}{Log real GDP (output).} #' \item{log_hc}{Log human capital index.} #' \item{log_ck}{Log capital stock.} diff --git a/README.md b/README.md index 6206866..d4c1e16 100644 --- a/README.md +++ b/README.md @@ -77,8 +77,8 @@ $$ **Interpretation**: -- $\beta_i$ measures the unit-specific effect conditional on the included cross-sectional averages -- $\gamma_i$ captures unit-specific exposure to the common components proxied by \(\bar{z}_t\) +- $\beta_i$ measures the unit-specific effect conditional on the included cross-sectional averages. +- $\gamma_i$ captures unit-specific exposure to the common components with \(\bar{z}_t\) as a proxy. **Properties**: @@ -341,7 +341,7 @@ Chudik, A., & Pesaran, M. H. (2013). Large panel data models with cross-sectiona Chudik, A., & Pesaran, M. H. (2015). Common correlated effects estimation of heterogeneous dynamic panel data models with weakly exogenous regressors. Journal of Econometrics, 188(2), 393–420. -Ditzen, J. (2018). Estimating dynamic common-correlated effects in stata. The Stata Journal, 18(3), 585–617. https://doi.org/10.1177/1536867X1801800306 +Ditzen, J. (2018). Estimating dynamic common-correlated effects in STATA. The STATA Journal, 18(3), 585–617. https://doi.org/10.1177/1536867X1801800306 Fan, J., Liao, Y., & Yao, J. (2015). Power enhancement in high-dimensional cross-section tests. Econometrica, 83(4), 1497–1541. diff --git a/_pkgdown.yml b/_pkgdown.yml index 259c401..20b8eaf 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -13,114 +13,10 @@ template: code_font: google: "Fira Code" -home: - title: "csdm" - description: > - Cross-sectional dependence modelling for heterogeneous panel data in R. - tagline: "Cross-sectional dependence modelling" - -url: https://macosso.github.io/csdm/ - -development: - mode: auto - -authors: - footer: - roles: [aut, cre] - sidebar: - roles: [aut, cre] - -navbar: - bg: primary - type: dark - structure: - left: [home, reference, articles, news] - right: [search, github] - components: - home: - text: "Home" - href: index.html - reference: - text: "Reference" - href: reference/index.html - articles: - text: "Articles" - menu: - - text: "Introduction to csdm" - href: articles/introduction_to_csdm.html - news: - text: "News" - href: news/index.html - github: - icon: fab fa-github - href: https://github.com/Macosso/csdm - aria-label: "GitHub repository" - footer: structure: left: developed_by right: built_with components: - developed_by: "Developed by Joao Claudio Macosso" - built_with: "Built with pkgdown" - -reference: - - title: "Main modelling interface" - desc: > - Core user-facing functions for estimating heterogeneous panel models. - contents: - - csdm - - summary.csdm_fit - - print.summary.csdm_fit - - coef.csdm_fit - - fitted.csdm_fit - - residuals.csdm_fit - - vcov.csdm_fit - - - title: "Estimators" - desc: > - Estimation methods implemented in the package. - contents: - - cce_mean_group - - dynamic_cce - - dcce - - cs_ardl - - mg_estimator - - pmg_estimator - - - title: "Diagnostics and testing" - desc: > - Tools for cross-sectional dependence and related diagnostics. - contents: - - cd_test - - get_residuals - - starts_with("test_") - - starts_with("check_") - - - title: "Utilities" - desc: > - Supporting functions for extraction, formatting, and internal workflows. - contents: - - starts_with("get_") - - starts_with("as_") - - starts_with("plot_") - - starts_with("tidy_") - -articles: - - title: "Get started" - navbar: "Articles" - contents: - - introduction_to_csdm - -news: - one_page: true - -toc: - depth: 3 - -figures: - dev: ragg_png - dpi: 150 - fig.width: 7 - fig.height: 5 - fig.retina: 2 + developed_by: "Developed by Joao Claudio Macosso" + built_with: "Built with pkgdown" diff --git a/inst/REFERENCES.bib b/inst/REFERENCES.bib index 6644bdf..e4c7d8a 100644 --- a/inst/REFERENCES.bib +++ b/inst/REFERENCES.bib @@ -39,8 +39,8 @@ @article{ChudikPesaran2013 @article{Ditzen2018, author = {Ditzen, Jan}, - title = {Estimating dynamic common-correlated effects in Stata}, - journal = {The Stata Journal}, + title = {Estimating dynamic common-correlated effects in STATA}, + journal = {The STATA Journal}, year = {2018}, volume = {18}, number = {3}, diff --git a/inst/WORDLIST b/inst/WORDLIST index 277410b..2aa5563 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -44,3 +44,7 @@ sectionally vcov wpn xtdcce +varphi +ip +iq +qquad diff --git a/man/PWT_60_07.Rd b/man/PWT_60_07.Rd index 2ada3cc..4b18e9c 100644 --- a/man/PWT_60_07.Rd +++ b/man/PWT_60_07.Rd @@ -3,12 +3,12 @@ \docType{data} \name{PWT_60_07} \alias{PWT_60_07} -\title{Penn World Tables panel (93 countries, 1960–2007)} +\title{Penn World Tables panel (93 countries, 1960-2007)} \format{ A data frame with 4464 rows and 6 variables: \describe{ \item{id}{Unit identifier (country id).} -\item{year}{Time identifier (year, 1960–2007).} +\item{year}{Time identifier (year, 1960-2007).} \item{log_rgdpo}{Log real GDP (output).} \item{log_hc}{Log human capital index.} \item{log_ck}{Log capital stock.} @@ -23,7 +23,7 @@ panel for examples and tests. PWT_60_07 } \description{ -A panel of 93 countries (unit id) observed annually over 1960–2007 (time/year), +A panel of 93 countries (unit id) observed annually over 1960-2007 (time/year), with the log-transformed variables used in xtdcce2-style examples. } diff --git a/vignettes/introduction_to_csdm.Rmd b/vignettes/introduction_to_csdm.Rmd index 52a44dd..4e086d6 100644 --- a/vignettes/introduction_to_csdm.Rmd +++ b/vignettes/introduction_to_csdm.Rmd @@ -107,7 +107,7 @@ $$ **Interpretation**: - \(\beta_i\) measures the unit-specific effect conditional on the included cross-sectional averages -- \(\gamma_i\) captures unit-specific exposure to the common components proxied by \(\bar{z}_t\) +- \(\gamma_i\) captures unit-specific exposure to the common components with \(\bar{z}_t\) as a proxy. **Properties**: