Title: | Stochastic Frontier Analysis |
---|---|
Description: | Maximum Likelihood Estimation of Stochastic Frontier Production and Cost Functions. Two specifications are available: the error components specification with time-varying efficiencies (Battese and Coelli, 1992, <doi:10.1007/BF00158774>) and a model specification in which the firm effects are directly influenced by a number of variables (Battese and Coelli, 1995, <doi:10.1007/BF01205442>). |
Authors: | Tim Coelli, Arne Henningsen |
Maintainer: | Arne Henningsen <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.1-9 |
Built: | 2024-10-13 04:33:20 UTC |
Source: | https://github.com/r-forge/frontier |
These methods return the coefficients and their covariance matrix from a model estimated by Frontier 4.1.
## S3 method for class 'front41Output' coef( object, which = "MLE", ... ) ## S3 method for class 'summary.front41Output' coef( object, which = "MLE", ... ) ## S3 method for class 'front41Output' vcov( object, ... )
## S3 method for class 'front41Output' coef( object, which = "MLE", ... ) ## S3 method for class 'summary.front41Output' coef( object, which = "MLE", ... ) ## S3 method for class 'front41Output' vcov( object, ... )
object |
an object of class |
which |
character string indication, which coefficients should be returned: either 'OLS' (from OLS estimation), 'GRID' (from grid search), or 'MLE' (from maximum likelihood estimation). |
... |
currently ignored. |
The coef
method applied to an object of class front41Output
returns a vector containing all
coefficients estimated by Frontier 4.1.
The coef
method applied to an object of class
summary.front41Output
returns a matrix containing
the estimates, their standard errors, the values and
values
of all coefficients estimated by Frontier 4.1.
The vcov
method returns the covariance matrix
of all coefficients estimated by Frontier 4.1.
Arne Henningsen
Extract the coefficients from stochastic frontier models
returned by frontier
.
## S3 method for class 'frontier' coef( object, which = "mle", extraPar = FALSE, ... )
## S3 method for class 'frontier' coef( object, which = "mle", extraPar = FALSE, ... )
object |
an object of class |
which |
character string. Which coefficients should be returned? ('start' for starting values provided by the user, 'ols' for coefficients estimated by OLS, 'grid' for coefficients obtained by the grid search, or 'mle' for coefficients estimated by Maximum Likelihood). |
extraPar |
logical. If |
... |
currently unused. |
coef.frontier
returns a named vector of the coefficients.
Arne Henningsen
coef.summary.frontier
and sfa
.
# example included in FRONTIER 4.1 data( front41Data ) sfaResult <- sfa( log( output ) ~ log( capital ) + log( labour ), data = front41Data ) coef( sfaResult, which = "ols" ) coef( sfaResult, which = "grid" ) coef( sfaResult )
# example included in FRONTIER 4.1 data( front41Data ) sfaResult <- sfa( log( output ) ~ log( capital ) + log( labour ), data = front41Data ) coef( sfaResult, which = "ols" ) coef( sfaResult, which = "grid" ) coef( sfaResult )
Extract the coefficients, their standard errors, z-values or t-values,
and (asymptotic) P-values
from stochastic frontier models returned by the summary
method
for objects of class frontier
.
## S3 method for class 'summary.frontier' coef( object, which = "mle", ... )
## S3 method for class 'summary.frontier' coef( object, which = "mle", ... )
object |
an object of class |
which |
character string. Which coefficients should be returned? ('ols' for coefficients estimated by OLS or 'mle' for coefficients estimated by Maximum Likelihood). |
... |
currently unused. |
The standard errors of the estimated parameters are taken from the direction matrix that is used in the final iteration of the Davidon-Fletcher-Powell procedure that is used for maximising the (log) likelihood function.
If argument which
of this method is "mle"
(the default)
and argument extraPar
of summary.frontier
is set to TRUE
,
some additional parameters, their standard errors, z-values,
and (asymptotic) P-values are returned
(see documentation of summary.frontier
,
coef.frontier
, or vcov.frontier
).
The standard errors of the additional parameters
are obtained by the delta method.
Please note that the delta method might provide poor approximations
of the ‘true’ standard errors,
because parameter is left-censored
and parameter
is both left-censored and right-censored
so that these parameters cannot be normally distributed.
Please note further
that the t statistic and the z statistic are not reliable
for testing the statistical signicance of ,
, and the ‘additional parameters’,
because these parameters are censored and cannot follow
a normal distribution or a t distribution.
The coef
method for objects of class summary.frontier
returns a matrix,
where the four columns contain the estimated
coefficients, their standard errors, z-values or t-values,
and (asymptotic) P-values.
Arne Henningsen
coef.frontier
, summary.frontier
,
vcov.frontier
, and sfa
.
# example included in FRONTIER 4.1 data( front41Data ) sfaResult <- sfa( log( output ) ~ log( capital ) + log( labour ), data = front41Data ) coef( summary( sfaResult ), which = "ols" ) coef( summary( sfaResult ) ) coef( summary( sfaResult, extraPar = TRUE ) )
# example included in FRONTIER 4.1 data( front41Data ) sfaResult <- sfa( log( output ) ~ log( capital ) + log( labour ), data = front41Data ) coef( summary( sfaResult ), which = "ols" ) coef( summary( sfaResult ) ) coef( summary( sfaResult, extraPar = TRUE ) )
This method returns the Pseudo-Cook's distances
from stochastic frontier models
estimated with the frontier package
(e.g., function sfa
).
## S3 method for class 'frontier' cooks.distance( model, target = "predict", asInData = FALSE, progressBar = TRUE, ... )
## S3 method for class 'frontier' cooks.distance( model, target = "predict", asInData = FALSE, progressBar = TRUE, ... )
model |
a stochastic frontier model
estimated with the frontier package
(e.g. function |
target |
character string.
If |
asInData |
logical. If |
progressBar |
logical. Should a progress bar be displayed while the Cook's distances are obtained? |
... |
additional arguments that arecurrently ignored
if argument |
A vector of the Pseudo-Cook's distances for each observation
that was used in the estimation that is provided as argument model
.
Arne Henningsen
# example included in FRONTIER 4.1 (cross-section data) data( front41Data ) # Cobb-Douglas production frontier cobbDouglas <- sfa( log( output ) ~ log( capital ) + log( labour ), data = front41Data ) summary( cobbDouglas ) # Pseudo-Cook's distances for predicted values cooks.distance( cobbDouglas ) # Pseudo-Cook's distances for efficiency estimates cooks.distance( cobbDouglas, "efficiencies" )
# example included in FRONTIER 4.1 (cross-section data) data( front41Data ) # Cobb-Douglas production frontier cobbDouglas <- sfa( log( output ) ~ log( capital ) + log( labour ), data = front41Data ) summary( cobbDouglas ) # Pseudo-Cook's distances for predicted values cooks.distance( cobbDouglas ) # Pseudo-Cook's distances for efficiency estimates cooks.distance( cobbDouglas, "efficiencies" )
This method returns efficiency estimates from frontier models.
efficiencies( object, ... ) ## Default S3 method: efficiencies( object, ... )
efficiencies( object, ... ) ## Default S3 method: efficiencies( object, ... )
object |
a frontier model. |
... |
further arguments for methods. |
This is a generic function.
The default method just returns the element
effic
from object
.
Arne Henningsen
This method returns efficiency estimates from stochastic frontier models
estimated with frontier
.
## S3 method for class 'frontier' efficiencies( object, asInData = FALSE, logDepVar = TRUE, minusU = farrell, farrell = TRUE, margEff = FALSE, newdata = NULL, ... )
## S3 method for class 'frontier' efficiencies( object, asInData = FALSE, logDepVar = TRUE, minusU = farrell, farrell = TRUE, margEff = FALSE, newdata = NULL, ... )
object |
a stochastic frontier model
returned by |
asInData |
logical. If |
logDepVar |
logical. Is the dependent variable logged? |
minusU |
logical. If |
farrell |
logical. This argument is only kept for backward compatibility and will be removed in the future. |
margEff |
logical. If |
newdata |
an optional data frame from which the values
of explanatory variables and the dependent variable are taken
to calculate the efficiency estimates.
If this argument is |
... |
currently ignored. |
If argument asInData
is FALSE
(default),
a matrix of efficiency estimates is returned,
where each row corresponds to a firm (cross-section unit)
and each column corresponds to a time period
(only if efficiency estimates differ between time periods).
If argument asInData
is TRUE
,
a vector of efficiency estimates is returned,
where the efficiency estimates are in the same order
as the corresponding observations in the data set
used for the estimation.
If argument margEff
is TRUE
,
and the model is an Efficiency Effects Frontier (EFF)
with variables,
and the dependent variable is logged,
the returned efficiency estimates have an attribute
"margEff"
that contains the marginal effects of the variables
on the efficiency measure.
If the dependent variable is logged,
the marginal effect of the th
variable on the efficiency is
where
in case of Farrell efficiencies
(i.e. efficiencies have values between between 0 and 1),
whereas
otherwise
(i.e. efficiencies have values larger than 1),
and
if inefficiency decreases the dependent variable,
whereas
otherwise
(see Olsen and Henningsen 2011).
If argument asInData
is FALSE
,
this attribute is a 3-dimensional array,
where the first dimension represents the individual firm,
the second dimension represents the time period,
and the third dimension represents the variables.
In contrast, if argument
asInData
is TRUE
,
this attribute is a matrix,
where the rows represent the observations
and the columns represent the variables.
Arne Henningsen
Olsen, Jakob Vesterlund and Arne Henningsen (2011): Investment utilization and farm efficiency in Danish agriculture. FOI working paper 2011/13, Institute of Food and Resource Economics, University of Copenhagen, http://EconPapers.repec.org/RePEc:foi:wpaper:2011_13.
sfa
, summary.frontier
,
and efficiencies
.
# rice producers in the Philippines (panel data) data( "riceProdPhil" ) library( "plm" ) riceProdPhil <- pdata.frame( riceProdPhil, c( "FMERCODE", "YEARDUM" ) ) # Error Components Frontier (Battese & Coelli 1992), no time effect rice <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ), data = riceProdPhil ) efficiencies( rice ) riceProdPhil$efficiencies <- efficiencies( rice, asInData = TRUE ) # efficiency of an 'average' farm efficiencies( rice, newdata = data.frame( t( colMeans( riceProdPhil[ , -c(1,2) ] ) ) ) ) # Error Components Frontier (Battese & Coelli 1992), with time effect riceTime <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ), data = riceProdPhil, timeEffect = TRUE ) efficiencies( riceTime ) riceProdPhil$efficienciesTime <- efficiencies( riceTime, asInData = TRUE ) # Technical Efficiency Effects Frontier (Battese & Coelli 1995) rice2 <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ) | EDYRS + BANRAT - 1, data = riceProdPhil ) eff <- efficiencies( rice2, margEff = TRUE ) attr( eff, "margEff" ) # marginal effects
# rice producers in the Philippines (panel data) data( "riceProdPhil" ) library( "plm" ) riceProdPhil <- pdata.frame( riceProdPhil, c( "FMERCODE", "YEARDUM" ) ) # Error Components Frontier (Battese & Coelli 1992), no time effect rice <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ), data = riceProdPhil ) efficiencies( rice ) riceProdPhil$efficiencies <- efficiencies( rice, asInData = TRUE ) # efficiency of an 'average' farm efficiencies( rice, newdata = data.frame( t( colMeans( riceProdPhil[ , -c(1,2) ] ) ) ) ) # Error Components Frontier (Battese & Coelli 1992), with time effect riceTime <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ), data = riceProdPhil, timeEffect = TRUE ) efficiencies( riceTime ) riceProdPhil$efficienciesTime <- efficiencies( riceTime, asInData = TRUE ) # Technical Efficiency Effects Frontier (Battese & Coelli 1995) rice2 <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ) | EDYRS + BANRAT - 1, data = riceProdPhil ) eff <- efficiencies( rice2, margEff = TRUE ) attr( eff, "margEff" ) # marginal effects
Calculate the elasticities of a quadratic or translog frontier function.
## S3 method for class 'frontierQuad' elas( object, data = NULL, dataLogged = TRUE, yObs = FALSE, ... )
## S3 method for class 'frontierQuad' elas( object, data = NULL, dataLogged = TRUE, yObs = FALSE, ... )
object |
object of class |
data |
dataframe containing the data; if it is not specified, the data frame that was used for the frontier estimation is used for calculating elasticities. |
dataLogged |
logical. Are the variables
(specified in arguments |
yObs |
logical. Use observed values of the endogenous variable.
If |
... |
currently ignored. |
This method internally calls the functions
translogEla
and
quadFuncEla
.
See documentation of translogEla
and
quadFuncEla
.
Arne Henningsen
frontierQuad
, translogEla
,
and quadFuncEla
.
# example included in FRONTIER 4.1 (cross-section data) data( front41Data ) front41Data$logOutput <- log( front41Data$output ) front41Data$logCapital <- log( front41Data$capital ) front41Data$logLabour <- log( front41Data$labour ) translog <- frontierQuad( yName = "logOutput", xNames = c( "logCapital", "logLabour" ), data = front41Data ) elas( translog )
# example included in FRONTIER 4.1 (cross-section data) data( front41Data ) front41Data$logOutput <- log( front41Data$output ) front41Data$logCapital <- log( front41Data$capital ) front41Data$logLabour <- log( front41Data$labour ) translog <- frontierQuad( yName = "logOutput", xNames = c( "logCapital", "logLabour" ), data = front41Data ) elas( translog )
This method returns the fitted and predicted “frontier” values
from stochastic frontier models
estimated with the frontier package
(e.g. function sfa
).
## S3 method for class 'frontier' fitted( object, asInData = FALSE, ... ) ## S3 method for class 'frontier' predict( object, newdata = NULL, asInData = TRUE, ... )
## S3 method for class 'frontier' fitted( object, asInData = FALSE, ... ) ## S3 method for class 'frontier' predict( object, newdata = NULL, asInData = TRUE, ... )
object |
a stochastic frontier model
estimated with the frontier package
(e.g. function |
newdata |
an optional data frame from which the explanatory variables
are used to calculate the predicted “frontier” values.
If this argument is |
asInData |
logical. If |
... |
currently ignored. |
If argument asInData
is FALSE
,
a matrix of the fitted or predicted values is returned,
where each row corresponds to a firm (cross-section unit)
and each column corresponds to a time period.
If argument asInData
is TRUE
,
a vector of fitted or predicted values is returned,
where the fitted values are in the same order
as the corresponding observations in the data set
used for the estimation
or the data set specified by argument newdata
.
Arne Henningsen
# rice producers in the Philippines (panel data) data( "riceProdPhil" ) library( "plm" ) riceProdPhil <- pdata.frame( riceProdPhil, c( "FMERCODE", "YEARDUM" ) ) # Error Components Frontier (Battese & Coelli 1992), no time effect rice <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ), data = riceProdPhil ) fitted( rice ) riceProdPhil$fitted <- fitted( rice, asInData = TRUE ) # Error Components Frontier (Battese & Coelli 1992), with time effect riceTime <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ), data = riceProdPhil, timeEffect = TRUE ) fitted( riceTime ) riceProdPhil$fittedTime <- fitted( riceTime, asInData = TRUE )
# rice producers in the Philippines (panel data) data( "riceProdPhil" ) library( "plm" ) riceProdPhil <- pdata.frame( riceProdPhil, c( "FMERCODE", "YEARDUM" ) ) # Error Components Frontier (Battese & Coelli 1992), no time effect rice <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ), data = riceProdPhil ) fitted( rice ) riceProdPhil$fitted <- fitted( rice, asInData = TRUE ) # Error Components Frontier (Battese & Coelli 1992), with time effect riceTime <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ), data = riceProdPhil, timeEffect = TRUE ) fitted( riceTime ) riceProdPhil$fittedTime <- fitted( riceTime, asInData = TRUE )
The front41Data
data frame contains cross-sectional data of 60 firms.
data(front41Data)
data(front41Data)
This data frame contains the following columns:
firm ID.
output quantity (value added).
capital input quantity (quantity index).
labour input quantity (quantity index).
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.php, University of New England.
Estimate a stochastic frontier model with a modified version of Tim Coelli's program Frontier 4.1 (NOTE: this program has to be installed separately!).
front41Est( command = ifelse( .Platform$OS.type == "windows", "front41.exe", "front41.bin" ), ... )
front41Est( command = ifelse( .Platform$OS.type == "windows", "front41.exe", "front41.bin" ), ... )
command |
command to call the modified version of FRONTIER 4.1 (see details). |
... |
arguments passed to |
Using the command front41Est
requires the installation
of a modified version of Tim Coelli's FRONTIER 4.1.
It is available on
http://frontier.r-forge.r-project.org/front41.html.
as (FORTRAN) source code
and (executable) binaries for GNU/Linux and MS-Windows.
front41Est
returns a list of class front41Output
that is returned by front41ReadOutput
with two additional elements:
input |
object returned by |
messages |
messages returned by FRONTIER 4.1. |
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.php, University of New England.
front41WriteInput
, front41ReadOutput
data( front41Data ) front41Data$logOutput <- log( front41Data$output ) front41Data$logCapital <- log( front41Data$capital ) front41Data$logLabour <- log( front41Data$labour ) ## Not run: front41Est( data = front41Data, crossSectionName = "firm", yName = "logOutput", xNames = c( "logCapital", "logLabour" ) ) ## End(Not run)
data( front41Data ) front41Data$logOutput <- log( front41Data$output ) front41Data$logCapital <- log( front41Data$capital ) front41Data$logLabour <- log( front41Data$labour ) ## Not run: front41Est( data = front41Data, crossSectionName = "firm", yName = "logOutput", xNames = c( "logCapital", "logLabour" ) ) ## End(Not run)
Read the output file of Tim Coelli's program Frontier 4.1 that performs stochastic frontier analysis.
front41ReadOutput( file = "front41.out" ) ## S3 method for class 'front41Output' print( x, efficiencies = FALSE, ... )
front41ReadOutput( file = "front41.out" ) ## S3 method for class 'front41Output' print( x, efficiencies = FALSE, ... )
file |
character variable with the name of the file to read. |
x |
object of class |
efficiencies |
logical. Print all efficiency estimates?
(If |
... |
currently ignored. |
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.
a list of class front41Output
containing following objects:
version |
the version of Frontier 4.1 that produced the output. |
insFile |
name of the instruction file used by Frontier 4.1. |
dtaFile |
name of the data file used by Frontier 4.1. |
modelType |
model type: either 1 for 'Error Components Frontier' or 2 for 'Tech. Eff. Effects Frontier'. |
modelTypeName |
model type: 'Error Components Frontier' or 'Tech. Eff. Effects Frontier'. |
functionType |
function type: either 1 for 'production function' or 2 for 'cost function'. |
functionTypeName |
function type: 'production function' or 'cost function'. |
logDepVar |
logical. Is the dependent variable logged. |
olsResults |
results of the OLS estimation. |
nXvars |
number X variables (exogenous variables of the production or cost function. |
olsLogl |
log likelihood value of the OLS estimation. |
gridResults |
results of the grid search. |
mleResults |
results of the maximum likelihood estimation. |
mleLogl |
log likelihood value of the maximum likelihood estimation. |
mleCov |
coefficient covariance matrix of the maximum likelihood estimation. |
lrTest |
LR test of the one-sided error. |
lrTestRestrict |
number of restrictions of the LR test. |
nIter |
number of iterations. |
maxIter |
maximum number of iterations set. |
nCross |
number of cross-sections. |
nPeriods |
umber of time periods. |
nObs |
total number of observations. |
nObsMissing |
number of observations that are not in the panel. |
efficiency |
technical efficiency estimates. |
meanEfficiency |
mean efficiency. |
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.php, University of New England.
# read the output file that is provided with Frontier 4.1 outFile <- system.file( "front41/EG1.OUT", package = "frontier" ) sfa <- front41ReadOutput( outFile ) print( sfa, efficiencies = TRUE ) # perform an SFA and read the output 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" ), path = tempdir(), insFile = "coelli.ins" ) ## Not run: system( paste0( "cd ", tempdir(), "; front41.bin coelli.ins" ) ) sfa <- front41ReadOutput( file.path( tempdir(), "coelli.out" ) ) summary( sfa ) ## End(Not run)
# read the output file that is provided with Frontier 4.1 outFile <- system.file( "front41/EG1.OUT", package = "frontier" ) sfa <- front41ReadOutput( outFile ) print( sfa, efficiencies = TRUE ) # perform an SFA and read the output 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" ), path = tempdir(), insFile = "coelli.ins" ) ## Not run: system( paste0( "cd ", tempdir(), "; front41.bin coelli.ins" ) ) sfa <- front41ReadOutput( file.path( tempdir(), "coelli.out" ) ) summary( sfa ) ## End(Not run)
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.
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, path = ".", 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 )
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, path = ".", 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). |
path |
path in which the instruction file, the data file, and the start-up file should be written. |
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.php, University of New England.
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" ), path = tempdir(), insFile = "coelli.ins" ) ## Not run: system( paste0( "cd ", tempdir(), "; front41.bin coelli.ins" ) ) sfa <- front41ReadOutput( file.path( tempdir(), "coelli.out" ) ) summary( sfa ) ## End(Not run)
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" ), path = tempdir(), insFile = "coelli.ins" ) ## Not run: system( paste0( "cd ", tempdir(), "; front41.bin coelli.ins" ) ) sfa <- front41ReadOutput( file.path( tempdir(), "coelli.out" ) ) summary( sfa ) ## End(Not run)
This is a convenient interface for estimating
quadratic or translog stochastic frontier functions
using frontier
.
frontierQuad( yName, xNames, shifterNames = NULL, zNames = NULL, data, lrTests = FALSE, ... )
frontierQuad( yName, xNames, shifterNames = NULL, zNames = NULL, data, lrTests = FALSE, ... )
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) that should be included as linear, quadratic, and interaction terms. |
shifterNames |
a vector of strings containing the names of the X variables that should be included as shifters only (not in quadratic or interaction terms). |
zNames |
a vector of strings containing the names of the Z variables (variables explaining the efficiency level). |
data |
a (panel) data frame that contains the data;
if |
lrTests |
logical. If |
... |
further arguments passed to |
frontierQuad
returns a list of class frontierQuad
(and frontier
)
containing the same elements as returned by frontier
.
If argument lrTest
is set to TRUE
,
the returned object has a component lrTests
that contains the results of likelihood-ratio tests
of the statistical significance of each X variable.
Arne Henningsen
# example included in FRONTIER 4.1 (cross-section data) data( front41Data ) front41Data$logOutput <- log( front41Data$output ) front41Data$logCapital <- log( front41Data$capital ) front41Data$logLabour <- log( front41Data$labour ) # estimate the translog function translog <- frontierQuad( yName = "logOutput", xNames = c( "logCapital", "logLabour" ), data = front41Data ) translog # estimate the same model using sfa() translog2 <- sfa( logOutput ~ logCapital + logLabour + I( 0.5 * logCapital^2 ) + I( logCapital * logLabour ) + I( 0.5 * logLabour^2 ), data = front41Data ) translog2 all.equal( coef( translog ), coef( translog2 ), check.attributes = FALSE )
# example included in FRONTIER 4.1 (cross-section data) data( front41Data ) front41Data$logOutput <- log( front41Data$output ) front41Data$logCapital <- log( front41Data$capital ) front41Data$logLabour <- log( front41Data$labour ) # estimate the translog function translog <- frontierQuad( yName = "logOutput", xNames = c( "logCapital", "logLabour" ), data = front41Data ) translog # estimate the same model using sfa() translog2 <- sfa( logOutput ~ logCapital + logLabour + I( 0.5 * logCapital^2 ) + I( logCapital * logLabour ) + I( 0.5 * logLabour^2 ), data = front41Data ) translog2 all.equal( coef( translog ), coef( translog2 ), check.attributes = FALSE )
This is a convenient interface for estimating
translog stochastic ray frontier models
using frontier
.
frontierTranslogRay( yNames, xNames, shifterNames = NULL, zNames = NULL, data, ... )
frontierTranslogRay( yNames, xNames, shifterNames = NULL, zNames = NULL, data, ... )
yNames |
a vector of two or more character strings containing the names of the output variables. |
xNames |
a vector of strings containing the names of the input variables that should be included as linear, quadratic, and interaction terms. |
shifterNames |
a vector of strings containing the names of the explanatory variables that should be included as shifters only (not in quadratic or interaction terms). |
zNames |
a vector of strings containing the names of the Z variables (variables explaining the efficiency level). |
data |
a (panel) data frame that contains the data
(see documentation of |
... |
further arguments passed to |
frontierTranslogRay
returns a list of class frontierTranslogRay
(as well as frontierQuad
and frontier
)
containing almost the same elements as returned by frontier
.
Additionally, it includes following objects:
distance |
the “distance” from the origin (zero) to the point of the dependent variables. |
theta_i |
the “direction” from the origin (zero)
to the point of the dependent variables
(with |
Arne Henningsen and Geraldine Henningsen
Löthgren, M. (1997) Generalized stochastic frontier production models, Economics Letters, 57, 255-259.
Löthgren, M. (1997) A Multiple Output Stochastic Ray Frontier Production Model, Working Paper Series in Economics and Finance, No. 158, Stockholm School of Economics.
Löthgren, M. (2000) Specification and estimation of stochastic multiple-output production and technical inefficiency Applied Economics, 32, 1533-1540.
## preparing data data( germanFarms ) # quantity of crop outputs germanFarms$qCrop <- germanFarms$vCrop / germanFarms$pOutput # quantity of animal outputs germanFarms$qAnimal <- germanFarms$vAnimal / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # estimate a translog ray production function estResultRay <- frontierTranslogRay( yNames = c( "qCrop", "qAnimal" ), xNames = c( "qLabor", "land", "qVarInput" ), data = germanFarms ) summary( estResultRay )
## preparing data data( germanFarms ) # quantity of crop outputs germanFarms$qCrop <- germanFarms$vCrop / germanFarms$pOutput # quantity of animal outputs germanFarms$qAnimal <- germanFarms$vAnimal / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # estimate a translog ray production function estResultRay <- frontierTranslogRay( yNames = c( "qCrop", "qAnimal" ), xNames = c( "qLabor", "land", "qVarInput" ), data = germanFarms ) summary( estResultRay )
Extract the log-likelihood value(s) from stochastic frontier models
returned by frontier
.
## S3 method for class 'frontier' logLik( object, which = "mle", newParam = NULL, ... )
## S3 method for class 'frontier' logLik( object, which = "mle", newParam = NULL, ... )
object |
an object of class |
which |
character string. Which log-likelihood value should be returned? 'ols' for the log-likelihood value of the parameters estimated by OLS, 'grid' for the log-likelihood value of the parameters obtained by the grid search (only if no starting values were provided), 'start' for the log-likelihood value of the starting values of the parameters specified by the user (only if starting values were provided), or 'mle' for the log-likelihood values of the parameters estimated by Maximum Likelihood. |
newParam |
optional vector of parameters.
If this argument is provided by the user, the log-likelihood value
of the model |
... |
currently unused. |
logLik.frontier
returns an object of class logLik
,
which is a numeric scalar (the log-likelihood value) with 2 attributes:
nobs
(total number of observations in all equations) and
df
(number of free parameters, i.e. length of the coefficient vector).
Arne Henningsen
# example included in FRONTIER 4.1 data( front41Data ) # SFA estimation with starting values obtained from a grid search sfaResult <- sfa( log( output ) ~ log( capital ) + log( labour ), data = front41Data ) logLik( sfaResult, which = "ols" ) logLik( sfaResult, which = "grid" ) logLik( sfaResult ) # SFA estimation with starting values provided by the user sfaResult2 <- sfa( log( output ) ~ log( capital ) + log( labour ), data = front41Data, startVal = 0.9 * coef( sfaResult ) ) logLik( sfaResult2, which = "ols" ) logLik( sfaResult2, which = "start" ) logLik( sfaResult2 ) # evaluate log likelihood function for a user-provided parameter vector logLik( sfaResult, newParam = 0.9 * coef( sfaResult ) ) # equal to logLik( sfaResult2, which = "start" ) # log likelihood function for different values of gamma plot( t( sapply( seq( 0.05, 0.95, 0.05 ), function(x) c( x, logLik( sfaResult, newParam = c( coef( sfaResult )[1:4], x ) ) ) ) ) )
# example included in FRONTIER 4.1 data( front41Data ) # SFA estimation with starting values obtained from a grid search sfaResult <- sfa( log( output ) ~ log( capital ) + log( labour ), data = front41Data ) logLik( sfaResult, which = "ols" ) logLik( sfaResult, which = "grid" ) logLik( sfaResult ) # SFA estimation with starting values provided by the user sfaResult2 <- sfa( log( output ) ~ log( capital ) + log( labour ), data = front41Data, startVal = 0.9 * coef( sfaResult ) ) logLik( sfaResult2, which = "ols" ) logLik( sfaResult2, which = "start" ) logLik( sfaResult2 ) # evaluate log likelihood function for a user-provided parameter vector logLik( sfaResult, newParam = 0.9 * coef( sfaResult ) ) # equal to logLik( sfaResult2, which = "start" ) # log likelihood function for different values of gamma plot( t( sapply( seq( 0.05, 0.95, 0.05 ), function(x) c( x, logLik( sfaResult, newParam = c( coef( sfaResult )[1:4], x ) ) ) ) ) )
Testing parameter restrictions in stochastic frontier models by a Likelihood Ratio test.
## S3 method for class 'frontier' lrtest( object, ... )
## S3 method for class 'frontier' lrtest( object, ... )
object |
a fitted model object of class |
... |
further fitted model objects of class |
If lrtest.frontier
is called with only one argument/object
(i.e. argument ...
is not used),
it compares the fitted model to a corresponding model
without inefficiency (i.e. estimated by OLS).
If lrtest.frontier
is called with more than one argument/object
(i.e. argument ...
is used),
it consecutively compares
the fitted model object object
with the models passed in ...
.
The test statistic is
2 * ( logLik( mu ) - logLik( mr ) )
,
where mu
is the unrestricted model
and mr
is the restricted model.
If a Frontier model (estimated by ML) is compared to
a model without inefficiency (estimated by OLS),
the test statistic asymptotically has a mixed distribution
under the null hypothesis (see Coelli, 1995).
If two Frontier models (estimated by ML) are compared,
the test statistic asymptotically has a
distribution with
degrees of freedom
under the null hypothesis,
where
is the number of restrictions.
An object of class anova
,
which contains the log-likelihood value,
degrees of freedom, the difference in degrees of freedom,
likelihood ratio Chi-squared statistic and corresponding p value.
See documentation of lrtest
in package "lmtest".
Arne Henningsen
Coelli, T.J. (1995), Estimators and Hypothesis Tests for a Stochastic: A Monte Carlo Analysis, Journal of Productivity Analysis, 6, 247-268.
# rice producers in the Philippines (panel data) data( "riceProdPhil" ) library( "plm" ) riceProdPhil <- pdata.frame( riceProdPhil, c( "FMERCODE", "YEARDUM" ) ) # Error Components Frontier with truncated normal distribution # and time effects (unrestricted model) mu <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ), truncNorm = TRUE, timeEffect = TRUE, data = riceProdPhil ) # Error Components Frontier with half-normal distribution # without time effects (restricted model) mr <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ), data = riceProdPhil ) ## compare the two models by an LR-test lrtest( mu, mr ) ## compare each of the models to a corresponding model without inefficiency lrtest( mu ) lrtest( mr )
# rice producers in the Philippines (panel data) data( "riceProdPhil" ) library( "plm" ) riceProdPhil <- pdata.frame( riceProdPhil, c( "FMERCODE", "YEARDUM" ) ) # Error Components Frontier with truncated normal distribution # and time effects (unrestricted model) mu <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ), truncNorm = TRUE, timeEffect = TRUE, data = riceProdPhil ) # Error Components Frontier with half-normal distribution # without time effects (restricted model) mr <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ), data = riceProdPhil ) ## compare the two models by an LR-test lrtest( mu, mr ) ## compare each of the models to a corresponding model without inefficiency lrtest( mu ) lrtest( mr )
Generalized Ramsey's RESET test (REgression Specification Error Test) for misspecification of the functional form based on a Likelihood Ratio test.
resettestFrontier( object, power = 2:3 )
resettestFrontier( object, power = 2:3 )
object |
a fitted model object of class |
power |
a vector indicating the powers of the fitted variables that should be included as additional explanatory variables. By default, the test is for quadratic or cubic influence of the fitted response. |
An object of class anova
as returned by lrtest.frontier
.
Arne Henningsen
Ramsey, J.B. (1969), Tests for Specification Error in Classical Linear Least Squares Regression Analysis. Journal of the Royal Statistical Society, Series B 31, 350-371.
sfa
, resettest
, and
lrtest.frontier
# load data set data( front41Data ) # estimate a Cobb-Douglas production frontier cobbDouglas <- sfa( log( output ) ~ log( capital ) + log( labour ), data = front41Data ) # conduct the RESET test resettestFrontier( cobbDouglas )
# load data set data( front41Data ) # estimate a Cobb-Douglas production frontier cobbDouglas <- sfa( log( output ) ~ log( capital ) + log( labour ), data = front41Data ) # conduct the RESET test resettestFrontier( cobbDouglas )
This method returns the residuals from stochastic frontier models
estimated with the frontier package
(e.g. function sfa
).
## S3 method for class 'frontier' residuals( object, asInData = FALSE, ... )
## S3 method for class 'frontier' residuals( object, asInData = FALSE, ... )
object |
a stochastic frontier model
estimated with the frontier package
(e.g. function |
asInData |
logical. If |
... |
currently ignored. |
If argument asInData
is FALSE
(default),
a matrix of the residuals is returned,
where each row corresponds to a firm (cross-section unit)
and each column corresponds to a time period.
If argument asInData
is TRUE
,
a vector of residuals is returned,
where the residuals are in the same order
as the corresponding observations in the data set
used for the estimation.
Arne Henningsen
# rice producers in the Philippines (panel data) data( "riceProdPhil" ) library( "plm" ) riceProdPhil <- pdata.frame( riceProdPhil, c( "FMERCODE", "YEARDUM" ) ) # Error Components Frontier (Battese & Coelli 1992), no time effect rice <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ), data = riceProdPhil ) residuals( rice ) riceProdPhil$residuals <- residuals( rice, asInData = TRUE ) # Error Components Frontier (Battese & Coelli 1992), with time effect riceTime <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ), data = riceProdPhil, timeEffect = TRUE ) residuals( riceTime ) riceProdPhil$residualsTime <- residuals( riceTime, asInData = TRUE )
# rice producers in the Philippines (panel data) data( "riceProdPhil" ) library( "plm" ) riceProdPhil <- pdata.frame( riceProdPhil, c( "FMERCODE", "YEARDUM" ) ) # Error Components Frontier (Battese & Coelli 1992), no time effect rice <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ), data = riceProdPhil ) residuals( rice ) riceProdPhil$residuals <- residuals( rice, asInData = TRUE ) # Error Components Frontier (Battese & Coelli 1992), with time effect riceTime <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ), data = riceProdPhil, timeEffect = TRUE ) residuals( riceTime ) riceProdPhil$residualsTime <- residuals( riceTime, asInData = TRUE )
The riceProdPhil
data frame contains annual data collected from
43 smallholder rice producers in the Tarlac region of the Philippines
between 1990 and 1997.
data( riceProdPhil )
data( riceProdPhil )
This data frame contains the following variables (columns):
Time period (1= 1990, ..., 8 = 1997).
Farmer code (1, ..., 43).
Output (tonnes of freshly threshed rice).
Area planted (hectares).
Labour used (man-days of family and hired labour).
Fertiliser used (kg of active ingredients).
Other inputs used (Laspeyres index = 100 for Firm 17 in 1991).
Output price (pesos per kg).
Rental price of land (pesos per hectare).
Labour price (pesos per hired man-day.
Fertiliser price (pesos per kg of active ingredient).
Price of other inputs (implicit price index).
Age of the household head (years).
Education of the household head (years).
Household size.
Number of adults in the household.
Percentage of area classified as bantog (upland) fields.
This data set is published as supplement to Coelli et al. (2005). While most variables of this data set were supplied by the International Rice Research Institute (IRRI), some were calculated by Coelli et al. (2005, see p. 325–326). The survey is described in Pandey et al. (1999).
Supplementary files for Coelli et al. (2005), http://www.uq.edu.au/economics/cepa/crob2005/software/CROB2005.zip
Coelli, T. J., Rao, D. S. P., O'Donnell, C. J., and Battese, G. E. (2005) An Introduction to Efficiency and Productivity Analysis, Springer, New York.
Pandey, S., Masciat, P., Velasco, L, and Villano, R. (1999) Risk analysis of a rainfed rice production system system in Tarlac, Central Luzon, Philippines, Experimental Agriculture, 35, 225-237.
Maximum Likelihood Estimation of Stochastic Frontier Production and Cost Functions. Two specifications are available: the error components specification with time-varying efficiencies (Battese and Coelli 1992) and a model specification in which the firm effects are directly influenced by a number of variables (Battese and Coelli 1995). This R package uses the Fortran source code of Frontier 4.1 (Coelli 1996).
sfa( formula, data = sys.frame( sys.parent() ), ineffDecrease = TRUE, truncNorm = FALSE, timeEffect = FALSE, startVal = NULL, tol = 0.00001, maxit = 1000, minit = min( 5, maxit ), muBound = 2, bignum = 1.0E+16, searchStep = 0.00001, searchTol = 0.001, searchScale = NA, gridSize = 0.1, gridDouble = TRUE, restartMax = 10, restartFactor = 0.999, printIter = 0 ) frontier( yName, xNames = NULL, zNames = NULL, data, zIntercept = FALSE, ... ) ## S3 method for class 'frontier' print( x, digits = NULL, ... )
sfa( formula, data = sys.frame( sys.parent() ), ineffDecrease = TRUE, truncNorm = FALSE, timeEffect = FALSE, startVal = NULL, tol = 0.00001, maxit = 1000, minit = min( 5, maxit ), muBound = 2, bignum = 1.0E+16, searchStep = 0.00001, searchTol = 0.001, searchScale = NA, gridSize = 0.1, gridDouble = TRUE, restartMax = 10, restartFactor = 0.999, printIter = 0 ) frontier( yName, xNames = NULL, zNames = NULL, data, zIntercept = FALSE, ... ) ## S3 method for class 'frontier' print( x, digits = NULL, ... )
formula |
a symbolic description of the model to be estimated; it can be either a (usual) one-part or a two-part formula (see section ‘Details’). |
data |
a (panel) data frame that contains the data;
if |
ineffDecrease |
logical. If |
truncNorm |
logical. If |
timeEffect |
logical. If |
startVal |
numeric vector. Optional starting values for the ML estimation. |
tol |
numeric. Convergence tolerance (proportional). |
maxit |
numeric. Maximum number of iterations permitted. |
minit |
numeric. Minimum number of iterations (ignored if the search procedure cannot find parameter values that give a higher log-likelihood value than the current parameter values). |
muBound |
numeric. Bounds on the parameter |
bignum |
numeric. Used to set bounds on densities and distributions. |
searchStep |
numeric. Size of the first step in the Coggin uni-dimensional search procedure done each iteration to determine the optimal step length for the next iteration (see Himmelblau 1972). |
searchTol |
numeric. Tolerance used in the Coggin uni-dimensional search procedure done each iteration to determine the optimal step length for the next iteration (see Himmelblau 1972). |
searchScale |
logical or |
gridSize |
numeric. The size of the increment
in the first phase grid search on |
gridDouble |
logical. If |
restartMax |
integer: maximum number of restarts of the search procedure when it cannot find a parameter vector that results in a log-likelihood value larger than the log-likelihood value of the initial parameters. |
restartFactor |
numeric scalar: if the search procedure
cannot find a parameter vector that results in a log-likelihood value
larger than the log-likelihood value of the initial parameters,
the initial values
(provided by argument |
printIter |
numeric. Print info every |
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). |
zNames |
a vector of strings containing the names of the Z variables (variables explaining the efficiency level). |
zIntercept |
logical. If |
x |
an object of class |
digits |
a non-null value for ‘digits’ specifies
the minimum number of significant digits to be printed in values.
The default, |
... |
additional arguments of |
Function frontier
is a wrapper function
that calls sfa
for the estimation.
The two functions differ only in the user interface;
function frontier
has the “old” user interface
and is kept to maintain compatibility with older versions
of the frontier
package.
One can use functions sfa
and frontier
to calculate the log likelihood value for a given model,
a given data set, and given parameters
by using the argument startVal
to specify the parameters
and using the other arguments to specify the model and the data.
The log likelihood value can then be retrieved by
the logLik
method
with argument which
set to "start"
.
Setting argument maxit
to 0
avoids the
(eventually time-consuming) ML estimation and allows
to retrieve the log likelihood value
with the logLik
method
without further arguments.
The frontier
function uses the Fortran source code of
Tim Coelli's software FRONTIER 4.1
(http://www.uq.edu.au/economics/cepa/frontier.htm)
and hence, provides the same features as FRONTIER 4.1.
A comprehensive documentation of FRONTIER 4.1 is available
in the file Front41.pdf
that is included in the archive FRONT41-xp1.zip
,
which is available at
http://www.uq.edu.au/economics/cepa/frontier.htm.
It is recommended to read this documentation,
because the frontier
function is based on the FRONTIER 4.1 software.
If argument formula
of sfa
is a (usual) one-part formula
(or argument zNames
of frontier
is NULL
),
an ‘Error Components Frontier’ (ECF, see Battese and Coelli 1992)
is estimated.
If argument formula
is a two-part formula
(or zNames
is not NULL
),
an ‘Efficiency Effects Frontier’ (EEF, see Battese and Coelli 1995)
is estimated.
In this case, the first part of the formula
(i.e. the part before the “|” symbol)
is used to explain the endogenous variable directly (X variables),
while the second part of the formula
(i.e. the part after the “|” symbol)
is used to explain the efficiency levels (Z variables).
Generally, there should be no reason for estimating an EEF
without Z variables,
but this can done by setting the second part of argument formula
to 1
(with Z intercept) or - 1
(without Z intercept)
(or by setting argument zNames
) to NA
).
In case of an Error Components Frontier (ECF)
with the inefficiency terms following a
truncated normal distribution with mean
,
argument
muBound
can be used to restrict
to be in the interval
muBound
* ,
where
is the standard deviation of
.
If
muBound
is infinity, zero, or negative,
no bounds on are imposed.
sfa
and frontier
return a list of class frontier
containing following elements:
modelType |
integer. A ‘1’ denotes an ‘Error Components Frontier’ (ECF); a ‘2’ denotes an ‘Efficiency Effects Frontier’ (EFF). |
ineffDecrease |
logical. Argument |
nn |
number of cross-sections. |
nt |
number of time periods. |
nob |
number of observations in total. |
nb |
number of regressor variables (Xs). |
truncNorm |
logical. Argument |
zIntercept |
logical. Argument |
timeEffect |
logical. Argument |
printIter |
numeric. Argument |
searchScale |
numeric. Argument |
tol |
numeric. Argument |
searchTol |
numeric. Argument |
bignum |
numeric. Argument |
searchStep |
numeric. Argument |
gridDouble |
logical. Argument |
gridSize |
numeric. Argument |
maxit |
numeric. Argument |
muBound |
numeric. Argument |
restartMax |
numeric. Argument |
restartFactor |
numeric. Argument |
nRestart |
numeric. Number of restarts of the search procedure when it cannot find a parameter vector that results in a log-likelihood value larger than the log-likelihood value of the initial parameters. |
startVal |
numeric vector. Argument |
call |
the matched call. |
dataTable |
matrix. Data matrix sent to Frontier 4.1. |
olsParam |
numeric vector. OLS estimates. |
olsStdEr |
numeric vector. Standard errors of OLS estimates. |
olsLogl |
numeric. Log likelihood value of OLS estimation. |
olsResid |
numeric vector. Residuals of the OLS estimation. |
olsSkewness |
numeric. Skewness of the residuals of the OLS estimation. |
olsSkewnessOkay |
logical. Indicating if the residuals of the OLS estimation have the expected skewness. |
gridParam |
numeric vector. Parameters obtained from the grid search (if no starting values were specified). |
gridLogl |
numeric. Log likelihood value of the parameters obtained from the grid search (only if no starting values were specified). |
startLogl |
numeric. Log likelihood value of the starting values for the parameters (only if starting values were specified). |
mleParam |
numeric vector. Parameters obtained from ML estimation. |
mleCov |
matrix. Covariance matrix of the parameters obtained from the OLS estimation. |
mleLogl |
numeric. Log likelihood value of the ML estimation. |
nIter |
numeric. Number of iterations of the ML estimation. |
code |
integer indication the reason for determination:
|
nFuncEval |
Number of evaluations of the log likelihood function during the grid search and the iterative ML estimation. |
fitted |
matrix. Fitted “frontier” values of the dependent variable: each row corresponds to a cross-section; each column corresponds to a time period. |
resid |
matrix. Residuals: each row corresponds to a cross-section; each column corresponds to a time period. |
validObs |
vector of logical values indicating which observations
of the provided data were used for the estimation,
i.e. do not have values that are not available ( |
Tim Coelli and 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.php, University of New England.
Himmelblau, D.M. (1972), Applied Non-Linear Programming, McGraw-Hill, New York.
frontierQuad
for quadratic/translog frontiers,
summary.frontier
for creating and printing summary results,
efficiencies.frontier
for calculating efficiency estimates,
lrtest.frontier
for comparing models by LR tests,
fitted.frontier
for obtaining the fitted “frontier” values,
ang residuals.frontier
for obtaining the residuals.
# example included in FRONTIER 4.1 (cross-section data) data( front41Data ) # Cobb-Douglas production frontier cobbDouglas <- sfa( log( output ) ~ log( capital ) + log( labour ), data = front41Data ) summary( cobbDouglas ) # load data about rice producers in the Philippines (panel data) data( riceProdPhil ) # Error Components Frontier (Battese & Coelli 1992) # with observation-specific efficiencies (ignoring the panel structure) rice <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ), data = riceProdPhil ) summary( rice ) # Error Components Frontier (Battese & Coelli 1992) # with "true" fixed individual effects and observation-specific efficiencies riceTrue <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ) + factor( FMERCODE ), data = riceProdPhil ) summary( riceTrue ) # add data set with information about its panel structure library( "plm" ) ricePanel <- pdata.frame( riceProdPhil, c( "FMERCODE", "YEARDUM" ) ) # Error Components Frontier (Battese & Coelli 1992) # with time-invariant efficiencies riceTimeInv <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ), data = ricePanel ) summary( riceTimeInv ) # Error Components Frontier (Battese & Coelli 1992) # with time-variant efficiencies riceTimeVar <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ), data = ricePanel, timeEffect = TRUE ) summary( riceTimeVar ) # Technical Efficiency Effects Frontier (Battese & Coelli 1995) # (efficiency effects model with intercept) riceZ <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ) | EDYRS + BANRAT, data = riceProdPhil ) summary( riceZ ) # Technical Efficiency Effects Frontier (Battese & Coelli 1995) # (efficiency effects model without intercept) riceZ2 <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ) | EDYRS + BANRAT - 1, data = riceProdPhil ) summary( riceZ2 ) # Cost Frontier (with land as quasi-fixed input) riceProdPhil$cost <- riceProdPhil$LABOR * riceProdPhil$LABORP + riceProdPhil$NPK * riceProdPhil$NPKP riceCost <- sfa( log( cost ) ~ log( PROD ) + log( AREA ) + log( LABORP ) + log( NPKP ), data = riceProdPhil, ineffDecrease = FALSE ) summary( riceCost )
# example included in FRONTIER 4.1 (cross-section data) data( front41Data ) # Cobb-Douglas production frontier cobbDouglas <- sfa( log( output ) ~ log( capital ) + log( labour ), data = front41Data ) summary( cobbDouglas ) # load data about rice producers in the Philippines (panel data) data( riceProdPhil ) # Error Components Frontier (Battese & Coelli 1992) # with observation-specific efficiencies (ignoring the panel structure) rice <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ), data = riceProdPhil ) summary( rice ) # Error Components Frontier (Battese & Coelli 1992) # with "true" fixed individual effects and observation-specific efficiencies riceTrue <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ) + factor( FMERCODE ), data = riceProdPhil ) summary( riceTrue ) # add data set with information about its panel structure library( "plm" ) ricePanel <- pdata.frame( riceProdPhil, c( "FMERCODE", "YEARDUM" ) ) # Error Components Frontier (Battese & Coelli 1992) # with time-invariant efficiencies riceTimeInv <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ), data = ricePanel ) summary( riceTimeInv ) # Error Components Frontier (Battese & Coelli 1992) # with time-variant efficiencies riceTimeVar <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ), data = ricePanel, timeEffect = TRUE ) summary( riceTimeVar ) # Technical Efficiency Effects Frontier (Battese & Coelli 1995) # (efficiency effects model with intercept) riceZ <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ) | EDYRS + BANRAT, data = riceProdPhil ) summary( riceZ ) # Technical Efficiency Effects Frontier (Battese & Coelli 1995) # (efficiency effects model without intercept) riceZ2 <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ) | EDYRS + BANRAT - 1, data = riceProdPhil ) summary( riceZ2 ) # Cost Frontier (with land as quasi-fixed input) riceProdPhil$cost <- riceProdPhil$LABOR * riceProdPhil$LABORP + riceProdPhil$NPK * riceProdPhil$NPKP riceCost <- sfa( log( cost ) ~ log( PROD ) + log( AREA ) + log( LABORP ) + log( NPKP ), data = riceProdPhil, ineffDecrease = FALSE ) summary( riceCost )
summary.front41Output
summarizes the estimation results
of a model estimated by Frontier 4.1..
## S3 method for class 'front41Output' summary( object, ... ) ## S3 method for class 'summary.front41Output' print( x, efficiencies = FALSE, ... )
## S3 method for class 'front41Output' summary( object, ... ) ## S3 method for class 'summary.front41Output' print( x, efficiencies = FALSE, ... )
object |
an object of class |
x |
object of class |
efficiencies |
logical. Print all efficiency estimates?
(If |
... |
currently ignored. |
The summary
method returns a list of class
summary.front41Output
with the same elements as object returned by front41ReadOutput
.
However, the elements olsResults
, gridResults
, and
mleResults
have an additional culumn with marginal significance
levels (P values).
The values of the OLS estimates are calculated using
the
distribution,
while the (asymptotic)
values of the ML estimates
are calculated based on the assumption
that their
values follow an (asymptotic) standard normal
distribution.
Arne Henningsen
front41ReadOutput
, front41WriteInput
.
# read the output file that is provided with Frontier 4.1 outFile <- system.file( "front41/EG1.OUT", package = "frontier" ) sfa <- front41ReadOutput( outFile ) summary( sfa )
# read the output file that is provided with Frontier 4.1 outFile <- system.file( "front41/EG1.OUT", package = "frontier" ) sfa <- front41ReadOutput( outFile ) summary( sfa )
Create and print summary results of a stochastic frontier analysis
returned by frontier
.
## S3 method for class 'frontier' summary( object, extraPar = FALSE, effic = FALSE, logDepVar = TRUE, effMinusU = farrell, farrell = TRUE, ... ) ## S3 method for class 'summary.frontier' print( x, effic = x$printEffic, ... )
## S3 method for class 'frontier' summary( object, extraPar = FALSE, effic = FALSE, logDepVar = TRUE, effMinusU = farrell, farrell = TRUE, ... ) ## S3 method for class 'summary.frontier' print( x, effic = x$printEffic, ... )
object |
an object of class |
x |
an object of class |
extraPar |
logical. If |
effic |
logical. Print the individual efficiency estimates? |
logDepVar |
logical. Is the dependent variable logged? |
effMinusU |
logical. If |
farrell |
logical. This argument is only kept for backward compatibility and will be removed in the future. |
... |
further arguments to the |
The standard errors of the estimated parameters are taken from the direction matrix that is used in the final iteration of the Davidon-Fletcher-Powell procedure that is used for maximising the (log) likelihood function.
If argument extraPar
is TRUE
,
the standard errors of the additional parameters
are obtained by the delta method.
Please note that the delta method might provide poor approximations
of the ‘true’ standard errors,
because parameter is left-censored
and parameter
is both left-censored and right-censored
so that these parameters cannot be normally distributed.
Please note further
that the t statistic and the z statistic are not reliable
for testing the statistical signicance of ,
, and the ‘additional parameters’,
because these parameters are censored and cannot follow
a normal distribution or a t distribution.
summary.frontier
returns a list of class summary.frontier
that is identical to an object returned by frontier
with two modifications and (up to) four additional elements:
olsParam |
matrix of OLS estimates, their standard errors, t-values, and P-values. |
mleParam |
matrix of ML estimates, their standard errors, z-values, and asymptotic P-values. |
logDepVar |
logical. Argument |
printEffic |
argument |
effic |
matrix. Efficiency estimates: each row corresponds to a cross-section; each column corresponds to a time period. |
efficMean |
numeric scalar. Mean efficiency. |
efficYearMeans |
numeric vector. Mean efficiency for each year in the sample (only for panel data but not for the Error Components Frontier without time effects). |
Arne Henningsen
sfa
, efficiencies.frontier
,
vcov.frontier
, and lrtest.frontier
.
# example included in FRONTIER 4.1 (cross-section data) data( front41Data ) sfaResult <- sfa( log( output ) ~ log( capital ) + log( labour ), data = front41Data ) summary( sfaResult ) # rice producers in the Phillipines (panel data) data( "riceProdPhil" ) library( "plm" ) riceProdPhil <- pdata.frame( riceProdPhil, c( "FMERCODE", "YEARDUM" ) ) # Error Components Frontier rice <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ), data = riceProdPhil ) summary( rice ) # Efficiency Effects Frontier rice2 <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ) | EDYRS + BANRAT, data = riceProdPhil ) summary( rice2 )
# example included in FRONTIER 4.1 (cross-section data) data( front41Data ) sfaResult <- sfa( log( output ) ~ log( capital ) + log( labour ), data = front41Data ) summary( sfaResult ) # rice producers in the Phillipines (panel data) data( "riceProdPhil" ) library( "plm" ) riceProdPhil <- pdata.frame( riceProdPhil, c( "FMERCODE", "YEARDUM" ) ) # Error Components Frontier rice <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ), data = riceProdPhil ) summary( rice ) # Efficiency Effects Frontier rice2 <- sfa( log( PROD ) ~ log( AREA ) + log( LABOR ) + log( NPK ) | EDYRS + BANRAT, data = riceProdPhil ) summary( rice2 )
The telecom
data frame contains data
on telecommunications providers in 21 countries in 1990.
data( telecom )
data( telecom )
This data frame contains the following variables (columns):
The name of the country.
Output (index).
Mainlines (M km).
Number of employees (10,000 persons).
Supplementary files for Coelli et al. (1998), p. 193.
Coelli, T. J., Rao, D. S. P., and Battese, G. E. (1998) An Introduction to Efficiency and Productivity Analysis, Springer, New York.
Extract the covariance matrix of the maximum likelihood coefficients
of a stochastic frontier model returned by frontier
.
## S3 method for class 'frontier' vcov( object, extraPar = FALSE, ... )
## S3 method for class 'frontier' vcov( object, extraPar = FALSE, ... )
object |
an object of class |
extraPar |
logical. If |
... |
currently unused. |
The variance-covariance matrix of the estimated parameters is taken from the direction matrix that is used in the final iteration of the Davidon-Fletcher-Powell procedure that is used for maximising the (log) likelihood function.
If argument extraPar
is TRUE
,
the variances and covariances of the additional parameters
are obtained by the delta method.
Please note that the delta method might provide poor approximations
of the ‘true’ variances and covariances,
because parameter is left-censored
and parameter
is both left-censored and right-censored
so that these parameters cannot be normally distributed.
Please note further
that it might not be appropriate to use standard statistical tests
(e.g. t-tests or other Wald tests)
that are based on the variances and covariances of ,
, and the ‘additional parameters’,
because these parameters are censored and cannot follow normal distributions.
vcov.frontier
returns the covariance matrix
of the maximum likelihood coefficients.
Arne Henningsen
coef.frontier
, coef.summary.frontier
,
summary.frontier
, and sfa
.
# example included in FRONTIER 4.1 data( front41Data ) sfaResult <- sfa( log( output ) ~ log( capital ) + log( labour ), data = front41Data ) vcov( sfaResult )
# example included in FRONTIER 4.1 data( front41Data ) sfaResult <- sfa( log( output ) ~ log( capital ) + log( labour ), data = front41Data ) vcov( sfaResult )