Title: | Microeconomic Analysis and Modelling |
---|---|
Description: | Various tools for microeconomic analysis and microeconomic modelling, e.g. estimating quadratic, Cobb-Douglas and Translog functions, calculating partial derivatives and elasticities of these functions, and calculating Hessian matrices, checking curvature and preparing restrictions for imposing monotonicity of Translog functions. |
Authors: | Arne Henningsen |
Maintainer: | Arne Henningsen <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.6-18 |
Built: | 2024-10-31 06:57:44 UTC |
Source: | CRAN |
The appleProdFr86
data frame includes
cross-sectional production data of 140 French apple producers
from the year 1986.
These data have been extracted from a panel data set
that was used in Ivaldi et al. (1996).
data(appleProdFr86)
data(appleProdFr86)
This data frame contains the following columns:
costs of capital (including land).
costs of labour (including remuneration of unpaid family labour).
costs of intermediate materials (e.g. seedlings, fertilizer, pesticides, fuel).
quantity index of produced apples.
quantity index of all other outputs.
quantity index of all outputs
(not in the original data set,
calculated as 580,000
(
qApples
+ qOtherOut
)).
price index of capital goods
price index of labour.
price index of materials.
price index of the aggregate output (not in the original data set, artificially generated).
dummy variable indicating the use of an advisory service (not in the original data set, artificially generated).
This cross-sectional data set has been extracted from a panel data set that is available in the data archive of the Journal of Applied Econometrics: http://qed.econ.queensu.ca/jae/1996-v11.6/ivaldi-ladoux-ossard-simioni/.
Ivaldi, M., N. Ladoux, H. Ossard, and M. Simioni (1996) Comparing Fourier and Translog Specifications of Multiproduct Technology: Evidence from an Incomplete Panel of French Farmers. Journal of Applied Econometrics, 11(6), p. 649-667.
The Bleymueller251
data frame contains prices and quantities of
4 products for the years 1970, 1974 and 1978.
This data are part of Exercise 25.1 of Bleymueller, Gehler und Guetlicher (1979).
data(Bleymueller79E25.1)
data(Bleymueller79E25.1)
This data frame contains the following columns:
Price of good A.
Price of good B.
Price of good C.
Price of good D.
Quantity of good A.
Quantity of good B.
Quantity of good C.
Quantity of good D.
Bleymueller, J; G. Gehlert and H. Guelicher (1979) Statistik fuer Wirtschaftswissenschaftler. Verlag Vahlen, Muenchen.
Test theoretical consistency of microeconomic models.
checkConsist( object, ... )
checkConsist( object, ... )
object |
a microeconomic model |
... |
further arguments for methods |
This is a generic function.
Arne Henningsen
Calculate the dependent variable of a Cobb-Douglas function.
cobbDouglasCalc( xNames, data, coef, coefCov = NULL, dataLogged = FALSE )
cobbDouglasCalc( xNames, data, coef, coefCov = NULL, dataLogged = FALSE )
xNames |
a vector of strings containing the names of the independent variables. |
data |
data frame containing the data. |
coef |
vector containing the coefficients:
if the elements of the vector have no names,
the first element is taken as intercept of the logged equation
and the following elements are taken as coefficients of
the independent variables defined in argument |
coefCov |
optional covariance matrix of the coefficients
(the order of the rows and columns must correspond
to the order of the coefficients in argument |
dataLogged |
logical. Are the values in |
A vector containing the endogenous variable.
If the inputs are provided as logarithmic values
(argument dataLogged
is TRUE
),
the endogenous variable is returned as logarithm;
non-logarithmic values are returned otherwise.
If argument coefCov
is specified,
the returned vector has an attribute "variance"
that is a vector containing the variances
of the calculated (fitted) endogenous variable.
Arne Henningsen
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a Cobb-Douglas production function estResult <- translogEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ), germanFarms, linear = TRUE ) # fitted values fitted <- cobbDouglasCalc( c( "qLabor", "land", "qVarInput", "time" ), germanFarms, coef( estResult )[ 1:5 ] ) #equal to estResult$fitted # fitted values and their variances fitted2 <- cobbDouglasCalc( c( "qLabor", "land", "qVarInput", "time" ), germanFarms, coef( estResult )[ 1:5 ], coefCov = vcov( estResult )[ 1:5, 1:5 ] ) # t-values c( fitted2 ) / attributes( fitted2 )$variance^0.5
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a Cobb-Douglas production function estResult <- translogEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ), germanFarms, linear = TRUE ) # fitted values fitted <- cobbDouglasCalc( c( "qLabor", "land", "qVarInput", "time" ), germanFarms, coef( estResult )[ 1:5 ] ) #equal to estResult$fitted # fitted values and their variances fitted2 <- cobbDouglasCalc( c( "qLabor", "land", "qVarInput", "time" ), germanFarms, coef( estResult )[ 1:5 ], coefCov = vcov( estResult )[ 1:5, 1:5 ] ) # t-values c( fitted2 ) / attributes( fitted2 )$variance^0.5
Calculate the derivatives of a Cobb-Douglas function.
cobbDouglasDeriv( xNames, data, coef, coefCov = NULL, yName = NULL, dataLogged = FALSE )
cobbDouglasDeriv( xNames, data, coef, coefCov = NULL, yName = NULL, dataLogged = FALSE )
xNames |
a vector of strings containing the names of the independent variables. |
data |
data frame containing the data. |
coef |
vector containing the coefficients:
if the elements of the vector have no names,
the first element is taken as intercept of the logged equation
and the following elements are taken as coefficients of
the independent variables defined in argument |
coefCov |
optional covariance matrix of the coefficients
(the order of the rows and columns must correspond
to the order of the coefficients in argument |
yName |
an optional string containing the name of the dependent
variable.
If it is |
dataLogged |
logical. Are the values in |
a list of class cobbDouglasDeriv
containing following objects:
deriv |
data frame containing the derivatives. |
variance |
data frame containing the variances of the derivatives
(only if argument |
Arne Henningsen
cobbDouglasCalc
, translogDeriv
.
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a Cobb-Douglas production function estResult <- translogEst( "qOutput", c( "qLabor", "qVarInput", "land", "time" ), germanFarms, linear = TRUE ) # compute the marginal products of the inputs (with "fitted" Output) margProducts <- cobbDouglasDeriv( c( "qLabor", "qVarInput", "land", "time" ), data = germanFarms, coef = coef( estResult )[1:5], coefCov = vcov( estResult )[1:5,1:5] ) margProducts$deriv # t-values margProducts$deriv / margProducts$variance^0.5 # compute the marginal products of the inputs (with observed Output) margProductsObs <- cobbDouglasDeriv( c( "qLabor", "qVarInput", "land", "time" ), data = germanFarms, coef = coef( estResult )[1:5], yName = "qOutput", coefCov = vcov( estResult )[1:5,1:5] ) margProductsObs$deriv # t-values margProductsObs$deriv / margProductsObs$variance^0.5
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a Cobb-Douglas production function estResult <- translogEst( "qOutput", c( "qLabor", "qVarInput", "land", "time" ), germanFarms, linear = TRUE ) # compute the marginal products of the inputs (with "fitted" Output) margProducts <- cobbDouglasDeriv( c( "qLabor", "qVarInput", "land", "time" ), data = germanFarms, coef = coef( estResult )[1:5], coefCov = vcov( estResult )[1:5,1:5] ) margProducts$deriv # t-values margProducts$deriv / margProducts$variance^0.5 # compute the marginal products of the inputs (with observed Output) margProductsObs <- cobbDouglasDeriv( c( "qLabor", "qVarInput", "land", "time" ), data = germanFarms, coef = coef( estResult )[1:5], yName = "qOutput", coefCov = vcov( estResult )[1:5,1:5] ) margProductsObs$deriv # t-values margProductsObs$deriv / margProductsObs$variance^0.5
Calculate the optimal values of the variable independent variables of a Cobb-Douglas function.
cobbDouglasOpt( pyName, pxNames, data, coef, zNames = NULL, zCoef = NULL, xNames = NULL, dataLogged = FALSE )
cobbDouglasOpt( pyName, pxNames, data, coef, zNames = NULL, zCoef = NULL, xNames = NULL, dataLogged = FALSE )
pyName |
character string containing the name of the price of the dependent variable. |
pxNames |
a vector of strings containing the names of the prices of the variable independent variables. |
data |
data frame containing the data. |
coef |
vector containing the intercept and the coefficients
of the variable independent variables:
if the elements of the vector have no names,
the first element is taken as intercept of the logged equation
and the following elements are taken as coefficients of
the variable independent variables with corresponding prices
defined in argument |
zNames |
optional vector of strings containing the names of the fixed independent variables. |
zCoef |
vector containing the coefficients
of the fixed independent variables:
if the elements of the vector have no names,
they are taken as coefficients of the fixed independent variables
defined in argument |
xNames |
optional vector of strings containing the names that should be assigned to the returned variable independent variables. |
dataLogged |
logical. Are the prices and fixed independent variables
in |
A data frame containing the optimal values of the variable
independent variables.
If the prices and fixed independent variables are provided
as logarithmic values
(argument dataLogged
is TRUE
),
the optimal values of the variable independent variables are returned
as logarithms, too;
non-logarithmic values are returned otherwise.
Arne Henningsen
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a Cobb-Douglas production function estResult <- translogEst( yName = "qOutput", xNames = c( "qLabor", "qVarInput", "land", "time" ), data = germanFarms, linear = TRUE ) # calculate optimal quantities of variable inputs xCoef <- coef( estResult )[ 1:3 ] zCoef <- coef( estResult )[ 4:5 ] names( zCoef ) <- c( "d_1", "d_2" ) optInput <- cobbDouglasOpt( pyName = "pOutput", pxNames = c( "pLabor", "pVarInput" ), coef = xCoef, data = germanFarms, xNames = c( "qLabor", "qVarInput" ), zNames = c( "land", "time" ), zCoef = zCoef ) # compare observed with optimal input quantities plot( germanFarms$qLabor, optInput$qLabor ) plot( germanFarms$qVarInput, optInput$qVarInput )
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a Cobb-Douglas production function estResult <- translogEst( yName = "qOutput", xNames = c( "qLabor", "qVarInput", "land", "time" ), data = germanFarms, linear = TRUE ) # calculate optimal quantities of variable inputs xCoef <- coef( estResult )[ 1:3 ] zCoef <- coef( estResult )[ 4:5 ] names( zCoef ) <- c( "d_1", "d_2" ) optInput <- cobbDouglasOpt( pyName = "pOutput", pxNames = c( "pLabor", "pVarInput" ), coef = xCoef, data = germanFarms, xNames = c( "qLabor", "qVarInput" ), zNames = c( "land", "time" ), zCoef = zCoef ) # compare observed with optimal input quantities plot( germanFarms$qLabor, optInput$qLabor ) plot( germanFarms$qVarInput, optInput$qVarInput )
These methods return the coefficients and their covariance matrix from an estimated quadratic function.
## S3 method for class 'quadFuncEst' coef( object, ... ) ## S3 method for class 'quadFuncEst' vcov( object, ... )
## S3 method for class 'quadFuncEst' coef( object, ... ) ## S3 method for class 'quadFuncEst' vcov( object, ... )
object |
an object of class |
... |
currently ignored. |
The coef
method returns a vector containing all (linearly independent)
coefficients of a quadratic function.
The vcov
method returns the covariance matrix
of all (linearly independent) coefficients of a quadratic function.
Arne Henningsen
These methods return the coefficients and their covariance matrix from an estimated translog function.
## S3 method for class 'translogEst' coef( object, ... ) ## S3 method for class 'translogEst' vcov( object, ... )
## S3 method for class 'translogEst' coef( object, ... ) ## S3 method for class 'translogEst' vcov( object, ... )
object |
an object of class |
... |
currently ignored. |
The coef
method returns a vector containing all (linearly independent)
coefficients of a translog function.
The vcov
method returns the covariance matrix
of all (linearly independent) coefficients of a translog function.
Arne Henningsen
These functions calculate and return
elasticities of microeconomic models.
elasticities
is an alias for elas
.
elas( object, ... ) elasticities( object, ... ) ## Default S3 method: elas( object, ... )
elas( object, ... ) elasticities( object, ... ) ## Default S3 method: elas( object, ... )
object |
a microeconomic model |
... |
further arguments for methods |
This is a generic function.
The default method just returns the element
elas
from object
.
Arne Henningsen
The germanFarms
data frame contains annual data of an average
full-time farm in West-Germany. Additionally, the price indices
for agricultural output and agricultural variable input are
included. 20 book-keeping years are included - starting in
1975/76 and ending in 1994/95.
data(germanFarms)
data(germanFarms)
This data frame contains the following columns:
the book-keeping year.
the value of crop outputs (in current Deutschmark).
the value of animal outputs (in current Deutschmark).
the value of outputs (in current Deutschmark).
price index of agricultural outputs (1980/81 = 100).
the value of variable inputs (in current Deutschmark).
price index of variable agricultural inputs (1980/81 = 100).
the number of full-time worker equivalents.
costs of an agricultural worker (Deutschmarks per year).
land used for agricultural production (in ha).
Bundesministerium für Ernährung, Landwirtschaft und Forsten (Federal Department for Food, Agriculture and Forests), Agrarbericht der Bundesregierung (Agricultural Report of the Federal Government), Jahrgänge 1977-1996 (years 1977-1996).
This function creates a data set with the logarithms of the original variables.
logDataSet( data, varNames, varNamesNum = NULL )
logDataSet( data, varNames, varNamesNum = NULL )
data |
a data frame containing the data
(possibly a panel data frame created with
|
varNames |
vector of character strings that indicates names of variables in the data frame. The logarithm of these variables are included in the returned data frame. |
varNamesNum |
optional vector of character strings that indicates names of further variables in tha data frame. In case of numeric variables, the logarithms of these variabes are included in the returned data frame. In case of factor of logical variables, these variabes are included in the returned data frame without any transformation. |
Arne Henningsen
data( "germanFarms" ) datLog <- logDataSet( germanFarms, c( "vAnimal", "vOutput", "vVarInput" ) ) summary( datLog )
data( "germanFarms" ) datLog <- logDataSet( germanFarms, c( "vAnimal", "vOutput", "vVarInput" ) ) summary( datLog )
The Missong03E7.7
data frame contains meat prices and demanded quantities
of a representative (West-)German household for the years 1986 to 1989.
This data are part of Exercise 7.7 of Missong (2003).
data(Missong03E7.7)
data(Missong03E7.7)
This data frame contains the following columns:
Average price of beef (DM/kg).
Demanded Quantity of beef (kg).
Average price of veal (DM/kg).
Demanded Quantity of veal (kg).
Average price of pork (DM/kg).
Demanded Quantity of pork (kg).
Missong, M. (2003) Aufgabensammlung zur deskriptiven Statistik, Oldenbourg, Muenchen.
Statistisches Bundesamt (1989) Fachserie 15, Reihe 1, p. 76f.
Calculate the dependent variable of a quadratic function.
quadFuncCalc( xNames, data, coef, shifterNames = NULL, homWeights = NULL )
quadFuncCalc( xNames, data, coef, shifterNames = NULL, homWeights = NULL )
xNames |
a vector of strings containing the names of the independent variables. |
data |
dataframe or a vector with named elements containing the data. |
coef |
vector containing all coefficients:
if there are |
shifterNames |
a vector of strings containing the names of the independent variables that should be included as shifters only (not in quadratic or interaction terms). |
homWeights |
numeric vector with named elements that are weighting factors
for calculating an index that is used to normalize the variables
for imposing homogeneity of degree zero in these variables
(see documentation of |
a vector containing the endogenous variable.
Arne Henningsen
quadFuncEst
and quadFuncDeriv
.
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a quadratic production function estResult <- quadFuncEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ), germanFarms ) quadFuncCalc( c( "qLabor", "land", "qVarInput", "time" ), germanFarms, coef( estResult ) ) #equal to estResult$fitted
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a quadratic production function estResult <- quadFuncEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ), germanFarms ) quadFuncCalc( c( "qLabor", "land", "qVarInput", "time" ), germanFarms, coef( estResult ) ) #equal to estResult$fitted
Calculate the derivatives of a quadratic function.
quadFuncDeriv( xNames, data, coef, coefCov = NULL, homWeights = NULL )
quadFuncDeriv( xNames, data, coef, coefCov = NULL, homWeights = NULL )
xNames |
a vector of strings containing the names of the independent variables. |
data |
dataframe or a vector with named elements containing the data. |
coef |
vector containing all coefficients:
if there are |
coefCov |
optional covariance matrix of the coefficients:
the row names and column names must be the same as the names
of |
homWeights |
numeric vector with named elements that are weighting factors
for calculating an index that is used to normalize the variables
for imposing homogeneity of degree zero in these variables
(see documentation of |
Shifter variables do not need to be specified, because they have no effect on the partial derivatives. Hence, you can use this function to calculate partial derivatives even for quadratic functions that have been estimated with shifter variables.
A data frame containing the derivatives,
where each column corresponds to one of the independent variables.
If argument coefCov
is provided, it has the attributes
variance
and stdDev
,
which are two data frames containing the variances
and the standard deviations, respectively, of the derivatives.
Arne Henningsen
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a quadratic production function estResult <- quadFuncEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ), germanFarms ) # compute the marginal products of the inputs margProducts <- quadFuncDeriv( c( "qLabor", "land", "qVarInput", "time" ), germanFarms, coef( estResult ), vcov( estResult ) ) # all marginal products margProducts # their t-values margProducts / attributes( margProducts )$stdDev
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a quadratic production function estResult <- quadFuncEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ), germanFarms ) # compute the marginal products of the inputs margProducts <- quadFuncDeriv( c( "qLabor", "land", "qVarInput", "time" ), germanFarms, coef( estResult ), vcov( estResult ) ) # all marginal products margProducts # their t-values margProducts / attributes( margProducts )$stdDev
Calculate elasticities of a quadratic function.
quadFuncEla( xNames, data, coef, yName = NULL, shifterNames = NULL, homWeights = NULL ) ## S3 method for class 'quadFuncEst' elas( object, data = NULL, yObs = FALSE, ... )
quadFuncEla( xNames, data, coef, yName = NULL, shifterNames = NULL, homWeights = NULL ) ## S3 method for class 'quadFuncEst' elas( object, data = NULL, yObs = FALSE, ... )
xNames |
a vector of strings containing the names of the independent variables. |
data |
dataframe or a vector with named elements containing the data;
if argument |
coef |
vector containing all coefficients. |
yName |
an optional string containing the name of the dependent
variable.
If it is |
shifterNames |
an optional vector of strings containing the names of the independent variables that are included as shifters only (not in quadratic or interaction terms). |
homWeights |
numeric vector with named elements that are weighting factors
for calculating an index that is used to normalize the variables
for imposing homogeneity of degree zero in these variables
(see documentation of |
object |
object of class |
yObs |
logical. Use observed values of the endogenous variable.
If |
... |
currently ignored. |
A data.frame of class quadFuncEla
,
where each column corresponds to one of the independent variables.
Arne Henningsen
quadFuncEst
, quadFuncDeriv
, and
quadFuncCalc
.
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a quadratic production function estResult <- quadFuncEst( yName = "qOutput", xNames = c( "qLabor", "land", "qVarInput", "time" ), data = germanFarms ) # compute the partial production elasticities with "fitted" output elaFit <- quadFuncEla( xNames = c( "qLabor", "land", "qVarInput", "time" ), data = germanFarms, coef = coef( estResult ) ) elaFit # same as elaFit2 <- elas( estResult ) all.equal( elaFit, elaFit2 ) # compute the partial production elasticities with observed output elaObs <- quadFuncEla( xNames = c( "qLabor", "land", "qVarInput", "time" ), data = germanFarms, coef = coef( estResult ), yName = "qOutput" ) elaObs # same as elaObs2 <- elas( estResult, yObs = TRUE ) all.equal( elaObs, elaObs2 )
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a quadratic production function estResult <- quadFuncEst( yName = "qOutput", xNames = c( "qLabor", "land", "qVarInput", "time" ), data = germanFarms ) # compute the partial production elasticities with "fitted" output elaFit <- quadFuncEla( xNames = c( "qLabor", "land", "qVarInput", "time" ), data = germanFarms, coef = coef( estResult ) ) elaFit # same as elaFit2 <- elas( estResult ) all.equal( elaFit, elaFit2 ) # compute the partial production elasticities with observed output elaObs <- quadFuncEla( xNames = c( "qLabor", "land", "qVarInput", "time" ), data = germanFarms, coef = coef( estResult ), yName = "qOutput" ) elaObs # same as elaObs2 <- elas( estResult, yObs = TRUE ) all.equal( elaObs, elaObs2 )
Estimate a quadratic function.
quadFuncEst( yName, xNames, data, shifterNames = NULL, linear = FALSE, homWeights = NULL, regScale = 1, ... )
quadFuncEst( yName, xNames, data, shifterNames = NULL, linear = FALSE, homWeights = NULL, regScale = 1, ... )
yName |
a character string containing the name of the dependent variable. |
xNames |
a vector of strings containing the names of the independent variables. |
data |
data frame containing the data
(possibly a panel data frame created with
|
shifterNames |
a vector of strings containing the names of the independent variables that should be included as shifters only (not in quadratic or interaction terms). |
linear |
logical. Restrict the coefficients of all quadratic and interaction terms to be zero so that the estimated function is linear in the exogenous variables? |
homWeights |
numeric vector with named elements that are weighting factors for calculating an index that is used to normalize the variables for imposing homogeneity of degree zero in these variables (see details). |
regScale |
a scalar or vector with length equal to |
... |
If argument homWeights
is used to impose homogeneity of degree
zero in some variables,
the weighting factors in this vector must have names
that are equal to the variable names in argument xNames
.
The order of the elements in homWeights
is arbitrary and may or may not be equal
to the order of the elements in xNames
.
Argument homWeights
may contain less elements
than xNames
;
in this case, homogeneity of degree zero is imposed only
on variables with names in homWeights
.
Please note that the weighting factor of a variable
() in
homWeights
()
is not really its weight
(
),
in particular,
if the numerical values of the variables (
)
are rather different.
a list of class quadFuncEst
containing following objects:
est |
|
nExog |
length of argument |
nShifter |
length of argument |
residuals |
residuals. |
fitted |
fitted values. |
coef |
vector of all coefficients. |
coefCov |
covariance matrix of all coefficients. |
r2 |
|
r2bar |
adjusted |
nObs |
number of observations. |
model.matrix |
the model matrix. |
call |
the matched call. |
yName |
argument |
xNames |
argument |
shifterNames |
argument |
homWeights |
argument |
regScale |
argument |
Arne Henningsen
quadFuncCalc
, quadFuncDeriv
,
translogEst
and snqProfitEst
.
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a quadratic production function estResult <- quadFuncEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ), germanFarms ) coef( estResult ) estResult$r2
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a quadratic production function estResult <- quadFuncEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ), germanFarms ) coef( estResult ) estResult$r2
Extract the residuals from the estimation of a Translog function.
## S3 method for class 'translogEst' residuals( object, ... )
## S3 method for class 'translogEst' residuals( object, ... )
object |
an object of class |
... |
currently not used. |
residuals.translogEst
returns a vector
containing the residuals of an estimated translog function.
Arne Henningsen
translogEst
and residuals
summary.translogEst
summarizes the estimation results
of a Translog Function.
## S3 method for class 'translogEst' summary( object, ... ) ## S3 method for class 'summary.translogEst' print( x, ... )
## S3 method for class 'translogEst' summary( object, ... ) ## S3 method for class 'summary.translogEst' print( x, ... )
object |
an object of class |
x |
an object of class |
... |
currently ignored. |
summary.translogEst
returns a list of class summary.translogEst
that is currently the provided object
,
but an element coefTable
has been added
and the class has been changed.
Arne Henningsen
Calculate the dependent variable of a translog function.
translogCalc( xNames, data, coef, shifterNames = NULL, dataLogged = FALSE )
translogCalc( xNames, data, coef, shifterNames = NULL, dataLogged = FALSE )
xNames |
a vector of strings containing the names of the independent variables. |
data |
dataframe containing the data. |
coef |
vector containing all coefficients:
if there are |
shifterNames |
a vector of strings containing the names of the independent variables that should be included as shifters only (not in quadratic or interaction terms). |
dataLogged |
logical. Are the values in |
A vector containing the endogenous variable.
If the inputs are provided as logarithmic values
(argument dataLogged
is TRUE
),
the endogenous variable is returned as logarithm;
non-logarithmic values are returned otherwise.
Arne Henningsen
translogEst
and translogDeriv
.
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a Translog production function estResult <- translogEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ), germanFarms ) translogCalc( c( "qLabor", "land", "qVarInput", "time" ), germanFarms, coef( estResult ) ) #equal to estResult$fitted
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a Translog production function estResult <- translogEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ), germanFarms ) translogCalc( c( "qLabor", "land", "qVarInput", "time" ), germanFarms, coef( estResult ) ) #equal to estResult$fitted
Check curvature of a translog function.
translogCheckCurvature( xNames, data, coef, convexity = TRUE, quasi = FALSE, dataLogged = FALSE, ... ) ## S3 method for class 'translogCheckCurvature' print( x, ... )
translogCheckCurvature( xNames, data, coef, convexity = TRUE, quasi = FALSE, dataLogged = FALSE, ... ) ## S3 method for class 'translogCheckCurvature' print( x, ... )
xNames |
a vector of strings containing the names of the independent variables. |
data |
dataframe containing the data. |
coef |
vector containing all coefficients. |
convexity |
logical. Check whether the function is (quasi)convex
(default, |
quasi |
logical. Check whether the function is quasiconvex/quasiconcave
( |
dataLogged |
logical. Are the values in |
x |
an object returned by |
... |
arguments passed from |
translogCheckCurvature
returns a list of class
translogCheckCurvature
containing following objects:
obs |
a vector indicating whether the condition for the specified curvature is fulfilled at each observation. |
convexity |
argument |
quasi |
argument |
Arne Henningsen
translogEst
and translogCheckMono
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a translog production function estResult <- translogEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ), germanFarms ) # check whether the production function is quasiconcave translogCheckCurvature( c( "qLabor", "land", "qVarInput", "time" ), germanFarms, coef( estResult ), convexity = FALSE, quasi = TRUE )
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a translog production function estResult <- translogEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ), germanFarms ) # check whether the production function is quasiconcave translogCheckCurvature( c( "qLabor", "land", "qVarInput", "time" ), germanFarms, coef( estResult ), convexity = FALSE, quasi = TRUE )
Check monotonicity of a translog function.
translogCheckMono( xNames, data, coef, increasing = TRUE, strict = FALSE, dataLogged = FALSE, tol = 10 * .Machine$double.eps ) ## S3 method for class 'translogCheckMono' print( x, ... ) ## S3 method for class 'translogCheckMono' summary( object, ... ) ## S3 method for class 'summary.translogCheckMono' print( x, ... )
translogCheckMono( xNames, data, coef, increasing = TRUE, strict = FALSE, dataLogged = FALSE, tol = 10 * .Machine$double.eps ) ## S3 method for class 'translogCheckMono' print( x, ... ) ## S3 method for class 'translogCheckMono' summary( object, ... ) ## S3 method for class 'summary.translogCheckMono' print( x, ... )
xNames |
a vector of strings containing the names of the independent variables. |
data |
dataframe containing the data. |
coef |
vector containing all coefficients. |
increasing |
single logical value or vector of logical values
of the same length as argument |
strict |
logical. Check for strict (TRUE) or non-strict (default, FALSE) monotonicity? |
dataLogged |
logical. Are the values in |
tol |
tolerance level for checking non-strict monotonicity:
values between |
x |
an object returned by |
object |
an object returned by |
... |
currently not used. |
Function translogCheckMono
internally calls
function translogDeriv
and then checks if the derivatives have the sign
specified in argument increasing
.
Function translogCheckMono
does not have an argument
shifterNames
, because shifter variables do not affect
the monotonicity conditions of the eplanatory variables
defined in Argument xNames
.
Therefore, translogCheckMono
automatically removes
all coefficients of the shifter variables
before it calls translogDeriv
.
translogCheckMono
returns a list of class translogCheckMono
containing following objects:
obs |
a vector indicating whether monotonicity is fulfilled at each observation. |
exog |
data frame indicating whether monotonicity is fulfilled for each exogenous variable at each observation. |
increasing |
argument |
strict |
argument |
Arne Henningsen
translogEst
, translogDeriv
,
and translogCheckCurvature
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a translog production function estResult <- translogEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ), germanFarms ) # check whether the production function is monotonically increasing # in all inputs test <- translogCheckMono( xNames = c( "qLabor", "land", "qVarInput", "time" ), data = germanFarms, coef = coef( estResult ) ) test summary( test ) # check whether the production function is monotonically decreasing # in time and monotonically increasing in all other inputs test <- translogCheckMono( c( "qLabor", "land", "qVarInput", "time" ), germanFarms, coef( estResult ), increasing = c( TRUE, TRUE, TRUE, FALSE ) ) test summary( test )
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a translog production function estResult <- translogEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ), germanFarms ) # check whether the production function is monotonically increasing # in all inputs test <- translogCheckMono( xNames = c( "qLabor", "land", "qVarInput", "time" ), data = germanFarms, coef = coef( estResult ) ) test summary( test ) # check whether the production function is monotonically decreasing # in time and monotonically increasing in all other inputs test <- translogCheckMono( c( "qLabor", "land", "qVarInput", "time" ), germanFarms, coef( estResult ), increasing = c( TRUE, TRUE, TRUE, FALSE ) ) test summary( test )
Estimate a translog cost function.
NOTE: this function is still under development and incomplete!
translogCostEst( cName, yName, pNames, data, fNames = NULL, shifterNames = NULL, dataLogged = FALSE, homPrice = TRUE, ... )
translogCostEst( cName, yName, pNames, data, fNames = NULL, shifterNames = NULL, dataLogged = FALSE, homPrice = TRUE, ... )
cName |
a string containing the name of the variable for total cost. |
yName |
a string containing the name of the variable for the total output quantity. |
pNames |
a vector of strings containing the names of the input prices. |
data |
data frame containing the data
(possibly a panel data frame created with
|
fNames |
a vector of strings containing the names of fixed inputs. |
shifterNames |
a vector of strings containing the names of the independent variables that should be included as shifters only (not in quadratic or interaction terms). |
dataLogged |
logical. Are the values in |
homPrice |
logical. Should homogeneity of degree one in prices be imposed? |
... |
a list of class translogCostEst
containing following objects:
est |
|
nExog |
length of argument |
nShifter |
length of argument |
residuals |
residuals. |
fitted |
fitted values. |
coef |
vector of all coefficients. |
coefCov |
covariance matrix of all coefficients. |
r2 |
|
r2bar |
adjusted |
nObs |
number of observations. |
model.matrix |
the model matrix. |
call |
the matched call. |
cName |
argument |
yName |
argument |
pNames |
argument |
fNames |
argument |
shifterNames |
argument |
dataLogged |
argument |
homPrice |
argument |
Arne Henningsen
translogEst
and quadFuncEst
.
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # value of labor input germanFarms$vLabor <- germanFarms$pLabor + germanFarms$qLabor # total variable cost germanFarms$cost <- germanFarms$vLabor + germanFarms$vVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a translog cost function estResult <- translogCostEst( cName = "cost", yName = "qOutput", pNames = c( "pLabor", "pVarInput" ), fNames = "land", shifterNames = "time", data = germanFarms, homPrice = FALSE ) summary( estResult$est )
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # value of labor input germanFarms$vLabor <- germanFarms$pLabor + germanFarms$qLabor # total variable cost germanFarms$cost <- germanFarms$vLabor + germanFarms$vVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a translog cost function estResult <- translogCostEst( cName = "cost", yName = "qOutput", pNames = c( "pLabor", "pVarInput" ), fNames = "land", shifterNames = "time", data = germanFarms, homPrice = FALSE ) summary( estResult$est )
Calculate the derivatives of a translog function.
translogDeriv( xNames, data, coef, coefCov = NULL, yName = NULL, dataLogged = FALSE )
translogDeriv( xNames, data, coef, coefCov = NULL, yName = NULL, dataLogged = FALSE )
xNames |
a vector of strings containing the names of the independent variables. |
data |
dataframe containing the data. |
coef |
vector containing all coefficients. |
coefCov |
optional covariance matrix of the coefficients. |
yName |
an optional string containing the name of the dependent
variable.
If it is |
dataLogged |
logical. Are the values in |
a list of class translogDeriv
containing following objects:
deriv |
data frame containing the derivatives. |
variance |
data frame containing the variances of the derivatives (not implemented yet). |
stdDev |
data frame containing the standard deviations of the derivatives (not implemented yet). |
Arne Henningsen
translogEst
, translogCalc
and
translogHessian
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a translog production function estResult <- translogEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ), germanFarms ) # compute the marginal products of the inputs (with "fitted" Output) margProducts <- translogDeriv( c( "qLabor", "land", "qVarInput", "time" ), germanFarms, coef( estResult ), vcov( estResult ) ) margProducts$deriv # compute the marginal products of the inputs (with observed Output) margProductsObs <- translogDeriv( c( "qLabor", "land", "qVarInput", "time" ), germanFarms, coef( estResult ), vcov( estResult ), "qOutput" ) margProductsObs$deriv
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a translog production function estResult <- translogEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ), germanFarms ) # compute the marginal products of the inputs (with "fitted" Output) margProducts <- translogDeriv( c( "qLabor", "land", "qVarInput", "time" ), germanFarms, coef( estResult ), vcov( estResult ) ) margProducts$deriv # compute the marginal products of the inputs (with observed Output) margProductsObs <- translogDeriv( c( "qLabor", "land", "qVarInput", "time" ), germanFarms, coef( estResult ), vcov( estResult ), "qOutput" ) margProductsObs$deriv
Calculate the elasticities of a translog function.
translogEla( xNames, data, coef, coefCov = NULL, dataLogged = FALSE ) ## S3 method for class 'translogEst' elas( object, data = NULL, dataLogged = NULL, ... )
translogEla( xNames, data, coef, coefCov = NULL, dataLogged = FALSE ) ## S3 method for class 'translogEst' elas( object, data = NULL, dataLogged = NULL, ... )
xNames |
a vector of strings containing the names of the independent variables. |
data |
dataframe containing the data;
if argument |
coef |
vector containing all coefficients:
if there are |
coefCov |
optional covariance matrix of the coefficients:
the row names and column names must be the same as the names
of |
dataLogged |
logical. Are the values in |
object |
object of class |
... |
currently ignored. |
Shifter variables do not need to be specified, because they have no effect on the elasticities. Hence, you can use this function to calculate elasticities even for translog functions that have been estimated with shifter variables.
A data frame containing the elasticities,
where each column corresponds to one of the independent variables.
If argument coefCov
is provided, it has the attributes
variance
and stdDev
,
which are two data frames containing the variances
and the standard deviations, respectively, of the elasticities.
Arne Henningsen
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a quadratic production function estResult <- translogEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ), germanFarms ) # calculate production elasticities of all inputs estEla <- translogEla( c( "qLabor", "land", "qVarInput", "time" ), data = germanFarms, coef = coef( estResult ), coefCov = vcov( estResult ) ) # all elasticities estEla # t-values of all elasticities estEla / attributes( estEla )$stdDev
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a quadratic production function estResult <- translogEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ), germanFarms ) # calculate production elasticities of all inputs estEla <- translogEla( c( "qLabor", "land", "qVarInput", "time" ), data = germanFarms, coef = coef( estResult ), coefCov = vcov( estResult ) ) # all elasticities estEla # t-values of all elasticities estEla / attributes( estEla )$stdDev
Estimate a translog function.
translogEst( yName, xNames, data, shifterNames = NULL, dataLogged = FALSE, ... ) ## S3 method for class 'translogEst' print( x, ... )
translogEst( yName, xNames, data, shifterNames = NULL, dataLogged = FALSE, ... ) ## S3 method for class 'translogEst' print( x, ... )
yName |
a string containing the name of the dependent variable. |
xNames |
a vector of strings containing the names of the independent variables. |
data |
data frame containing the data
(possibly a panel data frame created with
|
shifterNames |
a vector of strings containing the names of the independent variables that should be included as shifters only (not in quadratic or interaction terms). |
dataLogged |
logical. Are the values in |
x |
An object of class |
... |
further arguments of |
a list of class translogEst
containing following objects:
est |
|
nExog |
length of argument |
nShifter |
length of argument |
residuals |
residuals. |
fitted |
fitted values. |
coef |
vector of all coefficients. |
coefCov |
covariance matrix of all coefficients. |
r2 |
|
r2bar |
adjusted |
nObs |
number of observations. |
model.matrix |
the model matrix. |
call |
the matched call. |
yName |
argument |
xNames |
argument |
shifterNames |
argument |
dataLogged |
argument |
Arne Henningsen
translogCalc
, translogDeriv
and quadFuncEst
.
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a quadratic production function estResult <- translogEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ), germanFarms ) estResult summary( estResult )
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a quadratic production function estResult <- translogEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ), germanFarms ) estResult summary( estResult )
Calculate the Hessian matrices of a translog function.
translogHessian( xNames, data, coef, yName = NULL, dataLogged = FALSE, bordered = FALSE )
translogHessian( xNames, data, coef, yName = NULL, dataLogged = FALSE, bordered = FALSE )
xNames |
a vector of strings containing the names of the independent variables. |
data |
dataframe containing the data. |
coef |
vector containing all coefficients. |
yName |
an optional string containing the name of the dependent
variable.
If it is |
dataLogged |
logical. Are the values in |
bordered |
logical. Should the bordered Hessians be returned? |
a list containing following the (bordered) Hessian matrices at each data point.
Arne Henningsen
translogEst
, translogDeriv
and
translogCalc
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a quadratic production function estResult <- translogEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ), germanFarms ) # compute the Hessian matrices (with "fitted" output) hessians <- translogHessian( c( "qLabor", "land", "qVarInput", "time" ), germanFarms, coef( estResult ) ) hessians[[ 1 ]] # compute the Hessian matrices (with observed output) hessiansObs <- translogHessian( c( "qLabor", "land", "qVarInput", "time" ), germanFarms, coef( estResult ), "qOutput" ) hessiansObs[[ 1 ]] # compute the bordered Hessian matrices borderedHessians <- translogHessian( c( "qLabor", "land", "qVarInput", "time" ), germanFarms, coef( estResult ), bordered = TRUE ) borderedHessians[[ 1 ]]
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # estimate a quadratic production function estResult <- translogEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ), germanFarms ) # compute the Hessian matrices (with "fitted" output) hessians <- translogHessian( c( "qLabor", "land", "qVarInput", "time" ), germanFarms, coef( estResult ) ) hessians[[ 1 ]] # compute the Hessian matrices (with observed output) hessiansObs <- translogHessian( c( "qLabor", "land", "qVarInput", "time" ), germanFarms, coef( estResult ), "qOutput" ) hessiansObs[[ 1 ]] # compute the bordered Hessian matrices borderedHessians <- translogHessian( c( "qLabor", "land", "qVarInput", "time" ), germanFarms, coef( estResult ), bordered = TRUE ) borderedHessians[[ 1 ]]
Create matrix to check or impose the monotonicity restrictions of a translog function.
translogMonoRestr( xNames, data, dataLogged = FALSE, box = FALSE )
translogMonoRestr( xNames, data, dataLogged = FALSE, box = FALSE )
xNames |
a vector of strings containing the names of the independent variables. |
data |
dataframe containing the data. |
dataLogged |
logical. Are the values in |
box |
logical. Should monotonicity be imposed within
an |
translogMonoRestr
returns a matrix of dimension
,
where
is the number of independent varables,
is the number of data points at which monotonicity
should be imposed (if argument
box
is FALSE
,
is the number of rows in
data
;
if argument box
is TRUE
, ),
and
is the number of (linearly independent)
coefficients.
Multiplying a row of this matrix (e.g.\ the
th row of
)
by the vector of coefficients (
)
results in the derivative of the dependent variable (
)
with respect to one independent variable (e.g.\
)
at one data point (e.g.\
):
,
evaluated at , ...,
,
where
.
Hence, the observations run faster than the independent variables.
Arne Henningsen
translogEst
, translogDeriv
,
and translogCheckMono
data( germanFarms ) # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # matrix to check or impose monotonicity at all observations monoRestrObs <- translogMonoRestr( c( "qLabor", "land", "qVarInput" ), germanFarms ) # matrix to check or impose monotonicity within a box that includes all # observations monoRestrBox <- translogMonoRestr( c( "qLabor", "land", "qVarInput" ), germanFarms, box = TRUE )
data( germanFarms ) # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # matrix to check or impose monotonicity at all observations monoRestrObs <- translogMonoRestr( c( "qLabor", "land", "qVarInput" ), germanFarms ) # matrix to check or impose monotonicity within a box that includes all # observations monoRestrBox <- translogMonoRestr( c( "qLabor", "land", "qVarInput" ), germanFarms, box = TRUE )
Calculate the marginal costs of the output from a translog production function.
translogProdFuncMargCost( yName, xNames, wNames, data, coef, dataLogged = FALSE )
translogProdFuncMargCost( yName, xNames, wNames, data, coef, dataLogged = FALSE )
yName |
a single character string containing the name of the output quantity. |
xNames |
a vector of strings containing the names of the input quantities. |
wNames |
a vector of strings containing the names of the input prices. |
data |
dataframe containing the data. |
coef |
vector containing all coefficients:
if there are |
dataLogged |
logical. Are the values in |
A vector containing the marginal costs of producing the output.
Arne Henningsen and Geraldine Henningsen
translogEst
, translogCalc
,
translogDeriv
, translogEla
and
translogCostEst
.
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # generate (artificial) prices germanFarms$pLand <- 200 + 15 * germanFarms$time germanFarms$pTime <- 1 # estimate a single-output translog production function estResult <- translogEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ), germanFarms ) # compute the marginal costs of producing the output margCost <- translogProdFuncMargCost( yName = "qOutput", xNames = c( "qLabor", "land", "qVarInput", "time" ), wNames = c( "pLabor", "pLand", "pVarInput", "pTime" ), data = germanFarms, coef = coef( estResult ) )
data( germanFarms ) # output quantity: germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput # quantity of variable inputs germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput # a time trend to account for technical progress: germanFarms$time <- c(1:20) # generate (artificial) prices germanFarms$pLand <- 200 + 15 * germanFarms$time germanFarms$pTime <- 1 # estimate a single-output translog production function estResult <- translogEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ), germanFarms ) # compute the marginal costs of producing the output margCost <- translogProdFuncMargCost( yName = "qOutput", xNames = c( "qLabor", "land", "qVarInput", "time" ), wNames = c( "pLabor", "pLand", "pVarInput", "pTime" ), data = germanFarms, coef = coef( estResult ) )
The data frame utility
is a panel data set
of 72 investor-owned fossil fuel fired steam electric power plants
in the United States over eleven years (1986-1996).
This data set has 791 observations and, thus, is almost balanced
(only one firm-year observation is missing).
This data set is used as an example in
Kumbhakar, Wang, and Horncastle (2015).
data(utility)
data(utility)
This data frame contains the following columns/variables:
firm number (1-72).
last two digits of the year (86-96).
net steam electric power generation in MWh.
a dummy variable indicating whether the firm is regulated.
capital input quantity (estimate of capital cost).
quantity index of labor and maintenance input
(costs of labor and maintenance divided by wl
).
quantity index of fuel input.
(costs of fuel divided by wf
).
cost-share weighted price of labor and maintenance.
average price of fuel (coal, oil and gas) in USD per BTU.
price of the capital input.
This data set is a revised version of the data set that is used in Kumbhakar and Wang (2006). A detailed description of the data set and the variables can be found in Section 4 of Kumbhakar and Wang (2006).
Companion website to Kumbhakar, Wang, and Horncastle (2015): https://sites.google.com/site/sfbook2014/.
Kumbhakar, Subal C. and Hung-Jen Wang (2006): Estimation of Technical and Allocative Inefficiency: A Primal System Approach, Journal of Econometrics 134(2), p. 419-440. (doi:10.1016/j.jeconom.2005.07.001)
Kumbhakar, Subal C., Hung-Jen Wang, and Alan P. Horncastle (2015): A Practitioner's Guide to Stochastic Frontier Analysis Using Stata. Cambridge University Press. (doi:10.1017/CBO9781139342070)