Learn R Programming

What is the Posterior Mean Panel Predictor?

Accurate predictions with micro-panels

Micro-panels are longitudinal data sets that contain observations on multiple units at only a few points in time. Examples include the performance of start-up companies, developmental skills of small children or revenues and leverage of banks after significant regulatory changes. When working with micro-panels, it is challenging to build accurate predictive models, as the time series are too short to contain enough information on their own.

Posterior Mean Panel Predictor (PMPP) takes an empirical-Bayes approach to computing forecasts with micro-panels. It uses cross-sectional information in the data to approximate the posterior mean of heterogeneous coefficients under a correlated random effects distribution. It has been shown to provide predictions of higher accuracy compared to the state-of-the-art methods for dynamic panel modelling. For more details, see the references in pmpp() function manual.

Package features

The package allows for the following:

  • Estimate the parameters of the PMPP model,
  • Use the model to compute point forecasts,
  • Compute prediction intervals with the Random-Window Block Bootstrap.

Additionally, the package exports a number of functions that can be used outside of the scope of PMPP modelling:

  • kde() for computing a robust kernel density estimate;
  • kde2D() for computing a robust 2-dimensional kernel density estimate;
  • create_fframe() for adding time periods to a panel-structured data frame;
  • ssys_gmm(), the suboptimal multi-step System-GMM estimator for AR(1) panel data model.

How to use

The central function in the package is pmpp(). It estimates the model's coefficients and outputs an object of class pmpp. This class has the plot and summary methods, with the former plotting the distribution of individual-specific effects and the latter allowing to inspect model's coeffcients and fit measures.

To compute predictions with the PMPP model, one needs to construct the forecast frame with create_fframe(). The forecast frame and the corresponding model object can be passed along to the predict method to obtain forecasts.

In order to calculate prediction intervals, the pmpp_predinterval() function can be used. This function, similarly to the predict method, takes the model object and the forecast frame as inputs. Be warned: bootstrapping of prediction interval might take time!

Usage example

# Get data
data(EmplUK, package = "plm")
EmplUK <- dplyr::filter(EmplUK, year %in% c(1978, 1979, 1980, 1981, 1982))

# Run the model predicting employment
pmpp_model <- pmpp(dep_var = "emp", data = EmplUK)
summary(pmpp_model)

# Compute predictions for following three years
my_fframe <- create_fframe(EmplUK, 1983:1985)
prediction <- predict(pmpp_model, my_fframe)

# Compute prediction intervals
intervals <- pmpp_predinterval(pmpp_model, my_fframe, boot_reps = 20, confidence = 0.95)

Copy Link

Version

Install

install.packages('pmpp')

Monthly Downloads

23

Version

0.1.1

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

October 15th, 2019

Functions in pmpp (0.1.1)

predict.pmpp

Compute forecasts with a PMPP model
plot.pmpp

Plot method for objects of class pmpp.
ssys_gmm

Suboptimal multi-step System-GMM estimator for AR(1) panel data model
pmpp_data

Transform a single variable in the matrix format into the long panel format
pmpp

Posterior Mean Panel Predictor for dynamic panel modelling
pmpp_predinterval

Random-Window Block Bootstrap for prediction intervals for PMPP model
post_mean_lambda_par

Provide posterior means of lambda_i's based on the Parametric Posterior Mean estimator with correlated random coefficients
summary.pmpp

Summary method for objects of class pmpp.
kde2D

Compute a two-dimensional kernel density estimate
get_kernel

Obtain 2D kernel density estimates given sufficient statistics for lambdas and the initial data Y0
get_sigma2

Produce variance of the shocks estimated using GMM residues (sigma2_0) given the common coefficients (rho0)
create_fframe

Add empty rows with time stamps to each cress-sectional unit in the panel
loglikelihood_GMM

Produce negative log-likelihood in the GMM case
get_lambda0

Produce sufficient statistics (lambda0) given the common coefficients (rho0)
kde

One-dimensional kernel density estimate
GMM_parametric

Produce posterior means of lambda's for the parametric GMM implementation given autoregressive coefficient (rho)
loglikelihood_QMLE

Produce (negative) log marginal likelihood for QMLE with correlated random coefficients