Title: | Analysis with the Constant Elasticity of Substitution (CES) Function |
---|---|
Description: | Tools for econometric analysis and economic modelling with the traditional two-input Constant Elasticity of Substitution (CES) function and with nested CES functions with three and four inputs. The econometric estimation can be done by the Kmenta approximation, or non-linear least-squares using various gradient-based or global optimisation algorithms. Some of these algorithms can constrain the parameters to certain ranges, e.g. economically meaningful values. Furthermore, the non-linear least-squares estimation can be combined with a grid-search for the rho-parameter(s). The estimation methods are described in Henningsen et al. (2021) <doi:10.4337/9781788976480.00030>. |
Authors: | Arne Henningsen and Geraldine Henningsen |
Maintainer: | Arne Henningsen <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0-2 |
Built: | 2024-11-13 05:29:51 UTC |
Source: | https://github.com/micecon/miceconces |
Calculate the endogenous variable of a ‘Constant Elasticity of Substitution’ (CES) function.
The original CES function with two explanatory variables is
and the non-nested CES function with explanatory variables is
where in the latter case
.
In both cases, the elesticity of substitution is
.
The nested CES function with 3 explanatory variables proposed by Sato (1967) is
and the nested CES function with 4 explanatory variables (a generalisation of the version proposed by Sato, 1967) is
cesCalc( xNames, data, coef, tName = NULL, nested = FALSE, rhoApprox = 5e-6 )
cesCalc( xNames, data, coef, tName = NULL, nested = FALSE, rhoApprox = 5e-6 )
xNames |
a vector of strings containing the names of the explanatory variables. |
data |
data frame containing the explanatory variables. |
coef |
numeric vector containing the coefficients of the CES:
if the vector is unnamed,
the order of the coefficients must be
|
tName |
optional character string specifying the name of the
time variable ( |
nested |
logical. ;
if |
rhoApprox |
if the absolute value of the coefficient |
A numeric vector with length equal to the number of rows of the data set
specified in argument data
.
Arne Henningsen and Geraldine Henningsen
Kmenta, J. (1967): On Estimation of the CES Production Function. International Economic Review 8, p. 180-189.
Sato, K. (1967): A Two-Level Constant-Elasticity-of-Substitution Production Function. Review of Economic Studies 43, p. 201-218.
data( germanFarms, package = "micEcon" ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of intermediate inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput ## Estimate CES: Land & Labor with fixed returns to scale cesLandLabor <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms ) ## Calculate fitted values cesCalc( c( "land", "qLabor" ), germanFarms, coef( cesLandLabor ) ) # variable returns to scale cesLandLaborVrs <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms, vrs = TRUE ) ## Calculate fitted values cesCalc( c( "land", "qLabor" ), germanFarms, coef( cesLandLaborVrs ) )
data( germanFarms, package = "micEcon" ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of intermediate inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput ## Estimate CES: Land & Labor with fixed returns to scale cesLandLabor <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms ) ## Calculate fitted values cesCalc( c( "land", "qLabor" ), germanFarms, coef( cesLandLabor ) ) # variable returns to scale cesLandLaborVrs <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms, vrs = TRUE ) ## Calculate fitted values cesCalc( c( "land", "qLabor" ), germanFarms, coef( cesLandLaborVrs ) )
Estimate a Constant-Elasticity-of-Substitution (CES) function
with two exogenous variables
or a nested Constant-Elasticity-of-Substitution (CES) function
proposed by Sato (1967) with three or four exogenous variables
by Least Squares.
The functional forms are shown in the documentation of
function cesCalc
.
Warning: The econometric estimation of a CES function is (almost) always very problematic, because very different parameter vectors could result in very similar values of the objective function (sum of squared residuals). Hence, even if the optimizer reports that the nonlinear minimization has converged, there might be another rather different parameter vector that results in a lower sum of squared residuals.
cesEst( yName, xNames, data, tName = NULL, vrs = FALSE, method = "LM", start = NULL, lower = NULL, upper = NULL, multErr = FALSE, rho1 = NULL, rho2, rho = NULL, returnGridAll = FALSE, returnGrad = FALSE, random.seed = 123, rhoApprox = c( y = 5e-6, gamma = 5e-6, delta = 5e-6, rho = 1e-3, nu = 5e-6 ), checkStart = TRUE, ... ) ## S3 method for class 'cesEst' print( x, digits = max(3, getOption("digits") - 3), ... )
cesEst( yName, xNames, data, tName = NULL, vrs = FALSE, method = "LM", start = NULL, lower = NULL, upper = NULL, multErr = FALSE, rho1 = NULL, rho2, rho = NULL, returnGridAll = FALSE, returnGrad = FALSE, random.seed = 123, rhoApprox = c( y = 5e-6, gamma = 5e-6, delta = 5e-6, rho = 1e-3, nu = 5e-6 ), checkStart = TRUE, ... ) ## S3 method for class 'cesEst' print( x, digits = max(3, getOption("digits") - 3), ... )
yName |
a string containing the name of the dependent variable. |
xNames |
a vector of two, three or four character strings containing the names of the independent variables. |
data |
data frame containing the data. |
tName |
optional character string specifying the name of the
time variable ( |
vrs |
logical. Allow for variable returns to scale? |
method |
character string indicationg the estimation method:
either |
start |
optional numeric vector giving the starting values of the parameters in the non-linear estimations (see section ‘Details’). |
lower |
lower bounds of the parameters (see section ‘Details’). |
upper |
upper bounds of the parameters (see section ‘Details’). |
multErr |
logical. If |
rho1 , rho2 , rho
|
numeric scalar or vector at which the coefficients
|
returnGridAll |
logical value that indicates
whether the estimates for all values of |
returnGrad |
logical value that indicates
whether a matrix with the gradients of the dependent variable
(i.e., |
random.seed |
an integer used to seed R's random number generator.
This is to ensure replicability when the |
rhoApprox |
numeric vector with exactly 5 elements;
the endogenous variable of the CES
and the derivatives with respect to its coefficients
are calculated using a first-order Taylor series approximation
at |
checkStart |
logical. If |
x |
an object of class |
digits |
number of digits. |
... |
further arguments to |
Estimation method
Argument method
determines the estimation method.
If it is "Kmenta"
,
the CES is estimated by ordinary least squares using the Kmenta
approximation;
otherwise, it is estimated by non-linear least-squares.
Several different optimizers can be used for the non-linear estimation.
The optimization method
LM
(Levenberg-Marquardt, see Moré 1978)
uses nls.lm
for the optimization.
The optimization methods
NM
or Nelder-Mead
(Nelder and Mead 1965),
BFGS
(Broyden 1970, Fletcher 1970, Goldfarb 1970, Shanno 1970),
CG
(Conjugate Gradients based on Fletcher and Reeves 1964),
L-BFGS-B
(with box-constraints, Byrd, Lu, Nocedal, and Zhu 1995), and
SANN
(Simulated Annealing, Bélisle 1992)
use optim
for the optimization.
The optimization method
Newton
(Newton-type, see Dennis and Schnabel 1983
and Schnabel, Koontz, and Weiss 1985)
uses nlm
for the optimization.
The optimization method
PORT
(PORT routines, see Gay 1990)
uses nlminb
for the optimization.
The optimization method
DE
(Differential Evolution, see Storn and Price 1997)
uses DEoptim
for the optimization.
Analytical gradients are used in the LM
, BFGS
, CG
,
L-BFGS-B
, Newton
, and PORT
method.
Starting values
Argument start
should be a numeric vector.
The order must be as described in the documentation of argument coef
of function cesCalc
.
However, names of the elements are ignored.
If argument start
is NULL
,
pre-defined starting values are used.
The starting value of (if present) is set to 0.015;
the starting values of
,
,
and
(if present) are set to 0.5,
the starting values of
,
, and
(if present and required) are set to 0.25
(i.e.\ elasticity of substitution = 0.8 in the two-input case),
the starting value of
(if present) is set to 1,
and the starting value of
is set to a value
so that the mean of the error term is zero.
Hence, in case of an additive error term
(i.e. argument
multErr
is set to FALSE
, the default)
is set to
mean( y ) / mean( CES( X, start1 ) )
and in case of a multiplicative error term
(i.e. argument multErr
is set to TRUE
)
is set to
mean( log( y ) ) - mean( log( CES( X, start1 ) ) )
,
where y
is the dependent variable (defined by argument yName
),
X
is the set of covariates
(defined by arguments xNames
and tName
),
CES()
defines the (nested) CES function,
and start1
is a coefficient vector
with and all other coefficients
having the starting values described above.
Lower and upper bounds
Arguments lower
and upper
can be used
to set lower and upper bounds for the estimated parameters.
If these arguments are -Inf
and Inf
, respectively,
the parameters are estimated without unconstraints.
By default, arguments lower
and upper
are both NULL
,
which means that the bounds are set automatically
depending on the estimation method:
In case of the L-BFGS-B
, PORT
, and DE
method,
the lower bound is 0
for ,
,
,
and
(if present),
-1
for ,
, and
(if present),
and eventually
0
for .
In case of the
L-BFGS-B
and PORT
method,
the upper bound is infinity for ,
1
for ,
, and
(if present),
infinity for
,
, and
(if present),
and eventually infinity for
.
Since the ‘Differential Evulation’ algorithm requires finit bounds,
the upper bounds for the
DE
method are set
to 1e10
for ,
1
for ,
, and
(if present),
10
for ,
, and
(if present),
and eventually
10
for .
In case of all other estimation methods,
the lower and upper bounds are set to
-Inf
and Inf
, respectively,
because these methods do not support parameter constraints.
Of course, the user can specify own lower and upper bounds
by setting arguments lower
and upper
to numeric vectors
that should have the same format as argument start
(see above).
Grid search for
If arguments rho1
, rho2
, and/or rho
have more than one element,
a one-dimensional, two-dimensional, or three-dimensionsl grid search
for ,
, and/or
is performed.
The remaining (free) parameters of the CES are estimated by least-squares,
where
,
, and/or
are fixed
consecutively at each value defined in arguments
rho1
, rho2
,
and rho
, respectively.
Finally the estimation with the ,
,
and/or
that results in the smallest sum of squared residuals is chosen
(and returned).
Random numbers
The ‘state’ (or ‘seed’) of R's random number generator
is saved at the beginning of the cesEst
function
and restored at the end of this function
so that this function does not affect the generation of random numbers
although the random seed is set to argument random.seed
and the ‘SANN’ and ‘DE’ algorithms use random numbers.
cesEst
returns a list of class cesEst
that has following components:
coefficients |
estimated coefficients/parameters of the CES
(including a possible fixed |
ela |
constant elasticity/elasticities of substitution. |
iter |
number of iterations (only for non-linear least-squares estimations). |
convergence |
logical value indicating if the non-linear estimation has converged (only for non-linear least-squares estimations with solvers that have a convergence criterion). |
message |
additional information from the optimizer
(only if a message was returned by |
vcov |
approximate covariance matrix of the estimated parameters
calculated from the parameters of the linearized model by the Delta method
(only if argument |
cov.unscaled |
unscaled covariance matrix of the estimated parameters
(including a possible fixed |
fitted.values |
the fitted values ( |
residuals |
the residuals
(i.e. |
rss |
the sum of the squared residuals (i.e. the value of the objective function of the non-linear least-squares estimation evaluated at the estimated parameters). |
call |
the matched call. |
method |
argument |
multErr |
argument |
start |
starting values for the non-linear estimation
(not for the |
lower |
lower bounds of the parameters. |
upper |
upper bounds of the parameters. |
rho |
argument |
nls.lm |
object returned by |
optim |
object returned by |
nlm |
object returned by |
nlminb |
object returned by |
DEoptim |
object returned by |
translog |
estimation results of the (unrestricted) translog model
returned by |
kmenta |
estimation results of the Kmenta approximation
(a restricted translog model)
returned by |
testKmenta |
test of the restrictions implied
by the Kmenta approximation
(including constant returns to scale
if argument |
allRhoSum |
data frame with summary results of the estimations
with all values of |
allRhoFull |
list of estimation results returned by |
rho1Values , rho2Values , rhoValues
|
numeric vectors giving the values
that are used in the grid search
for the coefficients |
rssArray |
matrix or array of the RSS values obtained
by a two-dimensional or three-dimensional grid search
for the coefficients |
grad |
matrix with the gradients of the dependent variable
(i.e., |
Arne Henningsen and Geraldine Henningsen
Bélisle, C.J.P. (1992): Convergence theorems for a class of simulated annealing algorithms on Rd, Journal of Applied Probability 29, p. 885-895.
Broyden, C.G. (1970): The Convergence of a Class of Double-rank Minimization Algorithms, Journal of the Institute of Mathematics and Its Applications 6, p. 76-90.
Byrd, R.H., Lu, P., Nocedal, J. and Zhu, C. (1995): A limited memory algorithm for bound constrained optimization, SIAM J. Scientific Computing 16, p. 1190-1208.
Dennis, J.E. and Schnabel, R.B. (1983): Numerical Methods for Unconstrained Optimization and Nonlinear Equations, Prentice-Hall, Englewood Cliffs, NJ.
Fletcher, R. (1970): A New Approach to Variable Metric Algorithms, Computer Journal 13, p. 317-322.
Fletcher, R. and Reeves, C.M. (1964): Function minimization by conjugate gradients, Computer Journal 7, p. 148-154.
Gay, D.M. (1990): Usage Summary for Selected Optimization Routines, Computing Science Technical Report No. 153, AT&T Bell Laboratories, Murray Hill NJ.
Goldfarb, D. (1970): A Family of Variable Metric Updates Derived by Variational Means, Mathematics of Computation 24, p. 23-26.
Moré, J.J. (1978): The Levenberg-Marquardt algorithm: implementation and theory, in G.A. Watson (Ed.), Lecture Notes in Mathematics 630: Numerical Analysis, pp. 105-116, Springer-Verlag: Berlin.
Nelder, J.A. and Mead, R. (1965): A simplex algorithm for function minimization, Computer Journal 7, p. 308-313.
Schnabel, R.B., Koontz, J.E. and Weiss, B.E. (1985): A modular system of algorithms for unconstrained minimization, ACM Trans. Math. Software, 11, pp. 419-440.
Shanno, D.F. (1970): Conditioning of Quasi-Newton Methods for Function Minimization, Mathematics of Computation 24, p. 647-656.
Storn, R. and Price, K. (1997): Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces, Journal of Global Optimization, 11(4), p. 341-359.
summary.cesEst
for the summary
method,
plot.cesEst
for plotting the results
of the grid search for ,
coef.cesEst
for several further methods,
cesCalc
for calculations or simulations with the CES,
translogEst
for estimating translog functions, and
quadFuncEst
for estimating quadratic functions.
data( germanFarms, package = "micEcon" ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of intermediate inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput ## CES: Land & Labor (Levenberg-Marquardt algorithm) cesLandLabor <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms ) # variable returns to scale, increased max. number of iter. (LM algorithm) cesLandLaborVrs <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms, vrs = TRUE, control = nls.lm.control( maxiter = 1000 ) ) # using the Nelder-Mead optimization method cesLandLaborNm <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms, method = "NM" ) # using the BFGS optimization method cesLandLaborBfgs <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms, method = "BFGS" ) # using the L-BFGS-B optimization method with constrained parameters cesLandLaborBfgsCon <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms, method = "L-BFGS-B" ) # using the CG optimization method cesLandLaborSann <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms, method = "CG" ) # using the SANN optimization method # (with decreased number of iteration to decrease execution time) cesLandLaborSann <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms, method = "SANN", control = list( maxit = 1000 ) ) # using the Kmenta approximation cesLandLaborKmenta <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms, method = "Kmenta" ) # using the PORT optimization routine with unconstrained parameters cesLandLaborPortCon <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms, vrs = TRUE, method = "PORT", lower = -Inf, upper = Inf ) # using the PORT optimization routine with constrained parameters and VRS cesLandLaborPortCon <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms, vrs = TRUE, method = "PORT" ) # using the Differential Evolution optimization method # (with decreased number of iteration to decrease execution time) cesLandLaborDe <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms, method = "DE", control = DEoptim.control( itermax = 50 ) ) ## estimation with a grid search for rho (using the LM algorithm) cesLandInt <- cesEst( "qOutput", c( "land", "qLabor" ), data = germanFarms, rho = seq( from = -0.6, to = 0.9, by = 0.3 ) )
data( germanFarms, package = "micEcon" ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of intermediate inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput ## CES: Land & Labor (Levenberg-Marquardt algorithm) cesLandLabor <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms ) # variable returns to scale, increased max. number of iter. (LM algorithm) cesLandLaborVrs <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms, vrs = TRUE, control = nls.lm.control( maxiter = 1000 ) ) # using the Nelder-Mead optimization method cesLandLaborNm <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms, method = "NM" ) # using the BFGS optimization method cesLandLaborBfgs <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms, method = "BFGS" ) # using the L-BFGS-B optimization method with constrained parameters cesLandLaborBfgsCon <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms, method = "L-BFGS-B" ) # using the CG optimization method cesLandLaborSann <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms, method = "CG" ) # using the SANN optimization method # (with decreased number of iteration to decrease execution time) cesLandLaborSann <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms, method = "SANN", control = list( maxit = 1000 ) ) # using the Kmenta approximation cesLandLaborKmenta <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms, method = "Kmenta" ) # using the PORT optimization routine with unconstrained parameters cesLandLaborPortCon <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms, vrs = TRUE, method = "PORT", lower = -Inf, upper = Inf ) # using the PORT optimization routine with constrained parameters and VRS cesLandLaborPortCon <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms, vrs = TRUE, method = "PORT" ) # using the Differential Evolution optimization method # (with decreased number of iteration to decrease execution time) cesLandLaborDe <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms, method = "DE", control = DEoptim.control( itermax = 50 ) ) ## estimation with a grid search for rho (using the LM algorithm) cesLandInt <- cesEst( "qOutput", c( "land", "qLabor" ), data = germanFarms, rho = seq( from = -0.6, to = 0.9, by = 0.3 ) )
Methods for Objects of Class cesEst
and cesEst
.
## S3 method for class 'cesEst' coef( object, ... ) ## S3 method for class 'summary.cesEst' coef( object, ... ) ## S3 method for class 'cesEst' fitted( object, ... ) ## S3 method for class 'cesEst' residuals( object, ... ) ## S3 method for class 'cesEst' vcov( object, ... )
## S3 method for class 'cesEst' coef( object, ... ) ## S3 method for class 'summary.cesEst' coef( object, ... ) ## S3 method for class 'cesEst' fitted( object, ... ) ## S3 method for class 'cesEst' residuals( object, ... ) ## S3 method for class 'cesEst' vcov( object, ... )
object |
an object of class |
... |
further arguments are currently ignored. |
coef.cesEst
returns a vector of the estimated coefficients.
coef.summary.cesEst
returns a matrix with four columns:
the estimated coefficients/parameters of the CES,
their standard errors, the t-statistic,
and corresponding (two-sided) P-values.
fitted.cesEst
returns a vector of the fitted values.
residuals.cesEst
returns a vector of the residuals.
vcov.cesEst
returns the variance covariance matrix
of the estimated coefficients.
Arne Henningsen and Geraldine Henningsen
cesEst
and summary.cesEst
.
data( germanFarms, package = "micEcon" ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of intermediate inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput ## CES: Land & Labor cesLandLabor <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms ) # estimated coefficients coef( cesLandLabor ) # estimated coefficients, their standard errors, t-statistic, P-values coef( summary( cesLandLabor ) ) # fitted values of the estimated model fitted( cesLandLabor ) # residuals of the estimated model residuals( cesLandLabor ) # covariance matrix of the estimated coefficients vcov( cesLandLabor )
data( germanFarms, package = "micEcon" ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of intermediate inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput ## CES: Land & Labor cesLandLabor <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms ) # estimated coefficients coef( cesLandLabor ) # estimated coefficients, their standard errors, t-statistic, P-values coef( summary( cesLandLabor ) ) # fitted values of the estimated model fitted( cesLandLabor ) # residuals of the estimated model residuals( cesLandLabor ) # covariance matrix of the estimated coefficients vcov( cesLandLabor )
Conduct a generalized Durbin-Watson-Test
as suggested by White (1992)
to test for serial correlation of the residuals.
dwt
is an abbreviation for durbinWatsonTest
.
## S3 method for class 'cesEst' durbinWatsonTest( model, ... )
## S3 method for class 'cesEst' durbinWatsonTest( model, ... )
model |
object returned by |
... |
further arguments are passed
to |
Arne Henningsen
White, K.J. (1992): The Durbin-Watson Test for Autocorrelation in Nonlinear Models. The Review of Economics and Statistics 74(2), p. 370-373.
data( germanFarms, package = "micEcon" ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of intermediate inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput ## CES: Land & Intermediate Inputs cesLandInt <- cesEst( yName = "qOutput", xNames = c( "land", "qVarInput" ), data = germanFarms, returnGrad = TRUE ) # conduct the generalized Durbin-Watson test dwt( cesLandInt )
data( germanFarms, package = "micEcon" ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of intermediate inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput ## CES: Land & Intermediate Inputs cesLandInt <- cesEst( yName = "qOutput", xNames = c( "land", "qVarInput" ), data = germanFarms, returnGrad = TRUE ) # conduct the generalized Durbin-Watson test dwt( cesLandInt )
The data frame GermanIndustry
contains annual aggregated data
of the entire West German industry from 1960 until 1993
as well as data of seven industrial sectors from 1970 to 1988/1992.
This data set has been used by Kemfert (1998).
data(GermanIndustry)
data(GermanIndustry)
This data frame contains the following columns/variables:
the year.
output: gross value added of the West German industrial sector (in billion Deutsche Mark at prices of 1991).
capital: gross stock of fixed assets of the West German industrial sector (in billion Deutsche Mark at prices of 1991).
labor: total number of persons employed in the West German industrial sector (in million).
energy: final energy consumption in the West German industrial sector (in GWh).
gross value added of the West German chemical industry (in billion Deutsche Mark at prices of 1991).
capital: gross stock of fixed assets of the West German chemical industry (in billion Deutsche Mark at prices of 1991).
labor: total number of persons employed in the West German chemical industry (in thouands).
final energy consumption in the West German chemical industry (in GWh).
gross value added of the West German stone and earth industry (in billion Deutsche Mark at prices of 1991).
capital: gross stock of fixed assets of the West German stone and earth industry (in billion Deutsche Mark at prices of 1991).
labor: total number of persons employed in the West German stone and earth industry (in thouands).
final energy consumption in the West German stone and earth industry (in GWh).
gross value added of the West German iron industry (in billion Deutsche Mark at prices of 1991).
capital: gross stock of fixed assets of the West German iron industry (in billion Deutsche Mark at prices of 1991).
labor: total number of persons employed in the West German iron industry (in thouands).
final energy consumption in the West German iron industry (in GWh).
gross value added of the West German non-ferrous industry (in billion Deutsche Mark at prices of 1991).
capital: gross stock of fixed assets of the West German non-ferrous industry (in billion Deutsche Mark at prices of 1991).
labor: total number of persons employed in the West German non-ferrous industry (in thouands).
final energy consumption in the West German non-ferrous industry (in GWh).
gross value added of the West German vehicle industry (in billion Deutsche Mark at prices of 1991).
capital: gross stock of fixed assets of the West German vehicle industry (in billion Deutsche Mark at prices of 1991).
labor: total number of persons employed in the West German vehicle industry (in thouands).
final energy consumption in the West German vehicle industry (in GWh).
gross value added of the West German paper industry (in billion Deutsche Mark at prices of 1991).
capital: gross stock of fixed assets of the West German paper industry (in billion Deutsche Mark at prices of 1991).
labor: total number of persons employed in the West German paper industry (in thouands).
final energy consumption in the West German paper industry (in GWh).
gross value added of the West German food industry (in billion Deutsche Mark at prices of 1991).
capital: gross stock of fixed assets of the West German food industry (in billion Deutsche Mark at prices of 1991).
labor: total number of persons employed in the West German food industry (in thouands).
final energy consumption in the West German food industry (in GWh).
Please note that Kemfert (1998) disregards the years 1973-1975 in her estimations due to economic disruptions.
German Federal Statistical Office (Statistisches Bundesamt), data taken from Kemfert (1998).
Kemfert, Claudia (1998): Estimated Substitution Elasticities of a Nested CES Production Funktion Approach for Germany, Energy Economics 20: 249-264 (doi:10.1016/S0140-9883(97)00014-5)
The MishraCES
data set contains artificial production data.
It has 50 observations (e.g. firms, sectors, or countries).
data(MishraCES)
data(MishraCES)
This data frame contains the following columns:
Firm number.
Output quantity.
Quantity of first input.
Quantity of second input.
Quantity of third input.
Quantity of fouth input.
Mishra, SK (2006): A Note on Numerical Estimation of Sato's Two-Level CES Production Function MPRA Working Paper No. 1019, https://mpra.ub.uni-muenchen.de/1019/.
# load the data set data( "MishraCES" ) # show mean values of all variables colMeans( MishraCES ) # re-calculate the endogenous variable (see Mishra 2006) # coefficients of the nested CES function with 4 inputs b <- c( "gamma" = 200 * 0.5^(1/0.6), "delta_1" = 0.6, "delta_2" = 0.3, "delta" = 0.5, "rho_1" = 0.5, "rho_2" = -0.17, "rho" = 0.6 ) MishraCES$Y2 <- cesCalc( xNames = c( "X1", "X2", "X3", "X4" ), data = MishraCES, coef = b, nested = TRUE ) all.equal( MishraCES$Y, MishraCES$Y2 )
# load the data set data( "MishraCES" ) # show mean values of all variables colMeans( MishraCES ) # re-calculate the endogenous variable (see Mishra 2006) # coefficients of the nested CES function with 4 inputs b <- c( "gamma" = 200 * 0.5^(1/0.6), "delta_1" = 0.6, "delta_2" = 0.3, "delta" = 0.5, "rho_1" = 0.5, "rho_2" = -0.17, "rho" = 0.6 ) MishraCES$Y2 <- cesCalc( xNames = c( "X1", "X2", "X3", "X4" ), data = MishraCES, coef = b, nested = TRUE ) all.equal( MishraCES$Y, MishraCES$Y2 )
Plot a scatter plot,
where the values of are on the x axis
and the corresponding sums of the squared residuals
obtained by a grid search for
are on the y axis.
Estimations that did not converge are marked with red.
Note that this method can be applied
only if the model was estimated by a grid search for ,
i.e.\
cesEst
was called with argument rho
set to a vector of more than one values for .
## S3 method for class 'cesEst' plot( x, negRss = TRUE, bw = FALSE, ... )
## S3 method for class 'cesEst' plot( x, negRss = TRUE, bw = FALSE, ... )
x |
object returned by |
negRss |
logical. Indicates whether the negative sum of squared residuals should be plotted in 3D plots (ignored in 2D plots). |
bw |
logical. Indicates whether 3D plots should be in black-and-white or colored. |
... |
All further arguments are passed
to |
Arne Henningsen and Geraldine Henningsen
data( germanFarms, package = "micEcon" ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of intermediate inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput ## CES: Land & Intermediate Inputs cesLandInt <- cesEst( yName = "qOutput", xNames = c( "land", "qVarInput" ), data = germanFarms, rho = seq( from = -0.6, to = 0.9, by = 0.3 ) ) # plot the rhos against the sum of squared residuals plot( cesLandInt )
data( germanFarms, package = "micEcon" ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of intermediate inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput ## CES: Land & Intermediate Inputs cesLandInt <- cesEst( yName = "qOutput", xNames = c( "land", "qVarInput" ), data = germanFarms, rho = seq( from = -0.6, to = 0.9, by = 0.3 ) ) # plot the rhos against the sum of squared residuals plot( cesLandInt )
summary
method for objects of class cesEst
.
## S3 method for class 'cesEst' summary( object, rSquaredLog = object$multErr, ela = TRUE, ... ) ## S3 method for class 'summary.cesEst' print( x, ela = TRUE, digits = max(3, getOption("digits") - 3), ... )
## S3 method for class 'cesEst' summary( object, rSquaredLog = object$multErr, ela = TRUE, ... ) ## S3 method for class 'summary.cesEst' print( x, ela = TRUE, digits = max(3, getOption("digits") - 3), ... )
object |
an object returned by |
rSquaredLog |
logical.
If |
ela |
logical. If |
x |
an object returned by |
digits |
number of digits. |
... |
further arguments are currently ignored. |
summary.cesEst
returns a list of class summary.cesEst
that contains the elements of the provided object
with with
following changes or additions:
coefficients |
a matrix with four columns:
the estimated coefficients/parameters of the CES
(including a possible fixed |
sigma |
square root of the estimated (asymptotic) variance of the random error (calculated without correcting for degrees of freedom). |
r.squared |
|
vcov |
covariance matrix of the estimated parameters
(including a possible fixed |
ela |
a matrix with four columns:
the estimated elasticities of substitution,
their standard errors, the t-statistic,
and corresponding (two-sided) P-values
(only if argument |
elaCov |
covariance matrix of the estimated
elasticities of substitution
(only if argument |
Arne Henningsen
data( germanFarms, package = "micEcon" ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of intermediate inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput ## CES: Land & Labor cesLandLabor <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms ) # print summary results summary( cesLandLabor )
data( germanFarms, package = "micEcon" ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of intermediate inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput ## CES: Land & Labor cesLandLabor <- cesEst( "qOutput", c( "land", "qLabor" ), germanFarms ) # print summary results summary( cesLandLabor )