| Title: | Bootstrap Slope Heterogeneity Test for Panel Data |
|---|---|
| Description: | Implements the bootstrap slope heterogeneity test for panel data based on Blomquist and Westerlund (2015) <doi:10.1007/s00181-015-0978-z>. Tests the null hypothesis that slope coefficients are homogeneous across cross-sectional units. Provides both standard and adjusted Delta statistics with bootstrap p-values. Supports partialling out of control variables and cross-sectional averages for dealing with cross-sectional dependence. |
| Authors: | Muhammad Alkhalaf [aut, cre, cph] (ORCID: <https://orcid.org/0009-0002-2677-9246>), Tore Bersvendsen [ctb], Jan Ditzen [ctb] |
| Maintainer: | Muhammad Alkhalaf <[email protected]> |
| License: | GPL-3 |
| Version: | 1.0.1 |
| Built: | 2026-06-02 08:53:17 UTC |
| Source: | https://github.com/muhammedalkhalaf/xtbhst |
Produces diagnostic plots for the bootstrap slope heterogeneity test.
## S3 method for class 'xtbhst' plot(x, which = c(1L, 2L), ask = NULL, ...)## S3 method for class 'xtbhst' plot(x, which = c(1L, 2L), ask = NULL, ...)
x |
An object of class |
which |
Integer vector specifying which plots to produce:
1 = Bootstrap distribution of Delta,
2 = Bootstrap distribution of adjusted Delta,
3+ = Individual coefficient distributions.
Default is |
ask |
Logical. If |
... |
Additional arguments passed to plotting functions. |
Invisibly returns NULL.
Print method for xtbhst objects
## S3 method for class 'xtbhst' print(x, digits = 4L, ...)## S3 method for class 'xtbhst' print(x, digits = 4L, ...)
x |
An object of class |
digits |
Number of digits to display (default: 4). |
... |
Additional arguments (ignored). |
Invisibly returns the input object.
Summary method for xtbhst objects
## S3 method for class 'xtbhst' summary(object, digits = 4L, ...)## S3 method for class 'xtbhst' summary(object, digits = 4L, ...)
object |
An object of class |
digits |
Number of digits to display (default: 4). |
... |
Additional arguments (ignored). |
Invisibly returns a list with summary statistics.
Implements the bootstrap slope heterogeneity test based on Blomquist and Westerlund (2015). Tests the null hypothesis that slope coefficients are homogeneous across cross-sectional units.
xtbhst( formula, data, id, time, reps = 999L, blocklength = NULL, partial = NULL, csa = NULL, csa_lags = 0L, constant = TRUE, seed = NULL )xtbhst( formula, data, id, time, reps = 999L, blocklength = NULL, partial = NULL, csa = NULL, csa_lags = 0L, constant = TRUE, seed = NULL )
formula |
A formula of the form |
data |
A data frame containing the panel data. |
id |
A character string specifying the name of the cross-sectional identifier variable. |
time |
A character string specifying the name of the time variable. |
reps |
Integer. Number of bootstrap replications (default: 999). |
blocklength |
Integer. Block length for the block bootstrap. If
|
partial |
Optional formula specifying variables to be partialled out.
For example, |
csa |
Optional formula specifying variables for which cross-sectional averages should be computed and included. Used to handle cross-sectional dependence following Pesaran (2006). |
csa_lags |
Integer. Number of lags of the cross-sectional averages to include (default: 0). |
constant |
Logical. If |
seed |
Optional integer seed for reproducibility. |
The test is based on the following Delta statistic:
where is a weighted sum of squared deviations of
individual slope estimates from the weighted pooled estimate.
The adjusted Delta statistic corrects for small sample bias:
where .
Under the null hypothesis of slope homogeneity, both statistics are asymptotically standard normal. The bootstrap procedure provides finite-sample p-values.
The function requires a strongly balanced panel (all units observed for all time periods).
An object of class "xtbhst" containing:
The Delta test statistic.
The adjusted Delta test statistic.
Bootstrap p-value for the Delta statistic.
Bootstrap p-value for the adjusted Delta statistic.
The block length used in the bootstrap.
Number of bootstrap replications.
Number of cross-sectional units.
Number of time periods.
Number of regressors.
Matrix of individual slope estimates (N x K).
Vector of weighted fixed effects (pooled) estimates.
Vector of bootstrap Delta statistics.
Vector of bootstrap adjusted Delta statistics.
The matched call.
Blomquist, J., & Westerlund, J. (2015). Panel bootstrap tests of slope homogeneity. Empirical Economics, 48(1), 1191-1204. doi:10.1007/s00181-015-0978-z
Pesaran, M. H. (2006). Estimation and inference in large heterogeneous panels with a multifactor error structure. Econometrica, 74(4), 967-1012. doi:10.1111/j.1468-0262.2006.00692.x
# Generate example panel data set.seed(123) N <- 20 # cross-sectional units T_periods <- 30 # time periods # Homogeneous slopes (H0 is true) data_hom <- data.frame( id = rep(1:N, each = T_periods), time = rep(1:T_periods, N), x = rnorm(N * T_periods) ) data_hom$y <- 1 + 0.5 * data_hom$x + rnorm(N * T_periods) # Test for slope heterogeneity result <- xtbhst(y ~ x, data = data_hom, id = "id", time = "time", reps = 199, seed = 42) print(result) summary(result)# Generate example panel data set.seed(123) N <- 20 # cross-sectional units T_periods <- 30 # time periods # Homogeneous slopes (H0 is true) data_hom <- data.frame( id = rep(1:N, each = T_periods), time = rep(1:T_periods, N), x = rnorm(N * T_periods) ) data_hom$y <- 1 + 0.5 * data_hom$x + rnorm(N * T_periods) # Test for slope heterogeneity result <- xtbhst(y ~ x, data = data_hom, id = "id", time = "time", reps = 199, seed = 42) print(result) summary(result)