grouped_tv_plm {PAGFL} | R Documentation |
Grouped Time-varying Panel Data Model
Description
Estimate a grouped time-varying panel data model given an observed group structure. Coefficient functions are homogeneous within groups but heterogeneous across groups. The time-varying coefficients are modeled as polynomial B-splines. The function supports both static and dynamic panel data models.
Usage
grouped_tv_plm(
formula,
data,
groups,
index = NULL,
n_periods = NULL,
d = 3,
M = floor(length(y)^(1/7) - log(p)),
const_coef = NULL,
rho = 0.04 * log(N * n_periods)/sqrt(N * n_periods),
verbose = TRUE,
parallel = TRUE,
...
)
## S3 method for class 'tv_gplm'
summary(object, ...)
## S3 method for class 'tv_gplm'
formula(x, ...)
## S3 method for class 'tv_gplm'
df.residual(object, ...)
## S3 method for class 'tv_gplm'
print(x, ...)
## S3 method for class 'tv_gplm'
coef(object, ...)
## S3 method for class 'tv_gplm'
residuals(object, ...)
## S3 method for class 'tv_gplm'
fitted(object, ...)
Arguments
formula |
a formula object describing the model to be estimated. |
data |
a |
groups |
a numerical or character vector of length |
index |
a character vector holding two strings. The first string denotes the name of the index variable identifying the cross-sectional unit |
n_periods |
the number of observed time periods |
d |
the polynomial degree of the B-splines. Default is 3. |
M |
the number of interior knots of the B-splines. If left unspecified, the default heuristic |
const_coef |
a character vector containing the variable names of explanatory variables that enter with time-constant coefficients. |
rho |
the tuning parameter balancing the fitness and penalty terms in the IC. If left unspecified, the heuristic |
verbose |
logical. If |
parallel |
logical. If |
... |
ellipsis |
object |
of class |
x |
of class |
Details
Consider the grouped time-varying panel data model
where is the scalar dependent variable,
is an individual fixed effect,
is a
vector of explanatory variables, and
is a zero mean error.
The coefficient vector
is subject to the observed group pattern
with ,
and
for any
,
.
and, in turn,
is estimated as polynomial B-splines using the penalized sieve-technique. To this end, let
denote a
vector of polynomial spline basis functions, where
represents the polynomial degree and
gives the number of interior knots of the B-spline.
is approximated by forming a linear combination of the basis functions
, where
is a
coefficient matrix.
The explanatory variables are projected onto the spline basis system, which results in the vector
. Subsequently, the DGP can be reformulated as
where if
,
, and
reflects a sieve approximation error. We refer to Su et al. (2019, sec. 2) for more details on the sieve technique.
Finally, is obtained as
, where the vector of control points
is estimated using OLS
and ,
to concentrate out the fixed effect
(within-transformation).
In case of an unbalanced panel data set, the earliest and latest available observations per group define the start and end-points of the interval on which the group-specific time-varying coefficients are defined.
Value
An object of class tv_gplm
holding
model |
a |
coefficients |
let |
groups |
a |
residuals |
a vector of residuals of the demeaned model, |
fitted |
a vector of fitted values of the demeaned model, |
args |
a |
IC |
a |
call |
the function call. |
An object of class tv_gplm
has print
, summary
, fitted
, residuals
, formula
, df.residual
and coef
S3 methods.
Author(s)
Paul Haimerl
References
Su, L., Wang, X., & Jin, S. (2019). Sieve estimation of time-varying panel data models with latent structures. Journal of Business & Economic Statistics, 37(2), 334-349. doi:10.1080/07350015.2017.1340299.
Examples
# Simulate a time-varying panel with a trend and a group pattern
set.seed(1)
sim <- sim_tv_DGP(N = 10, n_periods = 50, intercept = TRUE, p = 2)
df <- data.frame(y = c(sim$y))
groups <- sim$groups
# Estimate the time-varying grouped panel data model
estim <- grouped_tv_plm(y ~ ., data = df, n_periods = 50, groups = groups)
summary(estim)