Write an instruction file, a data file, and a start-up file for Tim Coelli's program Frontier 4.1 that performs stochastic frontier analysis.

1 2 3 4 5 6 7 8 | ```
front41WriteInput( data, crossSectionName, timePeriodName = NULL,
yName, xNames = NULL, qxNames = NULL, zNames = NULL, quadHalf = TRUE,
modelType = ifelse( is.null( zNames ), 1, 2 ), functionType = 1,
logDepVar = TRUE, mu = FALSE, eta = FALSE,
insFile = "front41.ins", dtaFile = sub( "\\.ins$", ".dta", insFile ),
outFile = sub( "\\.ins$", ".out", insFile ), startUpFile = "front41.000",
iprint = 5, indic = 1, tol = 0.00001, tol2 = 0.001, bignum = 1.0E+16,
step1 = 0.00001, igrid2 = 1, gridno = 0.1, maxit = 100, ite = 1 )
``` |

`data` |
data frame that contains the data. |

`crossSectionName` |
string: name of the cross section identifier. |

`timePeriodName` |
string: name of the time period identifier
or |

`yName` |
string: name of the endogenous variable. |

`xNames` |
a vector of strings containing the names of the X variables (exogenous variables of the production or cost function). |

`qxNames` |
a vector of strings containing the names of the variables
to construct quadratic and interaction terms.
As a shortcut, this argument can be set to |

`zNames` |
a vector of strings containing the names of the Z variables (variables explaining the efficiency level). |

`quadHalf` |
logical. Multiply the quadratic terms by one half? |

`modelType` |
model type: either 1 for an 'Error Components Frontier' or 2 for an 'Efficiency Effects Frontier'. |

`functionType` |
function type: either 1 for 'production function' or 2 for 'cost function'. |

`logDepVar` |
logical. Is the dependent variable logged. |

`mu` |
logical. Should a 'mu' (in case of an 'Error Components Frontier', i.e. modelType = 1) or a delta0 (in case of an 'Efficiency Effects Frontier', i.e. modelType = 2) be included in the estimation. |

`eta` |
logical. Should an 'eta' be included in the estimation (only in case of an 'Error Components Frontier', i.e. modelType = 1). |

`insFile` |
name of the instruction file. |

`dtaFile` |
name of the data file. |

`outFile` |
name of the output file. |

`startUpFile` |
name of the start-up file. If this argument is NULL, no start-up file is written. |

`iprint` |
numeric. Print info every |

`indic` |
numeric. Use in unidimensional search procedure: indic = 2 says do not scale step length in unidimensional search; indic = 1 says scale (to length of last step) only if last step was smaller; indic = any other number says scale (to length of last step). |

`tol` |
numeric. Convergence tolerance (proportiona). |

`tol2` |
numeric. Tolerance used in uni-dimensional search procedure. |

`bignum` |
numeric. Used to set bounds on densities and distributions. |

`step1` |
numeric. Size of 1st step in search procedure. |

`igrid2` |
numeric. 1 = double accuracy, 0 = single accuracy. |

`gridno` |
numeric. Steps taken in single accuracy grid search on gamma. |

`maxit` |
numeric. Maximum number of iterations permitted |

`ite` |
numeric. 1 = print all efficiency estimates; 0 = print only the mean efficiency. |

A modified version of Tim Coelli's FRONTIER 4.1
that can be used non-interactively is available on
http://frontier.r-forge.r-project.org/front41.html.
It can be called from within R using the `system`

command
(see example).
This version is is available as (FORTRAN) source code
and (executable) binaries for GNU/Linux and MS-Windows.

`front41WriteInput`

writes an instruction file, a data file,
and a start-up file for Frontier 4.1 to disk
and it invisibly returns a list of class `front41WriteInput`

.
This list contains mainly the arguments with which `front41WriteInput`

was called.
An exception is element `data`

, which is *not*
the argument `data`

but the data matrix
that was written into the data file.
Furthermore, in case of an Efficiency Effects Model,
the element `eta`

contains the number of Z variables.
Additionally, the returned list contains following elements:

`nCrossSection` |
number of cross section units. |

`nTimePeriods` |
number of time periods. |

`nTotalObs` |
total number of observations. |

`nXtotal` |
total number of X variables (including quadratic and interaction terms). |

`nZvars` |
number of Z variables. |

Arne Henningsen

Battese, G.E. and T. Coelli (1992), Frontier production functions,
technical efficiency and panel data: with application to paddy
farmers in India. *Journal of Productivity Analysis*, 3, 153-169.

Battese, G.E. and T. Coelli (1995), A model for technical inefficiency effects
in a stochastic frontier production function for panel data.
*Empirical Economics*, 20, 325-332.

Coelli, T. (1996) A Guide to FRONTIER Version 4.1: A Computer Program for Stochastic Frontier Production and Cost Function Estimation, CEPA Working Paper 96/08, http://www.uq.edu.au/economics/cepa/frontier.htm, University of New England.

`front41ReadOutput`

, `front41Est`

1 2 3 4 5 6 7 8 9 10 11 12 13 | ```
data( front41Data )
front41Data$logOutput <- log( front41Data$output )
front41Data$logCapital <- log( front41Data$capital )
front41Data$logLabour <- log( front41Data$labour )
front41WriteInput( front41Data, "firm", yName = "logOutput",
xNames = c( "logCapital", "logLabour" ), insFile = "coelli.ins" )
## Not run:
system( "front41.bin coelli.ins" )
sfa <- front41ReadOutput( "coelli.out" )
## End(Not run)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.