xtrec: Panel Unit Root Test Based on Recursive Detrending

View source: R/xtrec.R

xtrecR Documentation

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: 0 (constant only), 1 (linear trend), or 2 (quadratic trend).

robust

Logical. If TRUE, compute the robust t-RREC test.

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. \Sexpr[results=rd]{tools:::Rd_expr_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)

xtrec documentation built on March 29, 2026, 5:07 p.m.

Related to xtrec in xtrec...