simulate_panel_metafrontier: Simulate Panel Metafrontier Data

View source: R/simulate.R

simulate_panel_metafrontierR Documentation

Simulate Panel Metafrontier Data

Description

Generates a simulated panel dataset with known metafrontier parameters for Monte Carlo studies and testing. Implements the Battese-Coelli 1992 DGP with time-varying inefficiency.

Usage

simulate_panel_metafrontier(
  n_groups = 2,
  n_firms_per_group = 30,
  n_periods = 5,
  beta_meta = c(1, 0.5, 0.3),
  tech_gap = NULL,
  sigma_u = 0.3,
  sigma_v = 0.2,
  eta = 0.05,
  seed = NULL,
  attrition = 0
)

Arguments

n_groups

integer. Number of technology groups.

n_firms_per_group

integer. Number of firms per group.

n_periods

integer. Number of time periods.

beta_meta

numeric vector. Metafrontier coefficients.

tech_gap

numeric vector of group technology gaps.

sigma_u

numeric. Standard deviation of the firm effect.

sigma_v

numeric. Standard deviation of noise.

eta

numeric. Time-decay parameter for BC92.

seed

integer or NULL. Random seed.

attrition

numeric in [0, 0.5]. Probability that each firm-period observation after a firm's first period is dropped independently, producing an unbalanced panel. Every firm's first period is always kept, so all firms remain in the data. The attrition draws are made after all other random numbers, so attrition = 0 (the default) reproduces legacy balanced datasets exactly for the same seed. The realised share of at-risk observations dropped is stored in params$attrition_share.

Value

A list with components:

data

data frame with columns: firm, year, group, log_y, log_x1, log_x2, true_te, true_u, true_v

params

list of true parameter values used in generation, including attrition and the realised attrition_share

Examples

sim <- simulate_panel_metafrontier(
  n_groups = 2, n_firms_per_group = 20,
  n_periods = 5, seed = 42
)
head(sim$data)
str(sim$params)

# An unbalanced panel with roughly 20% attrition
sim_unbal <- simulate_panel_metafrontier(seed = 42, attrition = 0.2)
table(table(sim_unbal$data$firm))


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