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)
# weights to impose
weights <- c(
pOutput = mean( germanFarms$qOutput ),
pVarInput = mean( germanFarms$qVarInput ),
pLabor = mean( germanFarms$qLabor ) )
weights <- weights / sum( weights )
# estimate an input demand function
estResult <- npregHom( "qVarInput",
xNames = c( "pOutput", "pVarInput", "pLabor", "land" ),
data = germanFarms, homWeights = weights )
estResult$grad
# estimate an input demand function using the Epanechnikov kernel
estResultEpa <- npregHom( "qVarInput",
xNames = c( "pOutput", "pVarInput", "pLabor", "land" ),
data = germanFarms, homWeights = weights, ckertype="epanechnikov" )
estResultEpa$grad
# estimate an input demand function with manual bandwidths selection
estResultMan <- npregHom( "qVarInput",
xNames = c( "pOutput", "pVarInput", "pLabor", "land" ),
data = germanFarms, homWeights = weights, bws = rep( 1, 3 ),
bwscaling = TRUE )
estResultMan$grad
Run the code above in your browser using DataLab