cobbDouglasDeriv: Derivatives of a Cobb-Douglas function

View source: R/cobbDouglasDeriv.R

cobbDouglasDerivR Documentation

Derivatives of a Cobb-Douglas function

Description

Calculate the derivatives of a Cobb-Douglas function.

Usage

cobbDouglasDeriv( xNames, data, coef, coefCov = NULL,
   yName = NULL, dataLogged = FALSE )

Arguments

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 xNames (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 independent variables defined in argument xNames (numbered in that order).

coefCov

optional covariance matrix of the coefficients (the order of the rows and columns must correspond to the order of the coefficients in argument coef).

yName

an optional string containing the name of the dependent variable. If it is NULL, the dependent variable is calculated from the independent variables and the coefficients.

dataLogged

logical. Are the values in data already logged?

Value

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 coefCov is provided). NOTE: if argument yName is specified, the variance of the endogenous variable is currently ignored.

Author(s)

Arne Henningsen

See Also

cobbDouglasCalc, translogDeriv.

Examples

   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

micEcon documentation built on Sept. 4, 2022, 1:06 a.m.