Analysis of Metafrontier Models for Efficiency and Productivity
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).
efficiencies(fit, estimator = ) switches
without refittingid =, and explicit accounting of
cross-period infeasibilitiescheck_convergence(), with convergence status reported in
print() and summary()plot() with four plot types: TGR distributions,
efficiency scatter, frontier decomposition, and frontier comparisonggplot2 integration via autoplot() methods
for metafrontier, Malmquist, and bootstrap resultssfaR,
frontier, and Benchmarking via
as_metafrontier_model(), or delegate group estimation
directly with
engine = c("internal", "sfaR", "frontier", "Benchmarking")y ~ x1 + x2 | z1 + z2)print, summary,
coef, vcov, logLik,
fitted, residuals, nobs,
confint, predict, plot;
coef() and vcov() expose auxiliary parameters
(e.g. eta, variance parameters) via
extraPar = TRUEInstall the development version from GitHub:
# install.packages("devtools")
devtools::install_github("iik1/metafrontier")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)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)# 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)# 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)# Base R
plot(fit_det, which = "tgr")
plot(fit_det, which = "decomposition")
# ggplot2
library(ggplot2)
autoplot(fit_det)
autoplot(boot)
autoplot(malm)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))The package includes three vignettes:
browseVignettes("metafrontier")GPL (>= 3)