| Title: | Panel Unit Root Test Based on Recursive Detrending |
|---|---|
| Description: | Implements the recursively detrended panel unit root tests proposed by Westerlund (2015) <doi:10.1016/j.jeconom.2014.09.013>. Two variants are provided: the basic t-REC test assuming iid errors, and the robust t-RREC test that accounts for serial correlation, cross-sectional dependence, and heteroskedasticity via defactoring and BIC-selected lag augmentation. Both tests have a standard normal null distribution requiring no mean or variance correction. The panel must be strongly balanced. |
| Authors: | Muhammad Alkhalaf [aut, cre, cph] (ORCID: <https://orcid.org/0009-0002-2677-9246>) |
| Maintainer: | Muhammad Alkhalaf <[email protected]> |
| License: | GPL-3 |
| Version: | 1.0.0 |
| Built: | 2026-06-05 10:42:29 UTC |
| Source: | https://github.com/muhammedalkhalaf/xtrec |
A balanced panel dataset for 5 large US corporations over 20 years (1935-1954).
grunfeld_data()grunfeld_data()
A data frame with columns: firm, year, invest, mvalue.
Grunfeld, Y. (1958). The Determinants of Corporate Investment. PhD thesis, University of Chicago.
dat <- grunfeld_data() head(dat)dat <- grunfeld_data() head(dat)
Prints a formatted summary of an "xtrec" test result.
## S3 method for class 'xtrec' print(x, ...)## S3 method for class 'xtrec' print(x, ...)
x |
An object of class |
... |
Additional arguments (ignored). |
Invisibly returns x.
Prints a summary of an "xtrec" test result.
## S3 method for class 'xtrec' summary(object, ...)## S3 method for class 'xtrec' summary(object, ...)
object |
An object of class |
... |
Additional arguments (ignored). |
Invisibly returns object.
Implements the t-REC and t-RREC panel unit root tests of Westerlund (2015). The t-REC assumes iid errors; the robust t-RREC accounts for serial correlation, cross-sectional dependence, and heteroskedasticity.
xtrec(data, var, panel_id, time_id, trend = 0L, robust = FALSE, maxlag = -1L)xtrec(data, var, panel_id, time_id, trend = 0L, robust = FALSE, maxlag = -1L)
data |
A data frame in long format. |
var |
Character. Name of the variable to test. |
panel_id |
Character. Name of the panel identifier variable. |
time_id |
Character. Name of the time variable. |
trend |
Integer. Polynomial trend degree: |
robust |
Logical. If |
maxlag |
Integer. Maximum lag for BIC selection (-1 for automatic). |
An object of class "xtrec" containing the test statistic, p-value,
and panel summary statistics.
Westerlund, J. (2015). The effect of recursive detrending on panel unit root tests. Journal of Econometrics, 185(2), 453-467. doi:10.1016/j.jeconom.2014.09.013
dat <- grunfeld_data() res <- xtrec(dat, var = "invest", panel_id = "firm", time_id = "year", trend = 0L, robust = FALSE) print(res)dat <- grunfeld_data() res <- xtrec(dat, var = "invest", panel_id = "firm", time_id = "year", trend = 0L, robust = FALSE) print(res)