Analysis of Metafrontier Models for Efficiency and Productivity

Implements metafrontier production function models for estimating technical efficiencies and technology gaps for groups of firms that face different restrictions of a common underlying metatechnology (group-specific technologies in the sense of Battese, Rao, and O'Donnell, 2004). Supports both stochastic frontier analysis (SFA) and data envelopment analysis (DEA) based metafrontiers. Includes the deterministic metafrontier of Battese, Rao, and O'Donnell (2004) , the stochastic metafrontier of Huang, Huang, and Liu (2014) , and the metafrontier Malmquist productivity index of O'Donnell, Rao, and Battese (2008) . The deterministic metafrontier can be identified by either the minimum sum of absolute deviations (LP) or the minimum sum of squared deviations (QP) criterion. Additional features include panel SFA with time-varying inefficiency, bootstrap confidence intervals for technology gap ratios, a DEA poolability permutation test, latent class metafrontier estimation via the EM algorithm, Murphy-Topel corrected standard errors, convergence diagnostics, import of pre-fitted models from external estimation engines ('sfaR', 'frontier', 'Benchmarking'), and 'ggplot2' visualisation methods.


metafrontier

Analysis of Metafrontier Models for Efficiency and Productivity

Overview

metafrontier provides a unified R implementation of metafrontier production function models for estimating technical efficiencies and technology gaps across groups of firms that face different restrictions of a common underlying metatechnology (group-specific technologies in the sense of Battese, Rao & O'Donnell, 2004).

Estimation methods

  • Deterministic metafrontier (Battese, Rao & O'Donnell, 2004) identified by minimum sum of absolute deviations (LP, default) or minimum sum of squared deviations (QP)
  • Stochastic metafrontier (Huang, Huang & Liu, 2014) via second-stage SFA with Murphy-Topel corrected standard errors
  • DEA-based metafrontier with CRS, VRS, DRS, IRS, and FDH technology assumptions
  • Latent class metafrontier via EM algorithm with BIC-based class selection
  • Efficiency estimators: BC88 (default) and JLMS, both stored so efficiencies(fit, estimator = ) switches without refitting

Productivity analysis

  • Metafrontier Malmquist TFP index (O'Donnell, Rao & Battese, 2008) with three-way decomposition (TEC x TGC x TC*), firm matching via id =, and explicit accounting of cross-period infeasibilities
  • Panel SFA with time-varying inefficiency (BC92 and BC95 specifications), including unbalanced panels
  • Directional distance functions for DEA-based efficiency measurement, including hyperbolic orientation, custom numeric direction vectors, and two-stage slack computation

Inference and diagnostics

  • Bootstrap confidence intervals for TGR (parametric and nonparametric; percentile and BCa)
  • Murphy-Topel variance correction for stochastic metafrontier standard errors
  • Poolability tests for common vs group-specific frontiers: likelihood ratio (SFA) and a permutation test (DEA)
  • Convergence diagnostics via check_convergence(), with convergence status reported in print() and summary()
  • Half-normal, exponential, and truncated-normal inefficiency distributions

Visualisation

  • Base R plot() with four plot types: TGR distributions, efficiency scatter, frontier decomposition, and frontier comparison
  • ggplot2 integration via autoplot() methods for metafrontier, Malmquist, and bootstrap results

Interoperability

  • Import pre-fitted models from sfaR, frontier, and Benchmarking via as_metafrontier_model(), or delegate group estimation directly with engine = c("internal", "sfaR", "frontier", "Benchmarking")
  • Formula interface with heteroscedastic SFA support (y ~ x1 + x2 | z1 + z2)
  • Full S3 method suite: print, summary, coef, vcov, logLik, fitted, residuals, nobs, confint, predict, plot; coef() and vcov() expose auxiliary parameters (e.g. eta, variance parameters) via extraPar = TRUE

Installation

Install the development version from GitHub:

# install.packages("devtools")
devtools::install_github("iik1/metafrontier")

Quick start

library(metafrontier)

# Simulate metafrontier data with two technology groups
sim <- simulate_metafrontier(n_groups = 2, n_per_group = 200, seed = 42)

# Estimate a deterministic SFA-based metafrontier
fit_det <- metafrontier(log_y ~ log_x1 + log_x2,
                        data = sim$data, group = "group")

# Estimate a stochastic metafrontier (with Murphy-Topel SEs)
fit_sto <- metafrontier(log_y ~ log_x1 + log_x2,
                        data = sim$data, group = "group",
                        meta_type = "stochastic")

# DEA-based metafrontier (requires level-scale inputs/outputs)
dat_lev <- within(sim$data, { y <- exp(log_y); x1 <- exp(log_x1); x2 <- exp(log_x2) })
fit_dea <- metafrontier(y ~ x1 + x2,
                        data = dat_lev, group = "group",
                        method = "dea", rts = "vrs")

# Inspect results
summary(fit_det)
tgr_summary(fit_det)
confint(fit_det)

Bootstrap confidence intervals

boot <- boot_tgr(fit_det, R = 999, seed = 1)
confint(boot)

# Parallel bootstrap
boot_par <- boot_tgr(fit_det, R = 999, ncores = 4, seed = 1)

Malmquist productivity index

# Simulate panel data
panel <- simulate_panel_metafrontier(n_groups = 3, n_firms_per_group = 50,
                                     n_periods = 5, seed = 42)

# Three-way Malmquist decomposition
malm <- malmquist_meta(log_y ~ log_x1 + log_x2,
                       data = panel$data, group = "group",
                       time = "year")
summary(malm)

Latent class metafrontier

# Automatic class selection via BIC (discovers groups endogenously)
lc <- latent_class_metafrontier(log_y ~ log_x1 + log_x2,
                                data = sim$data,
                                n_classes = 3)
summary(lc)

Visualisation

# Base R
plot(fit_det, which = "tgr")
plot(fit_det, which = "decomposition")

# ggplot2
library(ggplot2)
autoplot(fit_det)
autoplot(boot)
autoplot(malm)

Using pre-fitted models

library(sfaR)

# Fit group-specific SFA models externally
sfa_g1 <- sfacross(log_y ~ log_x1 + log_x2,
                   data = subset(sim$data, group == "G1"))
sfa_g2 <- sfacross(log_y ~ log_x1 + log_x2,
                   data = subset(sim$data, group == "G2"))

# Pass to metafrontier
fit <- metafrontier(models = list(G1 = sfa_g1, G2 = sfa_g2))

Vignettes

The package includes three vignettes:

  • Introduction to metafrontier -- end-to-end walkthrough covering estimation, inference, bootstrap CIs, panel SFA, latent class, and directional distance functions
  • Metafrontier Malmquist Productivity Index -- panel data productivity decomposition with worked examples
  • Metafrontier Methods: Theory and Computation -- mathematical details, comparison of deterministic/stochastic/DEA approaches, and Monte Carlo evidence
browseVignettes("metafrontier")

References

  • Battese, G.E., Rao, D.S.P. and O'Donnell, C.J. (2004). A metafrontier production function for estimation of technical efficiencies and technology gaps for firms operating under different technologies. Journal of Productivity Analysis, 21(1), 91--103. doi:10.1023/B:PROD.0000012454.06094.29
  • Huang, C.J., Huang, T.-H. and Liu, N.-H. (2014). A new approach to estimating the metafrontier production function based on a stochastic frontier framework. Journal of Productivity Analysis, 42(3), 241--254. doi:10.1007/s11123-014-0402-2
  • O'Donnell, C.J., Rao, D.S.P. and Battese, G.E. (2008). Metafrontier frameworks for the study of firm-level efficiencies and technology ratios. Empirical Economics, 34(2), 231--255. doi:10.1007/s00181-007-0119-4

License

GPL (>= 3)

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("metafrontier")

0.3.1 by Erik Enstad, 2 months ago


https://github.com/iik1/metafrontier


Report a bug at https://github.com/iik1/metafrontier/issues


Browse source code at https://github.com/cran/metafrontier


Authors: Erik Enstad [aut, cre]


Documentation:   PDF Manual  


GPL (>= 3) license


Imports stats, graphics, grDevices, Formula, numDeriv, lpSolveAPI, methods

Suggests testthat, knitr, rmarkdown, sfaR, frontier, Benchmarking, quadprog, plm, ggplot2, parallel


See at CRAN