# pmpp v0.1.0

Monthly downloads

## Posterior Mean Panel Predictor

Dynamic panel modelling framework based on an empirical-Bayes approach.
Contains tools for computing point forecasts and bootstrapping prediction intervals.
Reference: Liu et al. (2016) <doi:10.2139/ssrn.2889000>.

## Readme

# 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, bootReps = 20, confidence = 0.95)
```

## Functions in pmpp

Name | Description | |

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 | |

pmpp | Posterior Mean Panel Predictor for dynamic panel modelling | |

get_lambda0 | Produce sufficient statistics (lambda0) given the common coefficients (rho0) | |

pmpp_data | Transform a single variable in the matrix format into the long panel format | |

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

plot.pmpp | Plot method for objects of class pmpp. | |

predict.pmpp | Compute forecasts with a PMPP model | |

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

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

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

kde | One-dimensional kernel density estimate | |

pmpp_predinterval | Random-Window Block Bootstrap for prediction intervals for PMPP model | |

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

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. | |

loglikelihood_GMM | Produce negative log-likelihood in the GMM case | |

No Results! |

## Last month downloads

## Details

Type | Package |

Date | 2018-09-23 |

URL | https://github.com/veneficusnl/pmpp |

BugReports | https://github.com/veneficusnl/pmpp/issues |

License | GPL (>= 2) |

Encoding | UTF-8 |

LazyData | true |

RoxygenNote | 6.1.0 |

NeedsCompilation | no |

Packaged | 2018-10-01 21:09:02 UTC; Asus |

Repository | CRAN |

Date/Publication | 2018-10-12 13:50:09 UTC |

#### Include our badge in your README

```
[![Rdoc](http://www.rdocumentation.org/badges/version/pmpp)](http://www.rdocumentation.org/packages/pmpp)
```