MyNixOS website logo
Description

Bootstrap Slope Heterogeneity Test for Panel Data.

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.

xtbhst: Bootstrap Slope Heterogeneity Test for Panel Data

CRAN status

Overview

xtbhst implements the bootstrap slope heterogeneity test for panel data based on Blomquist and Westerlund (2015). The test examines whether slope coefficients are homogeneous across cross-sectional units.

Reference: Blomquist, J., & Westerlund, J. (2015). Panel bootstrap tests of slope homogeneity. Empirical Economics, 48(1), 1191-1204. doi:10.1007/s00181-015-0978-z

Installation

# Install from CRAN (when available)
install.packages("xtbhst")

# Or install development version from GitHub
# install.packages("devtools")

Usage

Basic Example

library(xtbhst)

# Generate panel data with homogeneous slopes
set.seed(123)
N <- 20   # cross-sectional units
T <- 30   # time periods

data <- data.frame(
  id = rep(1:N, each = T),
  time = rep(1:T, N),
  x = rnorm(N * T)
)
data$y <- 1 + 0.5 * data$x + rnorm(N * T)

# Test for slope heterogeneity
result <- xtbhst(y ~ x, data = data, id = "id", time = "time",
                 reps = 999, seed = 42)
print(result)

Output:

Bootstrap test for slope heterogeneity
(Blomquist & Westerlund, 2015. Empirical Economics)
H0: slope coefficients are homogeneous
---------------------------------------------
         Delta      BS p-value
       -1.2345        0.8900
adj.   -1.3456        0.8700
---------------------------------------------
Bootstrap replications: 999 
Block length: 6 
Panel: N = 20 , T = 30 , K = 1 

With Control Variables

# Partial out control variables
data$z <- rnorm(N * T)
result <- xtbhst(y ~ x, data = data, id = "id", time = "time",
                 partial = ~ z, reps = 999)

Handling Cross-Sectional Dependence

# Include cross-sectional averages (Pesaran, 2006)
result <- xtbhst(y ~ x, data = data, id = "id", time = "time",
                 csa = ~ x, csa_lags = 2, reps = 999)

Diagnostic Plots

# Plot bootstrap distributions
plot(result)

# Plot all diagnostics including individual slopes
plot(result, which = 1:4)

Interpretation

  • Null hypothesis (H0): Slope coefficients are homogeneous across all cross-sectional units
  • Alternative (H1): Slopes differ across units

If the p-value is small (e.g., < 0.05), reject H0 and conclude there is evidence of slope heterogeneity. This suggests that pooled OLS or standard fixed effects estimators may be inappropriate, and heterogeneous coefficient models (e.g., mean group estimator) should be considered.

Requirements

  • Strongly balanced panel (all units observed for all time periods)
  • At least one regressor beyond the constant

Citation

If you use this package, please cite:

Blomquist, J., & Westerlund, J. (2015). Panel bootstrap tests of slope 
homogeneity. Empirical Economics, 48(1), 1191-1204.
https://doi.org/10.1007/s00181-015-0978-z

License

GPL (>= 3)

Author

R port based on the Stata implementation xtbhst, which was modified from xthst by Tore Bersvendsen and Jan Ditzen.

Metadata

Version

1.0.1

License

Unknown

Platforms (78)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows