# load and prepare data set
data( appleProdFr86, package = "micEcon" )
appleProdFr86$qCap <- appleProdFr86$vCap / appleProdFr86$pCap
appleProdFr86$qLab <- appleProdFr86$vLab / appleProdFr86$pLab
appleProdFr86$qMat <- appleProdFr86$vMat / appleProdFr86$pMat
# Cobb-Douglas ray-based input distance function (with manually set parameters)
appleProdFr86$logDistCD <- distRayCalc( xNames = c( "qCap", "qLab", "qMat" ),
yNames = c( "qApples", "qOtherOut" ), data = appleProdFr86,
coef = c( "(Intercept)" = -11.116, alpha_1 = 0.082, alpha_2 = 0.615,
beta_1 = -0.031, beta_2 = -0.388 ), form = "cd" )
summary( appleProdFr86$logDistCD )
# Translog ray-based input distance function (with estimated parameters)
estTL <- distRayEst( xNames = c( "qCap", "qLab", "qMat" ),
yNames = c( "qApples", "qOtherOut" ),
data = appleProdFr86 )
appleProdFr86$logDistTL <- distRayCalc( xNames = c( "qCap", "qLab", "qMat" ),
yNames= c( "qApples", "qOtherOut" ), data = appleProdFr86,
coef = coef( estTL ) )
summary( appleProdFr86$logDistTL )
Run the code above in your browser using DataLab