| Title: | Semiparametric Smooth-Coefficient Stochastic Frontier Analysis |
|---|---|
| Description: | Provides semiparametric smooth-coefficient stochastic frontier analysis following Sun and Kumbhakar (2013) <doi:10.1016/j.econlet.2013.05.001> where the coefficients of the parametric part vary smoothly with a set of nonparametric variables. Inefficiency term is allowed to depend on a set of determinants through heteroskedasticity. Smooth coefficients are estimated using nonparametric regression and the remaining frontier parameters are estimated by maximum likelihood. Technical efficiency and inefficiency are computed using the Battese and Coelli (1988) <doi:10.1016/0304-4076(88)90053-X> and Jondrow et al. (1982) <doi:10.1016/0304-4076(82)90004-5> methods, respectively. Confidence intervals for technical efficiency are computed using the approach of Horrace and Schmidt (1996) <doi:10.1007/BF00157044>. |
| Authors: | Kai Sun [aut, cre] |
| Maintainer: | Kai Sun <[email protected]> |
| License: | AGPL (>= 3) |
| Version: | 0.1.0 |
| Built: | 2026-09-30 10:59:03 UTC |
| Source: | https://github.com/cran/spscsfa |
Extract JLMS inefficiency estimates
inefficiency(x)inefficiency(x)
x |
An object of class 'spsc_sfa'. |
A numeric vector of JLMS conditional inefficiency estimates.
Print SPSC-SFA results
## S3 method for class 'spsc_sfa' print(x, ...)## S3 method for class 'spsc_sfa' print(x, ...)
x |
An object of class 'spsc_sfa'. |
... |
Additional arguments (currently ignored). |
The original object of class "spsc_sfa", returned invisibly to avoid duplicate printing
after printing its summary. The returned object is a list containing the
components smooth_coefficients, mle_results, technical_efficiency,
inefficiency, model_summary, formula_parsed, and data_info.
These components contain the estimated smooth coefficients and recovered
intercept, maximum-likelihood results, technical-efficiency estimates and
confidence intervals, JLMS inefficiency estimates, model-specification
information, parsed formula components, and data-cleaning information.
Data used to illustrate the application of the semiparametric smooth-coefficient stochastic frontier model.
data(ricephil)data(ricephil)
A data frame with 344 observations and 17 variables.
Timothy J. Coelli, D.S. Prasada Rao, Christopher J. O'Donnell, and George E. Battese (2005). An Introduction to Efficiency and Productivity Analysis. Springer, New York.
S. Pandey, P. Masciat, L. Velasco, and R. Villano (1999). Risk analysis of a rainfed rice production system in Tarlac, Central Luzon, Philippines. Experimental Agriculture, 35(2), 225–237.
Extract smooth coefficients
smooth_coef(x)smooth_coef(x)
x |
An object of class 'spsc_sfa'. |
The estimated smooth-coefficient matrix.
Estimates a semiparametric smooth-coefficient stochastic frontier model
following Sun and Kumbhakar (2013). The model allows the coefficients of the
parametric part to vary smoothly with a set of nonparametric variables.
Technical efficiency and inefficiency are computed using the Battese and
Coelli (1988) and Jondrow et al. (1982) methods, respectively.
Confidence intervals for technical efficiency are computed using the
approach of Horrace and Schmidt (1996).
spsc_sfa( formula, data = NULL, ezdat = NULL, sig_level = 0.05, optim_method = "optim_BFGS", optim_control = list(maxit = 5000), stval = "automatic", bandwidth = NULL, penalty = 1e+08, verbose = TRUE )spsc_sfa( formula, data = NULL, ezdat = NULL, sig_level = 0.05, optim_method = "optim_BFGS", optim_control = list(maxit = 5000), stval = "automatic", bandwidth = NULL, penalty = 1e+08, verbose = TRUE )
formula |
A formula of the form |
data |
Optional data frame containing all variables used in |
ezdat |
Optional data frame containing evaluation points for the
non-parametric variables |
sig_level |
Significance level for confidence intervals of technical efficiency (default 0.05). |
optim_method |
Character string specifying the optimizer:
|
optim_control |
List of control parameters passed to the optimizer. |
stval |
Starting values for the MLE. Use |
bandwidth |
Optional bandwidth object (either from |
penalty |
To ensure positivity of estimated |
verbose |
Logical; if |
The stochastic production frontier model is specified as
where can be viewed as the log of output, can be viewed as a
vector of the log of inputs, and is a vector of covariates.
is the intercept, and is the slope vector.
Both and are unknown functions of .
The noise term .
The inefficiency term is , where
.
The random variables and are assumed to be independent of
each other and independent of and .
To guarantee positivity of ,
These imply that
and
The estimation involves two steps. In the first step, estimate
(Intercept (theta)), , and
from
where
and
Then in the second step, use the estimated to estimate
, and from
Finally, compute
from estimated and . The intercept in the original
stochastic production frontier
(Intercept (alpha)) is recovered as
See Sun and Kumbhakar (2013, page 306) for more details.
An object of class "spsc_sfa" containing smooth coefficients, MLE
results, technical efficiency, JLMS inefficiency, model summary, data
information, and the parsed formula.
A list of class "spsc_sfa" containing:
smooth_coefficients |
Smooth coefficient estimates, residuals, bandwidth, and metadata. |
mle_results |
MLE parameter estimates, standard errors, and log-likelihood. |
technical_efficiency |
Technical efficiency scores (BC method) and confidence intervals. |
inefficiency |
Inefficiency estimates (JLMS method). |
model_summary |
Summary information about the model specification. |
formula_parsed |
Parsed formula components. |
data_info |
Information about data cleaning and observations used. |
Results can be summarized using summary.spsc_sfa.
Extraction functions for smooth coefficients, technical efficiency and
inefficiency are available through smooth_coef,
te, and inefficiency.
Kai Sun <[email protected]>
George E. Battese and Tim J. Coelli (1988). Prediction of firm-level technical efficiencies with a generalized frontier production function and panel data. Journal of Econometrics, 38(3), 387–399.
William C. Horrace and Peter Schmidt (1996). Confidence statements for efficiency estimates from stochastic frontier models. Journal of Productivity Analysis, 7(2), 257–282.
James Jondrow, C.A. Knox Lovell, Ivan S. Materov, and Peter Schmidt (1982). On the estimation of technical inefficiency in the stochastic frontier production function model. Journal of Econometrics, 19(2–3), 233–238.
Kai Sun and Subal C. Kumbhakar (2013). Semiparametric smooth-coefficient stochastic frontier model. Economics Letters, 120(2), 305–309.
set.seed(1) n <- 100 x <- rnorm(n) z <- runif(n) ez <- seq(0, 1, length = 1000) q <- rnorm(n) y <- cos(z) + sin(z) * x + rnorm(n, 0, 0.1) - exp(0.1 + 0.1 * z) * abs(rnorm(n, 0, 1)) dat <- data.frame(output = y, input = x, covariate = z, ineffvar = q) # covariate enters the nonparametric part and is also treated as inefficiency determinant result <- spsc_sfa(output ~ input | covariate, data = dat, optim_method = "optim_BFGS", verbose = TRUE) result$smooth_coefficients result$mle_results result$technical_efficiency result$inefficiency # This gives the same results: the inefficiency variables default to the nonparametric part result <- spsc_sfa(output ~ input | covariate | NULL, data = dat, optim_method = "optim_BFGS", verbose = TRUE) # Use evaluation data (ezdat) for estimating the smooth coefficients result <- spsc_sfa(output ~ input | covariate, data = dat, ezdat = data.frame(covariate = ez), optim_method = "optim_BFGS", verbose = TRUE) nrow(result$smooth_coefficients$theta_beta) # Three-part formula: nonparametric part differs from inefficiency determinants result <- spsc_sfa(output ~ input | covariate | ineffvar, data = dat, optim_method = "optim_BFGS", verbose = TRUE) # Customized bandwidth for the nonparametric part result <- spsc_sfa(output ~ input | covariate | ineffvar, data = dat, optim_method = "optim_BFGS", bandwidth = c(0.1), verbose = TRUE) # Restrict no inefficiency determinants (intercept only) result <- spsc_sfa(output ~ input | covariate | 1, data = dat, optim_method = "optim_BFGS", verbose = TRUE) # More variables set.seed(1) n <- 100 x1 <- rnorm(n) x2 <- rnorm(n) z1 <- runif(n) z2 <- runif(n) y <- cos(z1 + z2) + sin(z1 - z2) * x1 + sin(z1 + z2) * x2 + rnorm(n, 0, 0.1) - exp(0.1 + 0.1 * z1 + 0.1 * z2) * abs(rnorm(n, 0, 1)) dat <- data.frame(y, x1, x2, z1, z2) result <- spsc_sfa(y ~ x1 + x2 | z1 + z2, data = dat) # z3 is an unordered categorical variable # spsc_sfa() detects if z3 is a factor dat$z3 <- factor(rep(sample(c("A", "B", "C", "D", "E")), 20)) # z1, z2, z3 enter the nonparametric part and are also inefficiency determinants result <- spsc_sfa(y ~ x1 + x2 | z1 + z2 + z3, data = dat) # z3 is preserved as an unordered categorical variable in the nonparametric part result$smooth_coefficients$bandwidth # z3 is converted to dummy variables as inefficiency determinants result$mle_results$delta_table # Same as above (inefficiency defaults to nonparametric part) result <- spsc_sfa(y ~ x1 + x2 | z1 + z2 + z3 | NULL, data = dat) # Three-part formula: use z3 only as the inefficiency determinant result <- spsc_sfa(y ~ x1 + x2 | z1 + z2 + z3 | z3, data = dat) # Use external variables as inefficiency determinants dat$q1 <- rnorm(n) dat$q2 <- rnorm(n) result <- spsc_sfa(y ~ x1 + x2 | z1 + z2 + z3 | q1 + q2, data = dat) # No inefficiency determinants (intercept only) result <- spsc_sfa(y ~ x1 + x2 | z1 + z2 + z3 | 1, data = dat, verbose = TRUE) # Application with real data (ricephil) ## Not run: data(ricephil) ricephil$FARMERCODE <- as.factor(ricephil$FARMERCODE) # this example shows categorical variable handling result <- spsc_sfa(PROD ~ AREA + LABOR + NPK | EDYRS + FARMERCODE | FARMERCODE, data = ricephil, optim_method = "optim_BFGS", verbose = TRUE) # FARMERCODE is preserved as an unordered categorical variable in the nonparametric part result$smooth_coefficients$bandwidth # FARMERCODE is converted to dummy variables as inefficiency determinants result$mle_results$delta_table ## End(Not run)set.seed(1) n <- 100 x <- rnorm(n) z <- runif(n) ez <- seq(0, 1, length = 1000) q <- rnorm(n) y <- cos(z) + sin(z) * x + rnorm(n, 0, 0.1) - exp(0.1 + 0.1 * z) * abs(rnorm(n, 0, 1)) dat <- data.frame(output = y, input = x, covariate = z, ineffvar = q) # covariate enters the nonparametric part and is also treated as inefficiency determinant result <- spsc_sfa(output ~ input | covariate, data = dat, optim_method = "optim_BFGS", verbose = TRUE) result$smooth_coefficients result$mle_results result$technical_efficiency result$inefficiency # This gives the same results: the inefficiency variables default to the nonparametric part result <- spsc_sfa(output ~ input | covariate | NULL, data = dat, optim_method = "optim_BFGS", verbose = TRUE) # Use evaluation data (ezdat) for estimating the smooth coefficients result <- spsc_sfa(output ~ input | covariate, data = dat, ezdat = data.frame(covariate = ez), optim_method = "optim_BFGS", verbose = TRUE) nrow(result$smooth_coefficients$theta_beta) # Three-part formula: nonparametric part differs from inefficiency determinants result <- spsc_sfa(output ~ input | covariate | ineffvar, data = dat, optim_method = "optim_BFGS", verbose = TRUE) # Customized bandwidth for the nonparametric part result <- spsc_sfa(output ~ input | covariate | ineffvar, data = dat, optim_method = "optim_BFGS", bandwidth = c(0.1), verbose = TRUE) # Restrict no inefficiency determinants (intercept only) result <- spsc_sfa(output ~ input | covariate | 1, data = dat, optim_method = "optim_BFGS", verbose = TRUE) # More variables set.seed(1) n <- 100 x1 <- rnorm(n) x2 <- rnorm(n) z1 <- runif(n) z2 <- runif(n) y <- cos(z1 + z2) + sin(z1 - z2) * x1 + sin(z1 + z2) * x2 + rnorm(n, 0, 0.1) - exp(0.1 + 0.1 * z1 + 0.1 * z2) * abs(rnorm(n, 0, 1)) dat <- data.frame(y, x1, x2, z1, z2) result <- spsc_sfa(y ~ x1 + x2 | z1 + z2, data = dat) # z3 is an unordered categorical variable # spsc_sfa() detects if z3 is a factor dat$z3 <- factor(rep(sample(c("A", "B", "C", "D", "E")), 20)) # z1, z2, z3 enter the nonparametric part and are also inefficiency determinants result <- spsc_sfa(y ~ x1 + x2 | z1 + z2 + z3, data = dat) # z3 is preserved as an unordered categorical variable in the nonparametric part result$smooth_coefficients$bandwidth # z3 is converted to dummy variables as inefficiency determinants result$mle_results$delta_table # Same as above (inefficiency defaults to nonparametric part) result <- spsc_sfa(y ~ x1 + x2 | z1 + z2 + z3 | NULL, data = dat) # Three-part formula: use z3 only as the inefficiency determinant result <- spsc_sfa(y ~ x1 + x2 | z1 + z2 + z3 | z3, data = dat) # Use external variables as inefficiency determinants dat$q1 <- rnorm(n) dat$q2 <- rnorm(n) result <- spsc_sfa(y ~ x1 + x2 | z1 + z2 + z3 | q1 + q2, data = dat) # No inefficiency determinants (intercept only) result <- spsc_sfa(y ~ x1 + x2 | z1 + z2 + z3 | 1, data = dat, verbose = TRUE) # Application with real data (ricephil) ## Not run: data(ricephil) ricephil$FARMERCODE <- as.factor(ricephil$FARMERCODE) # this example shows categorical variable handling result <- spsc_sfa(PROD ~ AREA + LABOR + NPK | EDYRS + FARMERCODE | FARMERCODE, data = ricephil, optim_method = "optim_BFGS", verbose = TRUE) # FARMERCODE is preserved as an unordered categorical variable in the nonparametric part result$smooth_coefficients$bandwidth # FARMERCODE is converted to dummy variables as inefficiency determinants result$mle_results$delta_table ## End(Not run)
Summary method for SPSC-SFA
## S3 method for class 'spsc_sfa' summary(object, ...)## S3 method for class 'spsc_sfa' summary(object, ...)
object |
An object of class 'spsc_sfa'. |
... |
Additional arguments (currently ignored). |
See print.spsc_sfa.
Extract technical-efficiency scores
te(x)te(x)
x |
An object of class 'spsc_sfa'. |
A numeric vector of technical-efficiency estimates.