| Type: | Package |
| Title: | Panel Unit Root Test Based on Recursive Detrending |
| Version: | 1.0.0 |
| 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. |
| License: | GPL-3 |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.2 |
| Depends: | R (≥ 3.5.0) |
| Imports: | stats |
| Suggests: | testthat (≥ 3.0.0) |
| Config/testthat/edition: | 3 |
| URL: | https://github.com/muhammedalkhalaf/xtrec |
| BugReports: | https://github.com/muhammedalkhalaf/xtrec/issues |
| NeedsCompilation: | no |
| Packaged: | 2026-03-24 14:52:43 UTC; acad_ |
| Author: | Muhammad Alkhalaf |
| Maintainer: | Muhammad Alkhalaf <muhammedalkhalaf@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-03-29 15:20:02 UTC |
Grunfeld Investment Data
Description
A balanced panel dataset for 5 large US corporations over 20 years (1935-1954).
Usage
grunfeld_data()
Value
A data frame with columns: firm, year, invest, mvalue.
References
Grunfeld, Y. (1958). The Determinants of Corporate Investment. PhD thesis, University of Chicago.
Examples
dat <- grunfeld_data()
head(dat)
Print Method for xtrec Objects
Description
Prints a formatted summary of an "xtrec" test result.
Usage
## S3 method for class 'xtrec'
print(x, ...)
Arguments
x |
An object of class |
... |
Additional arguments (ignored). |
Value
Invisibly returns x.
Summary Method for xtrec Objects
Description
Prints a summary of an "xtrec" test result.
Usage
## S3 method for class 'xtrec'
summary(object, ...)
Arguments
object |
An object of class |
... |
Additional arguments (ignored). |
Value
Invisibly returns object.
Panel Unit Root Test Based on Recursive Detrending
Description
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.
Usage
xtrec(data, var, panel_id, time_id, trend = 0L,
robust = FALSE, maxlag = -1L)
Arguments
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). |
Value
An object of class "xtrec" containing the test statistic, p-value,
and panel summary statistics.
References
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
Examples
dat <- grunfeld_data()
res <- xtrec(dat, var = "invest", panel_id = "firm",
time_id = "year", trend = 0L, robust = FALSE)
print(res)