latent_class_metafrontier: Latent Class Metafrontier

View source: R/latent_class.R

latent_class_metafrontierR Documentation

Latent Class Metafrontier

Description

Estimates a metafrontier model where group membership is unobserved, using an EM algorithm to jointly estimate class membership probabilities, class-specific frontier parameters, and the metafrontier.

Usage

latent_class_metafrontier(
  formula,
  data,
  n_classes = 2,
  dist = c("hnormal", "tnormal", "exponential"),
  meta_type = c("deterministic", "stochastic"),
  n_starts = 10,
  max_iter = 200,
  tol = 1e-06,
  seed = NULL,
  control = list(),
  ...
)

Arguments

formula

a Formula object (y ~ x1 + x2).

data

a data frame.

n_classes

integer. Number of latent classes (default 2).

dist

distribution of the inefficiency term.

meta_type

metafrontier type for Stage 2.

n_starts

integer. Number of random initializations (default 10). The best is selected by log-likelihood.

max_iter

integer. Maximum EM iterations (default 200).

tol

numeric. Convergence tolerance on marginal LL (default 1e-6).

seed

optional integer seed.

control

list of control parameters for the optimiser.

...

additional arguments.

Details

Latent class estimation is available for SFA-based metafrontiers only: the EM posterior class probabilities require a parametric observation-level likelihood, which DEA does not provide. For DEA fits with observed groups, see poolability_test.

The EM algorithm iterates between:

  • E-step: compute posterior class membership probabilities for each observation using Bayes' rule

  • M-step: update class-specific frontier parameters via weighted MLE, and update class proportions

Multiple random starts (n_starts) are used to avoid local optima. The run with the highest marginal log-likelihood is selected. After convergence, observations are assigned to classes via MAP (maximum a posteriori), and a standard metafrontier is fitted on the MAP classes.

Value

An object of class "lc_metafrontier" containing:

class_assignment

MAP class assignment per observation

posterior

n x C matrix of posterior probabilities

pi

class mixing proportions

class_params

list of class-specific parameter vectors

class_models

list of class-specific model summaries

metafrontier

the fitted metafrontier object on MAP classes

marginal_ll

marginal log-likelihood at convergence

BIC

Bayesian Information Criterion

n_classes

number of classes

n_iter

number of EM iterations used

Examples


sim <- simulate_metafrontier(n_groups = 2, n_per_group = 80, seed = 42)
lc <- latent_class_metafrontier(
  log_y ~ log_x1 + log_x2,
  data = sim$data, n_classes = 2, n_starts = 3, seed = 123
)
print(lc)
summary(lc)
coef(lc, which = "meta")
efficiencies(lc, type = "tgr")



metafrontier documentation built on Aug. 19, 2026, 5:08 p.m.