Learn R Programming

micEcon (version 0.6-12)

cobbDouglasOpt: Optimal Values of Independent Variables of a Cobb-Douglas Function

Description

Calculate the optimal values of the variable independent variables of a Cobb-Douglas function.

Usage

cobbDouglasOpt( pyName, pxNames, data, coef, zNames = NULL, zCoef = NULL, xNames = NULL, dataLogged = FALSE )

Arguments

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 pxNames (in the same order); if the elements of coef have names, the element named a_0 is taken as intercept of the logged equation and the elements named a_1, ..., a_n are taken as coefficients of the variable independent variables with corresponding prices defined in argument xNames (numbered in that order).
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 zNames (in the same order); if the elements of coef have names, the elements named d_1, ..., d_m are taken as coefficients of the fixed independent variables with corresponding prices defined in argument zNames (numbered in that order).
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 data with names defined in pyName, pxNames, and zNames already logged?

Value

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.

See Also

cobbDouglasCalc.

Examples

Run this code
   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 )

Run the code above in your browser using DataLab