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
y_{it} = \gamma_i + \beta^\prime_{i} (t/T) x_{it} + \epsilon_{it}, \quad i = 1, \dots, N, \; t = 1, \dots, T,
where y_{it}
is the scalar dependent variable, \gamma_i
is an individual fixed effect, x_{it}
is a p \times 1
vector of explanatory variables, and \epsilon_{it}
is a zero mean error.
The coefficient vector \beta_{i} (t/T)
is subject to the observed group pattern
\beta_i \left(\frac{t}{T} \right) = \sum_{k = 1}^K \alpha_k \left( \frac{t}{T} \right) \bold{1} \{i \in G_k \},
with \cup_{k = 1}^K G_k = \{1, \dots, N\}
, G_k \cap G_j = \emptyset
and \| \alpha_k - \alpha_j \| \neq 0
for any k \neq j
, k = 1, \dots, K
.
\alpha_k (t/T)
and, in turn, \beta_i (t/T)
is estimated as polynomial B-splines using the penalized sieve-technique. To this end, let B(v)
denote a M + d +1
vector of polynomial spline basis functions, where d
represents the polynomial degree and M
gives the number of interior knots of the B-spline.
\alpha_{k}(t/T)
is approximated by forming a linear combination of the basis functions \alpha_{k}(t/T) \approx \xi_k^\prime B(t/T)
, where \xi_k
is a (M + d + 1) \times p
coefficient matrix.
The explanatory variables are projected onto the spline basis system, which results in the (M + d + 1)p \times 1
vector z_{it} = x_{it} \otimes B(v)
. Subsequently, the DGP can be reformulated as
y_{it} = \gamma_i + z_{it}^\prime \text{vec}(\pi_{i}) + u_{it},
where \pi_i = \xi_k
if i \in G_k
, u_{it} = \epsilon_{it} + \eta_{it}
, and \eta_{it}
reflects a sieve approximation error. We refer to Su et al. (2019, sec. 2) for more details on the sieve technique.
Finally, \hat{\alpha}_{k}(t/T)
is obtained as \hat{\alpha}_{k}(t/T) = \hat{\xi}_k^\prime B(t/T)
, where the vector of control points \xi_k
is estimated using OLS
\hat{\xi}_k = \left( \sum_{i \in G_k} \sum_{t = 1}^T \tilde{z}_{it} \tilde{z}_{it}^\prime \right)^{-1} \sum_{i \in G_k} \sum_{t = 1}^T \tilde{z}_{it} \tilde{y}_{it},
and \tilde{a}_{it} = a_{it} - T^{-1} \sum_{t = 1}^T a_{it}
, a = \{y, z\}
to concentrate out the fixed effect \gamma_i
(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)