| Title: | Copula Based Stochastic Frontier Quantile Model |
|---|---|
| Description: | Estimation of a copula-based stochastic frontier quantile model using simulated likelihood methods. |
| Authors: | Dr. Woraphon Yamaka |
| Maintainer: | Dr. Woraphon Yamaka <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.0 |
| Built: | 2026-06-03 09:53:18 UTC |
| Source: | https://github.com/woraphonyamaka/copulasqm |
Estimates a copula-based stochastic frontier quantile model using simulated maximum likelihood.
Dependence between the two-sided noise component and the one-sided inefficiency component
is captured via a bivariate copula from the VineCopula package.
copSQM(Y, X, family, tau, RHO, LB, UB, RHO2 = NULL, LB2 = NULL, UB2 = NULL, nSim = 50, seed = NULL, maxit = 10000)copSQM(Y, X, family, tau, RHO, LB, UB, RHO2 = NULL, LB2 = NULL, UB2 = NULL, nSim = 50, seed = NULL, maxit = 10000)
Y |
A numeric vector of dependent variable observations. |
X |
A numeric matrix (or object coercible to a matrix) of explanatory variables. The intercept is added internally. |
family |
Integer specifying the bivariate copula family (see |
tau |
Quantile level in |
RHO |
Initial value of the first copula parameter (passed to |
LB |
Lower bound for the first copula parameter |
UB |
Upper bound for the first copula parameter |
RHO2 |
Optional initial value of the second copula parameter (passed to |
LB2 |
Optional lower bound for the second copula parameter |
UB2 |
Optional upper bound for the second copula parameter |
nSim |
Number of Monte Carlo draws used to approximate the likelihood integral for each observation. Larger values improve accuracy but increase computation time. |
seed |
Optional integer seed for reproducibility of the simulation draws used in the likelihood.
If |
maxit |
Maximum number of iterations for the optimizer ( |
The model follows the stochastic frontier decomposition
where is a two-sided noise term and is the inefficiency term.
Both components are modeled using the asymmetric Laplace distribution (ALD) at quantile level tau,
with truncated to .
Dependence between and is introduced through a bivariate copula density
from the VineCopula package. The log-likelihood is evaluated by
simulating draws of from the truncated ALD and approximating the likelihood integral by
Monte Carlo averaging (nSim draws per observation).
When a two-parameter copula family is used, RHO2 must be provided along with bounds
LB2 and UB2.
A list with components:
result |
A matrix of parameter estimates, standard errors, z-values, and p-values. |
AIC |
Akaike Information Criterion. |
BIC |
Bayesian Information Criterion. |
Loglikelihood |
Maximized log-likelihood value. |
convergence |
Convergence code returned by |
Woraphon Yamaka, Paravee Maneejuk and Nuttaphong Kaewtathip
Pipitpojanakarn, V., Maneejuk, P., Yamaka, W., & Sriboonchitta, S. (2016). Analysis of agricultural production in Asia and measurement of technical efficiency using copula-based stochastic frontier quantile model. In International Symposium on Integrated Uncertainty in Knowledge Modelling and Decision Making (pp. 701–714). Springer.
Pipitpojanakarn, V., Yamaka, W., Sriboonchitta, S., & Maneejuk, P. (2017). Frontier Quantile Model Using a Generalized Class of Skewed Distributions. Advanced Science Letters, 23(11), 10737–10742.
set.seed(123) sim_data <- sfa_simu_quantile( n = 50, beta = c(1, 0.5, -0.3), sigV = 1, sigU = 1, tau = 0.5, family = 1, rho = 0.3, seed = 123 ) model <- copSQM( Y = sim_data$Y, X = sim_data$X, family = 1, tau = 0.5, RHO = 0.3, LB = -0.99, UB = 0.99, nSim = 50, seed = 123 ) model ## Example with a two-parameter copula (e.g., Student-t: family = 2) ## Here RHO2 typically represents degrees of freedom and must be bounded. model_t <- copSQM( Y = sim_data$Y, X = sim_data$X, family = 2, tau = 0.5, RHO = 0.3, LB = -0.99, UB = 0.99, RHO2 = 4, LB2 = 2.01, UB2 = 50, nSim = 50, seed = 123 ) model_tset.seed(123) sim_data <- sfa_simu_quantile( n = 50, beta = c(1, 0.5, -0.3), sigV = 1, sigU = 1, tau = 0.5, family = 1, rho = 0.3, seed = 123 ) model <- copSQM( Y = sim_data$Y, X = sim_data$X, family = 1, tau = 0.5, RHO = 0.3, LB = -0.99, UB = 0.99, nSim = 50, seed = 123 ) model ## Example with a two-parameter copula (e.g., Student-t: family = 2) ## Here RHO2 typically represents degrees of freedom and must be bounded. model_t <- copSQM( Y = sim_data$Y, X = sim_data$X, family = 2, tau = 0.5, RHO = 0.3, LB = -0.99, UB = 0.99, RHO2 = 4, LB2 = 2.01, UB2 = 50, nSim = 50, seed = 123 ) model_t
Generates simulated data from a copula-based stochastic frontier quantile model with asymmetric Laplace noise and a truncated asymmetric Laplace inefficiency term.
sfa_simu_quantile(n, beta, sigV, sigU, tau = 0.5, family = 1, rho = 0.5, rho2 = NULL, seed = NULL)sfa_simu_quantile(n, beta, sigV, sigU, tau = 0.5, family = 1, rho = 0.5, rho2 = NULL, seed = NULL)
n |
Integer. Number of observations to simulate. |
beta |
Numeric vector of regression coefficients including an intercept.
Its length must match the number of regressors plus one (intercept).
This simulator generates two regressors, so |
sigV |
Positive numeric value. Scale parameter of the two-sided noise term |
sigU |
Positive numeric value. Scale parameter of the one-sided inefficiency term |
tau |
Quantile level in |
family |
Integer specifying the bivariate copula family (see |
rho |
First copula parameter (passed to |
rho2 |
Optional second copula parameter (passed to |
seed |
Optional integer seed for reproducibility. If |
This function simulates data from the stochastic frontier model:
where:
follows an asymmetric Laplace distribution (ALD) with location ,
scale sigV, and quantile level tau.
is a non-negative inefficiency term generated from an ALD distribution
with location , scale sigU, and quantile level tau, truncated to .
Dependence between and is introduced via a bivariate copula
using VineCopula::BiCopSim.
The simulator constructs two regressors internally (denoted and ).
A list containing:
Y |
Numeric vector of simulated dependent variable values. |
X |
Matrix of simulated independent variables (without intercept column). |
V |
Simulated two-sided noise term. |
U |
Simulated non-negative inefficiency term. |
copula_uniforms |
The simulated dependent uniforms from the copula (two columns). |
Woraphon Yamaka, Paravee Maneejuk and Nuttaphong Kaewtathip
Koenker, R. (2005). Quantile Regression. Cambridge University Press.
Joe, H. (2014). Dependence Modeling with Copulas. Chapman & Hall/CRC.
sim_data <- sfa_simu_quantile( n = 100, beta = c(1, 0.5, -0.3), sigV = 1, sigU = 1, tau = 0.5, family = 1, rho = 0.3, seed = 123 ) str(sim_data)sim_data <- sfa_simu_quantile( n = 100, beta = c(1, 0.5, -0.3), sigV = 1, sigU = 1, tau = 0.5, family = 1, rho = 0.3, seed = 123 ) str(sim_data)
Computes technical efficiency for a copula-based stochastic frontier quantile model using simulation-based conditional expectations.
TE(theta, Y, X, family, tau, nSim = 200, rho2 = NULL, seed = NULL, plot = FALSE)TE(theta, Y, X, family, tau, nSim = 200, rho2 = NULL, seed = NULL, plot = FALSE)
theta |
Numeric vector of estimated model parameters. The expected ordering is:
regression coefficients (including intercept), |
Y |
Numeric vector of dependent variable observations. |
X |
Numeric matrix (or object coercible to a matrix) of independent variables (without intercept column). |
family |
Integer specifying the copula family (see |
tau |
Quantile level in |
nSim |
Number of Monte Carlo draws used to approximate the conditional expectation. Larger values reduce simulation noise but increase computation time. |
rho2 |
Optional second copula parameter. If |
seed |
Optional integer seed for reproducibility in simulation-based computation.
If |
plot |
Logical. If |
Technical efficiency is computed as a simulated conditional expectation:
where and the weights are constructed using the
asymmetric Laplace density for the noise term and the copula density capturing dependence
between the inefficiency component and the noise component.
The inefficiency term is generated from a truncated asymmetric Laplace distribution
on .
If plot = TRUE, the function produces a line plot of sorted technical efficiency values.
A numeric vector of technical efficiency values (one per observation).
Woraphon Yamaka, Paravee Maneejuk, and Nuttaphong Kaewtathip
Pipitpojanakarn, V., Maneejuk, P., Yamaka, W., & Sriboonchitta, S. (2016). Analysis of agricultural production in Asia and measurement of technical efficiency using copula-based stochastic frontier quantile model. In International Symposium on Integrated Uncertainty in Knowledge Modelling and Decision Making (pp. 701–714). Springer.
sim_data <- sfa_simu_quantile( n = 100, beta = c(1, 0.5, -0.3), sigV = 1, sigU = 1, tau = 0.5, family = 1, rho = 0.3, seed = 123 ) model <- copSQM( Y = sim_data$Y, X = sim_data$X, family = 1, tau = 0.5, RHO = 0.3, LB = -0.99, UB = 0.99, nSim = 50, seed = 123 ) te_values <- TE( theta = model$result[, "Estimate"], Y = sim_data$Y, X = sim_data$X, family = 1, tau = 0.5, nSim = 200, seed = 123, plot = TRUE ) head(te_values)sim_data <- sfa_simu_quantile( n = 100, beta = c(1, 0.5, -0.3), sigV = 1, sigU = 1, tau = 0.5, family = 1, rho = 0.3, seed = 123 ) model <- copSQM( Y = sim_data$Y, X = sim_data$X, family = 1, tau = 0.5, RHO = 0.3, LB = -0.99, UB = 0.99, nSim = 50, seed = 123 ) te_values <- TE( theta = model$result[, "Estimate"], Y = sim_data$Y, X = sim_data$X, family = 1, tau = 0.5, nSim = 200, seed = 123, plot = TRUE ) head(te_values)