Learn R Programming

pmpp (version 0.1.1)

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

Description

Produces prediction intervals for Posterior Mean Panel Predictor model by means of resampling with replacement from model's residuals. Block Bootstrap method takes into account heteroskedasticity of the error terms, both across units and over time. Block window is chosen randomly.

Usage

pmpp_predinterval(model, fframe, boot_reps = 1000, block_size = NULL,
  confidence = 0.95, iter = NULL)

Arguments

model

PMPP model, as returned by pmpp()

fframe

data.frame with the same columns as input data to model, but with empty rows added to each cross-sectional unit, as created by create_fframe()

boot_reps

integer; number of bootstrap replications

block_size

integer; width of the re-sampled block of residuals

confidence

numeric in (0,1); confidence level of the interval

iter

iterating constant, to be used in a loop when extraction from call is needed

Value

A data.frame with panel indices, lower and upper bounds and midpoint.

References

Oleszak, M. (2018). "Forecasting sales with micro-panels: Empirical Bayes approach. Evidence from consumer goods sector.", Erasmus University Thesis Repository

Examples

Run this code
# NOT RUN {
data(EmplUK, package = "plm")
EmplUK <- dplyr::filter(EmplUK, year %in% c(1978, 1979, 1980, 1981, 1982))
pmpp_model <- pmpp(dep_var = "emp", data = EmplUK)
my_fframe <- create_fframe(EmplUK, 1983:1985)
intervals <- pmpp_predinterval(pmpp_model, my_fframe, boot_reps = 10)
# }

Run the code above in your browser using DataLab