Stochastic Frontier Analysis in R: Technical Efficiency of Rice Farms

Stochastic Frontier Analysis in R: Technical Efficiency of Rice Farms

Two rice farms can spend similar amounts on production yet harvest different yields. Weather, water availability, measurement error, management and soil conditions may all contribute to the difference. A conventional regression summarizes the average conditional relationship. A stochastic frontier instead models a benchmark that allows both random shocks and a one-sided production shortfall. It is a useful way to investigate technical efficiency without treating every low yield as managerial failure.

This tutorial fits a cross-sectional yield frontier to 589 historical Ecuadorian rice-farm records. The emphasis is the mechanics of the estimator, model-relative efficiency and how to check the credibility of its estimates. Base R supplies the likelihood, numerical optimization and graphics; no specialized estimation package is necessary.

1. Understand the farm records

The Mendeley Data study, version 1 (November 2026), uses the 2019–2020 rice producer survey. The analytical sample contains farms from Guayas, Los RĂ­os, Loja, ManabĂ­ and El Oro. Each record represents one farm in the analytical sample, rather than a replicated experimental plot or a sequence of annual observations. The data include harvested paddy yield in tonnes per hectare, cultivated area in hectares, and expenditures per hectare per cycle in US dollars.

The original workbook’s combined intermediate cost is the sum of seed, fertilizer, weed control, pest and disease control, and irrigation expenditure. Its formula treats a missing irrigation cost as zero in the sum. The original irrigation observations remain missing: a blank cost is not proof that no irrigation was used. Similarly, no hired-labor cost may reflect family labor or other unrecorded arrangements. These distinctions determine how the variables can be interpreted.

The source contains 23 exclusions from the 612 survey records: 20 missing yields, two missing area values, and one record marked “other.” The analysis uses the documented 589 included records. No survey design weights or cluster identifiers are supplied in the teaching table, so conclusions apply to the analyzed sample, not necessarily all Ecuadorian rice producers.

rice <- read.csv("01_data/rice_ecuador_sfa.csv", stringsAsFactors = FALSE)
stopifnot(nrow(rice) == 589, !anyDuplicated(rice$orig_row),
          all(rice$yield_t_ha > 0), all(rice$area_ha > 0),
          all(rice$cost_inter_ha > 0), all(rice$cost_labour_ha >= 0),
          all(rice$cost_mach_ha >= 0))
province_levels <- c("GUAYAS", "LOS RIOS", "LOJA", "MANABI", "EL ORO")
stopifnot(setequal(rice$province, province_levels))
rice$province <- factor(rice$province, levels = province_levels)
# The source defines the aggregate with missing irrigation contributing zero.
parts <- c("cost_seed_ha", "cost_fert_ha", "cost_weed_ha", "cost_pest_ha")
stopifnot(all(complete.cases(rice[parts])))
inter_check <- rowSums(rice[parts]) + ifelse(is.na(rice$cost_irrig_ha), 0,
                                           rice$cost_irrig_ha)
stopifnot(max(abs(inter_check - rice$cost_inter_ha)) < 1e-7)
audit <- data.frame(farms = nrow(rice), missing_irrigation = sum(is.na(rice$cost_irrig_ha)),
                    zero_labour = sum(rice$cost_labour_ha == 0),
                    zero_machinery = sum(rice$cost_mach_ha == 0))
print(audit)
  farms missing_irrigation zero_labour zero_machinery
1   589                 36         292             84
print(table(rice$province))

  GUAYAS LOS RIOS     LOJA   MANABI   EL ORO 
     362      113       54       47       13 

2. Why the log transformation and zero indicators matter

A Cobb–Douglas-style specification uses logarithms for positive yield, land area and intermediate expenditure. Hired labor and machinery costs contain genuine recorded zeros, so their log transformation uses the source convention \(\log(\max(x,1))\) plus a separate indicator for zero expenditure. This also floors positive expenditures below one dollar. The threshold is an accounting convention, not a biological threshold.

Province indicators allow systematic geographical differences in the conditional yield benchmark; Guayas is the reference. The response is yield per hectare rather than total output. For an ordinary logged input, a coefficient describes the approximate percentage difference in yield associated with a one-percent difference in the input, holding the other model variables fixed. It is not a physical-input elasticity when the input is measured in monetary expenditures. The coefficients cannot be summed to obtain conventional returns to scale. For floored variables this elasticity interpretation applies only above the floor, with the zero indicator held fixed.

We first estimate ordinary least squares as a benchmark. Its residual skewness is a descriptive clue to possible asymmetric error, not a standalone test proving that technical inefficiency exists.

rice$ln_yield <- log(rice$yield_t_ha)
rice$ln_land <- log(rice$area_ha)
rice$ln_inter <- log(rice$cost_inter_ha)
# Zero paid cost is not zero physical input; the floor matches the source.
rice$ln_lab <- log(pmax(rice$cost_labour_ha, 1))
rice$D_lab0 <- as.integer(rice$cost_labour_ha == 0)
rice$ln_cap <- log(pmax(rice$cost_mach_ha, 1))
rice$D_cap0 <- as.integer(rice$cost_mach_ha == 0)
frontier_formula <- ln_yield ~ ln_land + ln_inter + ln_lab + D_lab0 +
  ln_cap + D_cap0 + province
ols <- lm(frontier_formula, data = rice)
X <- model.matrix(ols)
y <- rice$ln_yield
ols_skew <- mean((residuals(ols) - mean(residuals(ols)))^3) /
  mean((residuals(ols) - mean(residuals(ols)))^2)^1.5
print(round(coef(ols), 4))
     (Intercept)          ln_land         ln_inter           ln_lab 
          1.4512           0.0113           0.0578          -0.0006 
          D_lab0           ln_cap           D_cap0 provinceLOS RIOS 
         -0.0027           0.0058          -0.1513          -0.0655 
    provinceLOJA   provinceMANABI   provinceEL ORO 
          0.5753           0.1045           0.1071 
print(ols_skew)
[1] -0.537767

3. Separate random shocks from one-sided inefficiency

Let \(y_i\) be the log of rice yield and \(x_i\) the vector of transformed predictors. The stochastic frontier model is

\[y_i=x_i^\top\beta+v_i-u_i\]

where \(v_i\sim N(0,\sigma_v^2)\) and \(u_i\sim |N(0,\sigma_u^2)|\) independently of each other and, in the baseline, of the regressors. The normal component allows both favorable and unfavorable shocks. The half-normal component can only reduce log yield relative to the stochastic frontier. This decomposition is a distributional modeling assumption, not a direct measurement of either mechanism.

Writing \(\epsilon_i=y_i-x_i^\top\beta\), \(\sigma^2=\sigma_v^2+\sigma_u^2\) and \(\lambda=\sigma_u/\sigma_v\), integrating out the latent inefficiency gives the density

\[f(\epsilon_i)=\frac{2}{\sigma}\phi\left(\frac{\epsilon_i}{\sigma}\right)\Phi\left(-\lambda\frac{\epsilon_i}{\sigma}\right)\]

Here \(\phi\) and \(\Phi\) denote the standard normal density and cumulative probability. Maximizing the sum of log densities estimates the frontier coefficients and both scale parameters simultaneously. R minimizes the negative log-likelihood, with log scale parameters to enforce positivity. Standardizing the design columns internally improves numerical conditioning; the estimates are transformed back to their original scale. The three starts, gradient and Hessian checks guard against obvious numerical failures, not against every form of statistical misspecification.

The conditional distribution of \(u_i\) given the composed error is normal truncated below zero, with untruncated location \(m_i=-\epsilon_i\sigma_u^2/\sigma^2\) and standard deviation \(\tau=\sigma_v\sigma_u/\sigma\). The conditional expectation of the efficiency ratio is

\[\widehat{TE}_i=E[e^{-u_i}\mid\epsilon_i]=e^{-m_i+\tau^2/2}\frac{\Phi(m_i/\tau-\tau)}{\Phi(m_i/\tau)}\]

This is not simply the ratio of observed yield to the fitted deterministic frontier, nor the exponential of a conditional mean of inefficiency. The cumulative probabilities are calculated on the log scale for numerical stability.

# Internally standardize columns for optimization, then restore original units.
fit_frontier <- function(X, y) {
  k <- ncol(X)
  center <- colMeans(X[, -1, drop = FALSE])
  spread <- apply(X[, -1, drop = FALSE], 2, sd)
  stopifnot(all(spread > 0), qr(X)$rank == k)
  Z <- cbind(1, sweep(sweep(X[, -1, drop = FALSE], 2, center), 2, spread, "/"))
  b0 <- lm.fit(Z, y)$coefficients
  s0 <- sqrt(mean((y - drop(Z %*% b0))^2))
  # f(e) = 2/sigma * phi(e/sigma) * Phi(-lambda*e/sigma).
  nll <- function(p) {
    sv <- exp(p[k + 1]); su <- exp(p[k + 2])
    s <- sqrt(sv^2 + su^2)
    t <- (y - drop(Z %*% p[seq_len(k)])) / s
    -sum(log(2 / s) + dnorm(t, log = TRUE) + pnorm(-su / sv * t, log.p = TRUE))
  }
  gradient <- function(p) {
    sv <- exp(p[k + 1]); su <- exp(p[k + 2]); s2 <- sv^2 + su^2
    s <- sqrt(s2); lambda <- su / sv
    t <- (y - drop(Z %*% p[seq_len(k)])) / s
    a <- -lambda * t
    m <- exp(dnorm(a, log = TRUE) - pnorm(a, log.p = TRUE))
    wv <- sv^2 / s2; wu <- su^2 / s2
    -c(drop(crossprod(Z, (t + lambda * m) / s)),
       sum(wv * (t^2 - 1) - m * a * (1 + wv)),
       sum(wu * (t^2 - 1) + m * a * (1 - wu)))
  }
  starts <- lapply(c(0.4, 0.8, 1.2), function(r)
    c(b0, log(s0 * 0.6), log(s0 * r)))
  fits <- lapply(starts, function(p) optim(p, nll, gradient, method = "L-BFGS-B",
    lower = c(rep(-Inf, k), -8, -8), upper = c(rep(Inf, k), 3, 3),
    control = list(maxit = 5000, factr = 1e5, pgtol = 1e-7)))
  values <- vapply(fits, function(f) f$value, numeric(1))
  codes <- vapply(fits, function(f) f$convergence, integer(1))
  best <- fits[[which.min(values)]]
  # A small gradient and positive curvature are necessary, not sufficient.
  p <- best$par
  H <- optimHess(p, nll, gradient)
  H <- (H + t(H)) / 2
  eig <- eigen(H, symmetric = TRUE, only.values = TRUE)$values
  grad_max <- max(abs(gradient(p)))
  interior <- all(p[k + 1:2] > -7.99 & p[k + 1:2] < 2.99)
  stable <- sum(codes == 0 & abs(values - best$value) < 1e-4) >= 2
  valid <- best$convergence == 0 && grad_max < 0.05 && min(eig) > 1e-6 && interior && stable
  if (!valid) stop("Frontier fit failed numerical gate: ",
    paste(c(best$convergence, grad_max, min(eig), interior, stable), collapse = ", "))
  T <- diag(k + 2)
  T[1, 2:k] <- -center / spread
  T[cbind(2:k, 2:k)] <- 1 / spread
  par <- drop(T %*% p)
  V <- T %*% solve(H) %*% t(T)
  beta <- setNames(par[seq_len(k)], colnames(X))
  sv <- exp(par[k + 1]); su <- exp(par[k + 2])
  frontier <- drop(X %*% beta); e <- y - frontier
  # Conditional truncated-normal mean and SD give E[exp(-u) | e].
  s2 <- sv^2 + su^2
  mu <- -e * su^2 / s2; tau <- sv * su / sqrt(s2)
  log_te <- -mu + tau^2 / 2 + pnorm(mu / tau - tau, log.p = TRUE) -
    pnorm(mu / tau, log.p = TRUE)
  te <- exp(log_te)
  stopifnot(all(is.finite(te)), all(te > 0 & te <= 1 + 1e-10))
  list(beta = beta, se = sqrt(diag(V))[seq_len(k)], sv = sv, su = su,
       gamma = su^2 / s2, logLik = -best$value, aic = 2 * (k + 2 + best$value),
       frontier = frontier, residual = e, te = te, gradient = grad_max,
       min_eigen = min(eig), condition = max(eig) / min(eig),
       starts = data.frame(start = seq_along(fits), code = codes, nll = values))
}
base <- fit_frontier(X, y)
print(base$starts)
  start code      nll
1     1    0 197.7396
2     2    0 197.7396
3     3    0 197.7396
print(c(logLik = base$logLik, gamma = base$gamma, mean_TE = mean(base$te),
        max_gradient = base$gradient, min_eigen = base$min_eigen))
       logLik         gamma       mean_TE  max_gradient     min_eigen 
-1.977396e+02  8.193444e-01  7.225947e-01  1.022691e-03  7.087653e+01 

The fitted log-likelihood is -197.74 and the estimated noise and inefficiency scale parameters are 0.213 and 0.453, respectively. The estimated gamma is 0.819. These estimates depend on the chosen error distributions.

4. Interpret the estimated frontier and efficiency

The frontier coefficients describe conditional associations with the latent benchmark. Approximate 95% Wald intervals use the inverse observed information from the fitted model, with the coefficient transformation applied to the covariance matrix. They are model-based, not survey-design-adjusted intervals. In particular, farm spending may respond to expected yield, and unobserved soil, irrigation access, pest pressure or price differences can affect both costs and harvests. The estimates do not identify causal input responses.

The scale ratio \(\gamma=\sigma_u^2/(\sigma_v^2+\sigma_u^2)\) summarizes the relative magnitudes of the two underlying normal scale parameters. It is not the proportion of production lost, nor the exact fraction of composed-error variance due to inefficiency: the variance of a half-normal is \(\sigma_u^2(1-2/\pi)\).

A conditional efficiency score near one indicates proximity to the model’s benchmark after averaging over the conditional distribution of the latent shortfall. A score of 0.75 would mean an estimated efficiency ratio of 75% under the assumptions, not a guarantee that the farm can raise yield by 25%. Uncertainty about individual latent inefficiency and estimated frontier parameters makes precise farm rankings inappropriate without further analysis.

coef_table <- data.frame(term = names(base$beta), OLS = unname(coef(ols)),
                         estimate = unname(base$beta), SE = base$se,
                         lower = base$beta - 1.96 * base$se,
                         upper = base$beta + 1.96 * base$se, row.names = NULL)
farm_scores <- data.frame(orig_row = rice$orig_row, province = rice$province,
                          yield_t_ha = rice$yield_t_ha, frontier_log_yield = base$frontier,
                          composed_error = base$residual, TE = base$te)
te_summary <- data.frame(mean = mean(base$te), median = median(base$te),
                         p10 = unname(quantile(base$te, .1)),
                         p90 = unname(quantile(base$te, .9)))
province_summary <- do.call(rbind, lapply(split(farm_scores$TE, rice$province),
  function(z) data.frame(n = length(z), mean_TE = mean(z), median_TE = median(z))))
province_summary$province <- rownames(province_summary)
rownames(province_summary) <- NULL
print(coef_table, digits = 4)
               term        OLS  estimate      SE    lower   upper
1       (Intercept)  1.4511605  1.964029 0.15388  1.66242 2.26564
2           ln_land  0.0113301  0.012441 0.01563 -0.01819 0.04307
3          ln_inter  0.0578261  0.028961 0.02219 -0.01452 0.07245
4            ln_lab -0.0005599  0.002053 0.01037 -0.01828 0.02239
5            D_lab0 -0.0027255  0.041982 0.04400 -0.04427 0.12823
6            ln_cap  0.0058149  0.004389 0.01741 -0.02973 0.03851
7            D_cap0 -0.1513467 -0.149586 0.08912 -0.32427 0.02510
8  provinceLOS RIOS -0.0655251 -0.043268 0.03748 -0.11673 0.03019
9      provinceLOJA  0.5753218  0.547132 0.05332  0.44263 0.65163
10   provinceMANABI  0.1045147  0.091220 0.05228 -0.01125 0.19369
11   provinceEL ORO  0.1071051  0.010477 0.09556 -0.17682 0.19777
print(te_summary)
       mean    median       p10       p90
1 0.7225947 0.7449359 0.5420556 0.8787058
print(province_summary)
    n   mean_TE median_TE province
1 362 0.7220135 0.7443285   GUAYAS
2 113 0.7072495 0.7263944 LOS RIOS
3  54 0.7420489 0.7480154     LOJA
4  47 0.7310895 0.7670769   MANABI
5  13 0.7606437 0.7952140   EL ORO

The mean conditional efficiency among the 589 analyzed farms is 72.3%, with a median of 74.5%. The tenth and ninetieth percentiles are 0.542 and 0.879. These are sample percentiles of estimated scores, not confidence intervals for the population mean.

5. How sensitive are the results to the modeling choices?

A translog expansion adds centered squared terms and cross-products among the four logged regressors. It relaxes the constant-elasticity form and allows the local slope for one input to vary with other inputs. It also consumes ten extra parameters. The same-sample AIC compares the fit–complexity tradeoff; lower AIC is preferred among these comparable likelihoods, not proof that a model is correct. Winsorizing the intermediate expenditure at the first and ninety-ninth percentiles assesses sensitivity to extreme values in that predictor. It is a diagnostic scenario, not a correction of the historical measurements.

A final sensitivity refits the baseline after excluding records with missing irrigation expenditure. The resulting mean efficiency is compared with the original baseline on those same farms; AIC is not compared across different sample sizes. This check does not resolve the missing-data mechanism or demonstrate absence of selection bias. Rank correlations summarize stability of the relative ordering, not predictive accuracy or agreement of all individual scores.

All these models retain the same normal/half-normal distributional assumptions. Other inefficiency distributions, heterogeneous scale models, clustered sampling and potential input endogeneity warrant separate analysis. The supplied study also fits a truncated-normal model, but describes the location parameter as poorly identified. A simpler teaching model is preferable to interpreting an unstable parameter as a substantive discovery.

# Translog augments the same model with centered squares and cross-products.
logs <- c("ln_land", "ln_inter", "ln_lab", "ln_cap")
C <- scale(rice[logs], center = TRUE, scale = FALSE)
X_tl <- X
for (i in seq_along(logs)) for (j in i:length(logs)) {
  term <- paste(logs[i], logs[j], sep = ":")
  X_tl <- cbind(X_tl, C[, i] * C[, j] * if (i == j) 0.5 else 1)
  colnames(X_tl)[ncol(X_tl)] <- term
}
translog <- fit_frontier(X_tl, y)
# Winsorization is a sensitivity scenario only; no source values are changed.
limits <- quantile(rice$cost_inter_ha, c(.01, .99))
X_wins <- X
X_wins[, "ln_inter"] <- log(pmin(pmax(rice$cost_inter_ha, limits[1]), limits[2]))
wins <- fit_frontier(X_wins, y)
keep <- !is.na(rice$cost_irrig_ha)
complete <- fit_frontier(X[keep, , drop = FALSE], y[keep])
models <- list(baseline = base, translog = translog, winsor_intermediate = wins,
               complete_irrigation = complete)
sensitivity <- do.call(rbind, lapply(names(models), function(nm) {
  m <- models[[nm]]
  reference <- if (nm == "complete_irrigation") base$te[keep] else base$te
  data.frame(model = nm, n = length(m$te), logLik = m$logLik,
             AIC = if (nm == "complete_irrigation") NA_real_ else m$aic,
             gamma = m$gamma, mean_TE = mean(m$te), reference_mean_TE = mean(reference),
             rank_correlation = cor(m$te, reference, method = "spearman"),
             max_gradient = m$gradient, min_eigen = m$min_eigen,
             hessian_condition = m$condition)
}))
print(sensitivity, digits = 4)
                model   n logLik   AIC  gamma mean_TE reference_mean_TE
1            baseline 589 -197.7 421.5 0.8193  0.7226            0.7226
2            translog 589 -193.2 432.3 0.8283  0.7215            0.7226
3 winsor_intermediate 589 -197.2 420.5 0.8164  0.7237            0.7226
4 complete_irrigation 553 -190.9    NA 0.8129  0.7226            0.7210
  rank_correlation max_gradient min_eigen hessian_condition
1           1.0000     0.001023     70.88             185.9
2           0.9894     0.001228     63.84             311.2
3           0.9997     0.001379     70.20             188.2
4           0.9989     0.000828     64.79             190.1

The translog AIC is 432.33 versus 421.48 for the baseline; the corresponding mean-efficiency comparison is 0.7215 versus 0.7226. The complete-irrigation comparison retains 553 farms.

6. Read the graphs, not just the coefficient table

The fitted frontier is a deterministic conditional benchmark in log-yield space. Exponentiating it gives a no-inefficiency benchmark at zero random shock on the original yield scale. Observations may lie above the identity line because the stochastic component permits favorable shocks. Such points are not automatically errors.

The efficiency distribution shows conditional estimates for all included farms. The sample’s distribution is not the estimated distribution of unobserved individual true efficiency. The province comparison is descriptive: province effects enter the model, sample sizes differ markedly, and El Oro has few observations. A simulation-based quantile comparison of fitted composed residuals with the assumed distribution is a visual specification check rather than an independent held-out test. Finally, comparing mean efficiencies from the alternative models shows how much conclusions depend on the modeling choices examined.

# A fitted frontier is a latent no-inefficiency benchmark, not a hard maximum.
plot_frontier <- function() {
  plot(exp(base$frontier), rice$yield_t_ha, pch = 16, col = adjustcolor("#247A74", .45),
       xlab = "Fitted frontier yield (t/ha)", ylab = "Observed yield (t/ha)",
       main = "Observed rice yield vs fitted frontier", xlim = range(c(exp(base$frontier), rice$yield_t_ha)),
       ylim = range(c(exp(base$frontier), rice$yield_t_ha)))
  abline(0, 1, lty = 2, col = "#994C38", lwd = 2)
}
plot_efficiency <- function() {
  hist(base$te, breaks = seq(0, 1, .05), col = "#247A74", border = "white",
       xlim = c(0, 1), main = "Model-relative technical efficiency",
       xlab = "Conditional efficiency score", ylab = "Number of farms")
  abline(v = mean(base$te), lwd = 2, col = "#994C38", lty = 2)
}
plot_province <- function() {
  op <- par(mar = c(6, 4, 3, 1)); on.exit(par(op))
  boxplot(TE ~ province, data = farm_scores, las = 2, col = "#A9D2CA",
          ylim = c(0, 1), xlab = "", ylab = "Conditional efficiency score",
          main = "Efficiency by sampled province")
}
plot_diagnostic <- function() {
  set.seed(23023)
  sim <- rnorm(20000, sd = base$sv) - abs(rnorm(20000, sd = base$su))
  qqplot(sim, base$residual, pch = 16, cex = .6, col = "#247A74",
         xlab = "Simulated composed-error quantiles", ylab = "Fitted residual quantiles",
         main = "Composed-error Q-Q diagnostic")
  abline(0, 1, lwd = 2, lty = 2, col = "#994C38")
}
plot_sensitivity <- function() {
  op <- par(mar = c(7, 4, 3, 1)); on.exit(par(op))
  plot(seq_len(nrow(sensitivity)), sensitivity$mean_TE, ylim = c(0, 1),
       xaxt = "n", xlab = "", ylab = "Mean conditional efficiency", pch = 19,
       col = "#247A74", main = "Sensitivity of average efficiency")
  axis(1, at = 1:4, labels = c("Baseline", "Translog", "Winsorized", "Complete irrigation"), las = 2, cex.axis = .8)
  points(1:4, sensitivity$reference_mean_TE, pch = 1, col = "#994C38", cex = 1.4)
  legend("bottomleft", c("Alternative", "Baseline on same farms"), pch = c(19, 1),
         col = c("#247A74", "#994C38"), bty = "n")
}
plot_frontier()
Scatterplot of observed yield against fitted frontier yield with an identity line.
Figure 1: Observed yield versus the fitted deterministic yield benchmark. Points above the diagonal are compatible with positive random shocks.
plot_efficiency()
Histogram of efficiency scores between zero and one.
Figure 2: Distribution of conditional technical-efficiency estimates. The dashed line marks the sample mean.
plot_province()
Boxplots of efficiency for five Ecuadorian provinces.
Figure 3: Conditional efficiency by province. Boxes summarize the observed sample of model estimates, not population confidence intervals.
plot_diagnostic()
Quantile comparison with a diagonal reference line.
Figure 4: Fitted composed residual quantiles versus simulated quantiles from the assumed normal-minus-half-normal distribution.
plot_sensitivity()
Point comparison of mean efficiencies under four model choices.
Figure 5: Mean efficiency under alternative specifications and baseline estimates on the same farm subsets.

7. Reproducible results and scientific conclusions

The coefficient and sensitivity tables summarize the fitted models. The underlying farm-level estimates can be used for reproducible comparisons without requiring a public ranking of individual producers.

knitr::kable(coef_table, digits = 4, caption = "Baseline frontier coefficients and approximate Wald intervals")
Baseline frontier coefficients and approximate Wald intervals
term OLS estimate SE lower upper
(Intercept) 1.4512 1.9640 0.1539 1.6624 2.2656
ln_land 0.0113 0.0124 0.0156 -0.0182 0.0431
ln_inter 0.0578 0.0290 0.0222 -0.0145 0.0724
ln_lab -0.0006 0.0021 0.0104 -0.0183 0.0224
D_lab0 -0.0027 0.0420 0.0440 -0.0443 0.1282
ln_cap 0.0058 0.0044 0.0174 -0.0297 0.0385
D_cap0 -0.1513 -0.1496 0.0891 -0.3243 0.0251
provinceLOS RIOS -0.0655 -0.0433 0.0375 -0.1167 0.0302
provinceLOJA 0.5753 0.5471 0.0533 0.4426 0.6516
provinceMANABI 0.1045 0.0912 0.0523 -0.0113 0.1937
provinceEL ORO 0.1071 0.0105 0.0956 -0.1768 0.1978
knitr::kable(sensitivity, digits = 4, caption = "Sensitivity of frontier estimates")
Sensitivity of frontier estimates
model n logLik AIC gamma mean_TE reference_mean_TE rank_correlation max_gradient min_eigen hessian_condition
baseline 589 -197.7396 421.4791 0.8193 0.7226 0.7226 1.0000 0.0010 70.8765 185.8546
translog 589 -193.1665 432.3331 0.8283 0.7215 0.7226 0.9894 0.0012 63.8353 311.2389
winsor_intermediate 589 -197.2318 420.4637 0.8164 0.7237 0.7226 0.9997 0.0014 70.2049 188.2240
complete_irrigation 553 -190.8818 NA 0.8129 0.7226 0.7210 0.9989 0.0008 64.7950 190.0876

What this analysis can and cannot establish

Stochastic frontier analysis offers a coherent way to model asymmetric yield shortfalls while allowing random shocks in either direction. The data support a model-relative description of efficiency, conditional on observed area, spending and province. They do not demonstrate which individual farm practices cause efficiency differences, and they do not provide a guaranteed yield target for farmers. The sample is historical and geographically uneven; the underlying survey design and unrecorded production conditions constrain generalization.

For a new agricultural thesis, begin with clearly defined physical input quantities where possible, a defensible sampling design and an explicit production objective. Examine zero-valued costs and missing data before taking logs. Compare scientifically plausible frontier specifications and distributional assumptions rather than selecting the one that gives the most favorable efficiency estimates. Treat the model’s residual distribution and its conditional efficiency estimates as assumptions to assess, not proof of technical inefficiency.

References and data attribution

  • ZĂșniga-Gonzalez, C. A., Castro Alvarez, M. D., & Andrade, R. S. (2026). Data for Technical Efficiency and Its Determinants among Rice Producers in Ecuador: A Stochastic Frontier Analysis. Mendeley Data, V1. https://doi.org/10.17632/8c464m33d4.1. CC BY 4.0; the teaching CSV retains all included records and selects 25 fields from the source workbook.
  • Aigner, D., Lovell, C. A. K., & Schmidt, P. (1977). Formulation and estimation of stochastic frontier production function models. Journal of Econometrics, 6(1), 21–37. https://doi.org/10.1016/0304-4076(77)90052-5.
  • Battese, G. E., & Coelli, T. J. (1988). Prediction of firm-level technical efficiencies with a generalized frontier production function and panel data. Journal of Econometrics, 38(3), 387–399. https://doi.org/10.1016/0304-4076(88)90053-X.

Comments