CRAN Package Check Results for Package micEcon

Last updated on 2022-01-17 05:51:13 CET.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 0.6-16 4.54 77.83 82.37 OK
r-devel-linux-x86_64-debian-gcc 0.6-16 4.67 58.90 63.57 OK
r-devel-linux-x86_64-fedora-clang 0.6-16 100.11 NOTE
r-devel-linux-x86_64-fedora-gcc 0.6-16 101.57 OK
r-devel-windows-x86_64-new-UL 0.6-16 56.00 100.00 156.00 OK
r-devel-windows-x86_64-new-TK 0.6-16 ERROR
r-patched-linux-x86_64 0.6-16 7.91 74.43 82.34 OK
r-release-linux-x86_64 0.6-16 OK
r-release-macos-arm64 0.6-16 OK
r-release-macos-x86_64 0.6-16 OK
r-release-windows-ix86+x86_64 0.6-16 13.00 96.00 109.00 OK
r-oldrel-macos-x86_64 0.6-16 OK
r-oldrel-windows-ix86+x86_64 0.6-16 13.00 99.00 112.00 OK

Check Details

Version: 0.6-16
Check: Rd cross-references
Result: NOTE
    Undeclared packages ‘micEconAids’, ‘micEconSNQP’ in Rd xrefs
Flavor: r-devel-linux-x86_64-fedora-clang

Version: 0.6-16
Check: package dependencies
Result: NOTE
    Package suggested but not available for checking: 'systemfit'
Flavor: r-devel-windows-x86_64-new-TK

Version: 0.6-16
Check: Rd cross-references
Result: NOTE
    Packages unavailable to check Rd xrefs: 'micEconAids', 'micEconSNQP'
Flavor: r-devel-windows-x86_64-new-TK

Version: 0.6-16
Check: tests
Result: ERROR
     Running 'cobbDouglasTest.R'
     Comparing 'cobbDouglasTest.Rout' to 'cobbDouglasTest.Rout.save' ... OK
     Running 'logDataSetTest.R'
     Comparing 'logDataSetTest.Rout' to 'logDataSetTest.Rout.save' ... OK
     Running 'quadFunc.R'
    Running the tests in 'tests/quadFunc.R' failed.
    Complete output:
     > library( micEcon )
    
     If you have questions, suggestions, or comments regarding one of the 'micEcon' packages, please use a forum or 'tracker' at micEcon's R-Forge site:
     https://r-forge.r-project.org/projects/micecon/
     > library( plm )
     > options( digits = 3 )
     > printQuadFuncEst <- function( x ) {
     + for( n in names( x ) ) {
     + cat( "$", n, "\n", sep ="" )
     + if( n == "model.matrix" && is.numeric( x[[ n ]] ) ) {
     + for( i in 1:ncol( x[[ n ]] ) ) {
     + size <- floor( log( x[[ n ]][ , i ], base = 10 ) ) + 1
     + size[ size < -5 ] <- -5
     + fac <- 10^( size - 5 )
     + x[[ n ]][ , i ] <- fac * round( x[[ n ]][ , i ] / fac )
     + }
     + }
     + print( x[[ n ]] )
     + cat( "\n" )
     + }
     + cat( "attr(,\"class\")\n" )
     + print( class( x ) )
     + }
     >
     > ## preparing data
     > 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)
     > # mean values of all variables
     > germanFarmsMeans <- colMeans( germanFarms[ , -1 ] )
     >
     > ## estimate a quadratic production function
     > estResult <- quadFuncEst( "qOutput",
     + c( "qLabor", "land", "qVarInput", "time" ), germanFarms )
     > coef( estResult )
     a_0 a_1 a_2 a_3 a_4 b_1_1 b_1_2 b_1_3
     -1.89e+04 1.64e+04 2.89e+01 1.92e+01 -1.50e+02 -1.14e+04 2.45e+02 -5.29e+00
     b_1_4 b_2_2 b_2_3 b_2_4 b_3_3 b_3_4 b_4_4
     -1.45e+02 -4.79e+00 -3.67e-01 5.18e+00 -7.90e-03 5.06e-01 -1.30e+01
     > print( estResult )
     $call
     quadFuncEst(yName = "qOutput", xNames = c("qLabor", "land", "qVarInput",
     "time"), data = germanFarms)
    
     $nExog
     [1] 4
    
     $nShifter
     [1] 0
    
     $est
    
     Call:
     lm(formula = as.formula(estFormula), data = estData)
    
     Coefficients:
     (Intercept) a_1 a_2 a_3 a_4 b_1_1
     -1.89e+04 1.64e+04 2.89e+01 1.92e+01 -1.50e+02 -1.14e+04
     b_1_2 b_1_3 b_1_4 b_2_2 b_2_3 b_2_4
     2.45e+02 -5.29e+00 -1.45e+02 -4.79e+00 -3.67e-01 5.18e+00
     b_3_3 b_3_4 b_4_4
     -7.90e-03 5.06e-01 -1.30e+01
    
    
     $residuals
     1 2 3 4 5 6 7 8 9 10
     7.432 -39.365 21.652 32.467 -0.816 -21.651 -0.640 -4.241 12.971 -7.827
     11 12 13 14 15 16 17 18 19 20
     -2.867 2.988 -6.250 0.863 7.942 7.057 -20.630 13.722 -3.067 0.260
    
     $fitted
     1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
     939 1002 1048 1139 1179 1207 1240 1293 1195 1286 1363 1538 1581 1695 1637 1619
     17 18 19 20
     1676 1742 1890 1992
    
     $coef
     a_0 a_1 a_2 a_3 a_4 b_1_1 b_1_2 b_1_3
     -1.89e+04 1.64e+04 2.89e+01 1.92e+01 -1.50e+02 -1.14e+04 2.45e+02 -5.29e+00
     b_1_4 b_2_2 b_2_3 b_2_4 b_3_3 b_3_4 b_4_4
     -1.45e+02 -4.79e+00 -3.67e-01 5.18e+00 -7.90e-03 5.06e-01 -1.30e+01
    
     $coefCov
     a_0 a_1 a_2 a_3 a_4 b_1_1 b_1_2
     a_0 1.94e+08 -2.20e+08 -6.68e+06 1.05e+05 6.70e+06 1.13e+08 4.31e+06
     a_1 -2.20e+08 2.81e+08 6.63e+06 -1.51e+05 -7.66e+06 -1.69e+08 -4.62e+06
     a_2 -6.68e+06 6.63e+06 5.13e+05 -1.06e+04 -3.64e+05 -2.55e+06 -3.15e+05
     a_3 1.05e+05 -1.51e+05 -1.06e+04 3.56e+02 6.68e+03 9.83e+04 6.98e+03
     a_4 6.70e+06 -7.66e+06 -3.64e+05 6.68e+03 3.83e+05 3.87e+06 2.36e+05
     b_1_1 1.13e+08 -1.69e+08 -2.55e+06 9.83e+04 3.87e+06 1.54e+08 1.38e+06
     b_1_2 4.31e+06 -4.62e+06 -3.15e+05 6.98e+03 2.36e+05 1.38e+06 2.19e+05
     b_1_3 -5.15e+04 8.65e+04 5.88e+03 -2.18e+02 -3.90e+03 -1.23e+05 -3.00e+03
     b_1_4 -4.18e+06 5.22e+06 1.98e+05 -4.24e+03 -2.25e+05 -2.28e+06 -1.55e+05
     b_2_2 -3.05e+04 5.44e+04 -4.26e+03 1.12e+02 1.34e+03 -2.62e+04 1.32e+03
     b_2_3 2.27e+03 -2.43e+03 1.66e+01 -2.32e+00 4.27e+01 2.20e+03 -2.74e+01
     b_2_4 -4.87e+04 4.09e+04 6.71e+03 -1.44e+02 -4.86e+03 -2.31e+04 -3.26e+03
     b_3_3 -1.41e+02 1.45e+02 3.27e+00 3.76e-03 -3.92e+00 4.58e+01 -3.77e+00
     b_3_4 3.10e+02 -8.51e+02 -9.78e+01 4.01e+00 5.87e+01 -3.90e+02 8.93e+01
     b_4_4 8.31e+04 -8.74e+04 -5.40e+03 9.41e+01 5.21e+03 5.26e+04 2.81e+03
     b_1_3 b_1_4 b_2_2 b_2_3 b_2_4 b_3_3 b_3_4
     a_0 -5.15e+04 -4.18e+06 -3.05e+04 2.27e+03 -4.87e+04 -1.41e+02 310.0540
     a_1 8.65e+04 5.22e+06 5.44e+04 -2.43e+03 4.09e+04 1.45e+02 -851.3935
     a_2 5.88e+03 1.98e+05 -4.26e+03 1.66e+01 6.71e+03 3.27e+00 -97.8391
     a_3 -2.18e+02 -4.24e+03 1.12e+02 -2.32e+00 -1.44e+02 3.76e-03 4.0064
     a_4 -3.90e+03 -2.25e+05 1.34e+03 4.27e+01 -4.86e+03 -3.92e+00 58.7104
     b_1_1 -1.23e+05 -2.28e+06 -2.62e+04 2.20e+03 -2.31e+04 4.58e+01 -390.2702
     b_1_2 -3.00e+03 -1.55e+05 1.32e+03 -2.74e+01 -3.26e+03 -3.77e+00 89.3295
     b_1_3 2.47e+02 1.53e+03 -8.48e+01 -8.32e-02 1.01e+02 -2.22e-01 -0.6176
     b_1_4 1.53e+03 1.63e+05 9.87e+02 -1.76e+01 1.55e+03 4.53e+00 -60.5660
     b_2_2 -8.48e+01 9.87e+02 2.33e+02 -3.65e+00 -1.69e+02 1.56e-01 1.4021
     b_2_3 -8.32e-02 -1.76e+01 -3.65e+00 1.66e-01 1.60e+00 -2.07e-03 -0.0899
     b_2_4 1.01e+02 1.55e+03 -1.69e+02 1.60e+00 1.67e+02 -5.80e-02 -1.3807
     b_3_3 -2.22e-01 4.53e+00 1.56e-01 -2.07e-03 -5.80e-02 6.19e-04 -0.0022
     b_3_4 -6.18e-01 -6.06e+01 1.40e+00 -8.99e-02 -1.38e+00 -2.20e-03 0.0971
     b_4_4 -7.19e+01 -2.31e+03 8.05e+01 1.74e-01 -1.10e+02 8.29e-03 0.4406
     b_4_4
     a_0 8.31e+04
     a_1 -8.74e+04
     a_2 -5.40e+03
     a_3 9.41e+01
     a_4 5.21e+03
     b_1_1 5.26e+04
     b_1_2 2.81e+03
     b_1_3 -7.19e+01
     b_1_4 -2.31e+03
     b_2_2 8.05e+01
     b_2_3 1.74e-01
     b_2_4 -1.10e+02
     b_3_3 8.29e-03
     b_3_4 4.41e-01
     b_4_4 1.01e+02
    
     $r2
     [1] 0.997
    
     $r2bar
     [1] 0.99
    
     $nObs
     [1] 20
    
     $yName
     [1] "qOutput"
    
     $xNames
     [1] "qLabor" "land" "qVarInput" "time"
    
     $regScale
     [1] 1
    
     $model.matrix
     (Intercept) a_1 a_2 a_3 a_4 b_1_1 b_1_2 b_1_3 b_1_4 b_2_2 b_2_3 b_2_4
     1 1 1.44 23.4 557 1 1.04 33.7 801 1.44 274 13023 23.4
     2 1 1.45 24.2 607 2 1.05 35.1 880 2.90 293 14681 48.4
     3 1 1.44 24.7 608 3 1.04 35.6 875 4.32 305 15009 74.1
     4 1 1.48 24.9 654 4 1.10 36.9 968 5.92 310 16290 99.6
     5 1 1.48 24.9 648 5 1.10 36.9 958 7.40 310 16132 124.5
     6 1 1.47 25.2 657 6 1.08 37.1 966 8.82 318 16576 151.4
     7 1 1.45 25.9 673 7 1.05 37.6 977 10.15 336 17449 181.4
     8 1 1.49 26.0 648 8 1.11 38.7 965 11.92 337 16826 207.8
     9 1 1.48 25.2 640 9 1.10 37.3 947 13.32 317 16115 226.6
     10 1 1.53 26.1 648 10 1.17 39.9 992 15.30 340 16906 260.7
     11 1 1.53 26.8 682 11 1.17 41.0 1044 16.83 358 18267 294.5
     12 1 1.69 29.9 761 12 1.43 50.5 1286 20.28 446 22730 358.4
     13 1 1.70 31.1 801 13 1.44 52.9 1362 22.10 484 24927 404.4
     14 1 1.67 32.2 798 14 1.39 53.8 1332 23.38 518 25681 450.7
     15 1 1.65 31.5 737 15 1.36 52.0 1216 24.75 497 23230 472.8
     16 1 1.61 31.9 719 16 1.30 51.3 1157 25.76 508 22914 510.1
     17 1 1.62 33.5 701 17 1.31 54.3 1135 27.54 562 23501 570.2
     18 1 1.62 35.1 702 18 1.31 56.8 1137 29.16 615 24605 631.1
     19 1 1.62 37.3 731 19 1.31 60.4 1185 30.78 696 27283 708.9
     20 1 1.62 39.4 770 20 1.31 63.8 1248 32.40 776 30337 787.8
     b_3_3 b_3_4 b_4_4
     1 154872 557 0.5
     2 184006 1213 2.0
     3 184781 1824 4.5
     4 213832 2616 8.0
     5 209710 3238 12.5
     6 215817 3942 18.0
     7 226774 4714 24.5
     8 209890 5183 32.0
     9 204785 5760 40.5
     10 210262 6485 50.0
     11 232820 7506 60.5
     12 289533 9132 72.0
     13 321010 10416 84.5
     14 318247 11169 98.0
     15 271572 11055 112.5
     16 258318 11500 128.0
     17 245488 11912 144.5
     18 246256 12632 162.0
     19 267367 13894 180.5
     20 296583 15403 200.0
     attr(,"assign")
     [1] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
    
     attr(,"class")
     [1] "quadFuncEst"
     >
     > ## compute fitted values
     > fitted <- quadFuncCalc( c( "qLabor", "land", "qVarInput", "time" ),
     + germanFarms, coef( estResult ) )
     > all.equal( fitted, estResult$fitted )
     [1] TRUE
     > all.equal( fitted, predict( estResult ) )
     [1] TRUE
     > all.equal( fitted, predict( estResult, newdata = germanFarms ) )
     [1] TRUE
     >
     > # only at mean values
     > fittedMean <- quadFuncCalc(
     + xNames = c( "qLabor", "land", "qVarInput", "time" ),
     + data = germanFarmsMeans, coef = coef( estResult ) )
     > print( fittedMean )
     1
     1556
     > all.equal( fittedMean,
     + predict( estResult, newdata = germanFarmsMeans ) )
     [1] TRUE
     >
     > ## compute the marginal products of the inputs
     > margProducts <- quadFuncDeriv(
     + c( "qLabor", "land", "qVarInput", "time" ),
     + germanFarms, coef( estResult ), vcov( estResult ) )
     > print( margProducts )
     qLabor land qVarInput time
     1 2547 70.4 -0.877 31.42
     2 2219 55.8 -1.113 46.48
     3 2302 55.7 -0.744 38.12
     4 1509 52.7 -0.894 43.80
     5 1398 60.2 -0.338 27.60
     6 1397 58.0 0.030 22.46
     7 1561 49.0 0.262 24.22
     8 1108 73.1 0.737 -7.18
     9 927 82.5 1.648 -26.83
     10 383 92.5 1.496 -38.13
     11 230 81.9 1.477 -30.33
     12 -1403 82.6 -0.622 -10.60
     13 -1571 69.5 -0.942 1.79
     14 -1089 63.4 -0.647 -3.02
     15 -847 89.2 0.692 -47.38
     16 -349 89.6 1.421 -61.94
     17 -106 95.9 1.408 -76.92
     18 116 93.4 1.347 -81.48
     19 366 77.0 0.795 -67.89
     20 525 57.9 0.230 -50.40
     > print( attributes( margProducts )$variance )
     qLabor land qVarInput time
     1 3.03e+08 544271 364 401579
     2 2.97e+08 542045 363 399238
     3 2.92e+08 533248 358 393740
     4 2.89e+08 538663 363 395792
     5 2.84e+08 531000 359 390564
     6 2.78e+08 521654 354 383957
     7 2.71e+08 511097 348 376823
     8 2.75e+08 517159 351 382143
     9 2.66e+08 504238 344 371779
     10 2.72e+08 516764 353 381507
     11 2.67e+08 512576 350 377697
     12 2.97e+08 573963 391 422271
     13 2.96e+08 575409 393 423171
     14 2.90e+08 561121 383 415690
     15 2.84e+08 543736 371 405186
     16 2.76e+08 524678 359 393181
     17 2.83e+08 528807 362 400594
     18 2.86e+08 528980 362 403758
     19 2.90e+08 532351 364 409489
     20 2.93e+08 534965 365 414060
     > print( attributes( margProducts )$stdDev )
     qLabor land qVarInput time
     1 17415 738 19.1 634
     2 17244 736 19.1 632
     3 17085 730 18.9 627
     4 17014 734 19.1 629
     5 16859 729 18.9 625
     6 16667 722 18.8 620
     7 16470 715 18.6 614
     8 16579 719 18.7 618
     9 16305 710 18.6 610
     10 16498 719 18.8 618
     11 16354 716 18.7 615
     12 17227 758 19.8 650
     13 17190 759 19.8 651
     14 17040 749 19.6 645
     15 16851 737 19.3 637
     16 16610 724 18.9 627
     17 16815 727 19.0 633
     18 16901 727 19.0 635
     19 17023 730 19.1 640
     20 17109 731 19.1 643
     > # only at mean values
     > margProductsMean <- quadFuncDeriv(
     + xNames = c( "qLabor", "land", "qVarInput", "time" ),
     + data = germanFarmsMeans, coef = coef( estResult ),
     + coefCov = vcov( estResult ) )
     > print( margProductsMean )
     qLabor land qVarInput time
     1 561 72.5 0.268 -13.3
     > print( attributes( margProductsMean )$variance )
     qLabor land qVarInput time
     1 2.83e+08 532305 361 395950
     > print( attributes( margProductsMean )$stdDev )
     qLabor land qVarInput time
     1 16814 730 19 629
     >
     > ## estimate a quadratic production function with a shifter
     > estResultShifter <- quadFuncEst( yName = "qOutput",
     + xNames = c( "qLabor", "land", "qVarInput" ),
     + shifterNames = "time", data = germanFarms )
     > coef( estResultShifter )
     a_0 a_1 a_2 a_3 b_1_1 b_1_2 b_1_3 b_2_2
     -1.15e+04 1.03e+04 1.41e+02 5.35e+00 -2.03e+03 -7.46e+01 -7.16e+00 -3.06e-01
     b_2_3 b_3_3 d_1
     3.27e-02 8.63e-03 9.66e+00
     > print( estResultShifter )
     $call
     quadFuncEst(yName = "qOutput", xNames = c("qLabor", "land", "qVarInput"),
     data = germanFarms, shifterNames = "time")
    
     $nExog
     [1] 3
    
     $nShifter
     [1] 1
    
     $est
    
     Call:
     lm(formula = as.formula(estFormula), data = estData)
    
     Coefficients:
     (Intercept) a_1 a_2 a_3 b_1_1 b_1_2
     -1.15e+04 1.03e+04 1.41e+02 5.35e+00 -2.03e+03 -7.46e+01
     b_1_3 b_2_2 b_2_3 b_3_3 d_1
     -7.16e+00 -3.06e-01 3.27e-02 8.63e-03 9.66e+00
    
    
     $residuals
     1 2 3 4 5 6 7 8 9 10 11
     17.93 -65.87 19.35 10.28 14.47 -5.97 -4.82 41.68 2.13 -18.24 -8.45
     12 13 14 15 16 17 18 19 20
     14.30 -28.06 16.30 27.35 -18.70 -32.87 7.02 22.26 -10.10
    
     $fitted
     1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
     928 1029 1050 1162 1164 1192 1244 1247 1206 1297 1369 1526 1603 1680 1617 1645
     17 18 19 20
     1688 1749 1865 2002
    
     $coef
     a_0 a_1 a_2 a_3 b_1_1 b_1_2 b_1_3 b_2_2
     -1.15e+04 1.03e+04 1.41e+02 5.35e+00 -2.03e+03 -7.46e+01 -7.16e+00 -3.06e-01
     b_2_3 b_3_3 d_1
     3.27e-02 8.63e-03 9.66e+00
    
     $coefCov
     a_0 a_1 a_2 a_3 b_1_1 b_1_2 b_1_3
     a_0 8.58e+07 -9.12e+07 -1.90e+06 3.56e+04 4.25e+07 9.52e+05 -1.89e+03
     a_1 -9.12e+07 1.31e+08 9.73e+05 -7.13e+04 -1.04e+08 -2.64e+05 5.58e+04
     a_2 -1.90e+06 9.73e+05 1.57e+05 -2.98e+03 2.53e+05 -9.17e+04 1.60e+03
     a_3 3.56e+04 -7.13e+04 -2.98e+03 1.73e+02 1.01e+05 1.52e+03 -1.80e+02
     b_1_1 4.25e+07 -1.04e+08 2.53e+05 1.01e+05 1.36e+08 -4.72e+05 -1.34e+05
     b_1_2 9.52e+05 -2.64e+05 -9.17e+04 1.52e+03 -4.72e+05 5.71e+04 -8.00e+02
     b_1_3 -1.89e+03 5.58e+04 1.60e+03 -1.80e+02 -1.34e+05 -8.00e+02 2.49e+02
     b_2_2 -1.76e+03 2.62e+03 1.37e+02 -6.47e+00 -7.26e+02 -6.47e+01 8.92e-01
     b_2_3 5.18e+02 -8.23e+02 -1.61e+01 9.90e-01 7.12e+02 1.29e+00 -4.41e-01
     b_3_3 -6.97e+01 1.40e+01 1.32e+00 1.13e-01 1.24e+02 -4.00e-01 -2.82e-01
     d_1 7.51e+04 -5.93e+04 -2.33e+03 1.30e+01 1.03e+04 1.26e+03 1.15e+01
     b_2_2 b_2_3 b_3_3 d_1
     a_0 -1.76e+03 5.18e+02 -6.97e+01 7.51e+04
     a_1 2.62e+03 -8.23e+02 1.40e+01 -5.93e+04
     a_2 1.37e+02 -1.61e+01 1.32e+00 -2.33e+03
     a_3 -6.47e+00 9.90e-01 1.13e-01 1.30e+01
     b_1_1 -7.26e+02 7.12e+02 1.24e+02 1.03e+04
     b_1_2 -6.47e+01 1.29e+00 -4.00e-01 1.26e+03
     b_1_3 8.92e-01 -4.41e-01 -2.82e-01 1.15e+01
     b_2_2 1.15e+01 -5.69e-01 3.13e-02 5.30e+00
     b_2_3 -5.69e-01 4.46e-02 -2.33e-03 6.41e-02
     b_3_3 3.13e-02 -2.33e-03 5.72e-04 -4.71e-02
     d_1 5.30e+00 6.41e-02 -4.71e-02 1.10e+02
    
     $r2
     [1] 0.993
    
     $r2bar
     [1] 0.986
    
     $nObs
     [1] 20
    
     $yName
     [1] "qOutput"
    
     $xNames
     [1] "qLabor" "land" "qVarInput"
    
     $shifterNames
     [1] "time"
    
     $regScale
     [1] 1
    
     $model.matrix
     (Intercept) a_1 a_2 a_3 b_1_1 b_1_2 b_1_3 b_2_2 b_2_3 b_3_3 d_1
     1 1 1.44 23.4 557 1.04 33.7 801 274 13023 154872 1
     2 1 1.45 24.2 607 1.05 35.1 880 293 14681 184006 2
     3 1 1.44 24.7 608 1.04 35.6 875 305 15009 184781 3
     4 1 1.48 24.9 654 1.10 36.9 968 310 16290 213832 4
     5 1 1.48 24.9 648 1.10 36.9 958 310 16132 209710 5
     6 1 1.47 25.2 657 1.08 37.1 966 318 16576 215817 6
     7 1 1.45 25.9 673 1.05 37.6 977 336 17449 226774 7
     8 1 1.49 26.0 648 1.11 38.7 965 337 16826 209890 8
     9 1 1.48 25.2 640 1.10 37.3 947 317 16115 204785 9
     10 1 1.53 26.1 648 1.17 39.9 992 340 16906 210262 10
     11 1 1.53 26.8 682 1.17 41.0 1044 358 18267 232820 11
     12 1 1.69 29.9 761 1.43 50.5 1286 446 22730 289533 12
     13 1 1.70 31.1 801 1.44 52.9 1362 484 24927 321010 13
     14 1 1.67 32.2 798 1.39 53.8 1332 518 25681 318247 14
     15 1 1.65 31.5 737 1.36 52.0 1216 497 23230 271572 15
     16 1 1.61 31.9 719 1.30 51.3 1157 508 22914 258318 16
     17 1 1.62 33.5 701 1.31 54.3 1135 562 23501 245488 17
     18 1 1.62 35.1 702 1.31 56.8 1137 615 24605 246256 18
     19 1 1.62 37.3 731 1.31 60.4 1185 696 27283 267367 19
     20 1 1.62 39.4 770 1.31 63.8 1248 776 30337 296583 20
     attr(,"assign")
     [1] 0 1 2 3 4 5 6 7 8 9 10
    
     attr(,"class")
     [1] "quadFuncEst"
     > # compute fitted values
     > fitted <- quadFuncCalc( c( "qLabor", "land", "qVarInput" ),
     + shifterNames = "time", data = germanFarms, coef( estResultShifter ) )
     > all.equal( fitted, estResultShifter$fitted )
     [1] TRUE
     > all.equal( fitted, predict( estResultShifter ) )
     [1] TRUE
     > all.equal( fitted, predict( estResultShifter, newdata = germanFarms ) )
     [1] TRUE
     > # compute marginal products = partial derivatives
     > margProdShifter <- quadFuncDeriv(
     + c( "qLabor", "land", "qVarInput" ),
     + germanFarms, coef( estResultShifter ), vcov( estResultShifter ) )
     > print( margProdShifter )
     qLabor land qVarInput
     1 1636 44.9 0.613
     2 1197 45.6 1.000
     3 1172 46.2 1.098
     4 745 44.6 1.217
     5 790 44.4 1.162
     6 719 45.4 1.325
     7 591 47.2 1.633
     8 689 43.4 1.128
     9 825 44.1 1.105
     10 596 40.4 0.849
     11 301 41.3 1.165
     12 -818 31.0 0.800
     13 -1220 31.2 1.117
     14 -1214 33.0 1.337
     15 -688 32.7 0.933
     16 -504 34.9 1.074
     17 -518 33.1 0.901
     18 -639 32.7 0.960
     19 -1018 32.9 1.288
     20 -1452 33.6 1.692
     > print( attributes( margProdShifter )$variance )
     qLabor land qVarInput
     1 1.28e+08 140313 175
     2 1.25e+08 141525 169
     3 1.24e+08 140739 167
     4 1.25e+08 144357 168
     5 1.26e+08 144246 169
     6 1.24e+08 143588 166
     7 1.22e+08 142268 161
     8 1.27e+08 144793 169
     9 1.26e+08 144061 169
     10 1.31e+08 147940 176
     11 1.29e+08 148376 172
     12 1.43e+08 163662 190
     13 1.42e+08 165266 187
     14 1.40e+08 161944 180
     15 1.41e+08 158933 183
     16 1.38e+08 154877 177
     17 1.42e+08 155312 180
     18 1.43e+08 155201 179
     19 1.43e+08 155398 173
     20 1.44e+08 155753 167
     > print( attributes( margProdShifter )$stdDev )
     qLabor land qVarInput
     1 11306 375 13.2
     2 11181 376 13.0
     3 11135 375 12.9
     4 11189 380 13.0
     5 11205 380 13.0
     6 11140 379 12.9
     7 11032 377 12.7
     8 11259 381 13.0
     9 11228 380 13.0
     10 11448 385 13.3
     11 11357 385 13.1
     12 11960 405 13.8
     13 11929 407 13.7
     14 11820 402 13.4
     15 11861 399 13.5
     16 11732 394 13.3
     17 11896 394 13.4
     18 11955 394 13.4
     19 11968 394 13.2
     20 11980 395 12.9
     >
     > ## estimate a quadratic production function with 2 shifters
     > germanFarms$timeSq <- germanFarms$time^2
     > estResultShifter2 <- quadFuncEst( yName = "qOutput",
     + xNames = c( "qLabor", "land", "qVarInput" ),
     + shifterNames = c( "time", "timeSq" ), data = germanFarms )
     > coef( estResultShifter2 )
     a_0 a_1 a_2 a_3 b_1_1 b_1_2 b_1_3 b_2_2
     -1.33e+04 1.42e+04 -1.28e+01 6.89e+00 -4.78e+03 3.04e+01 -1.05e+01 -1.97e+00
     b_2_3 b_3_3 d_1 d_2
     1.45e-01 7.72e-03 3.97e+01 -2.58e+00
     > print( estResultShifter2 )
     $call
     quadFuncEst(yName = "qOutput", xNames = c("qLabor", "land", "qVarInput"),
     data = germanFarms, shifterNames = c("time", "timeSq"))
    
     $nExog
     [1] 3
    
     $nShifter
     [1] 2
    
     $est
    
     Call:
     lm(formula = as.formula(estFormula), data = estData)
    
     Coefficients:
     (Intercept) a_1 a_2 a_3 b_1_1 b_1_2
     -1.33e+04 1.42e+04 -1.28e+01 6.89e+00 -4.78e+03 3.04e+01
     b_1_3 b_2_2 b_2_3 b_3_3 d_1 d_2
     -1.05e+01 -1.97e+00 1.45e-01 7.72e-03 3.97e+01 -2.58e+00
    
    
     $residuals
     1 2 3 4 5 6 7 8 9 10 11
     23.04 -50.56 11.51 19.01 8.98 -9.62 -1.67 9.91 3.60 -32.99 15.03
     12 13 14 15 16 17 18 19 20
     9.97 -15.83 -2.24 25.01 7.80 -37.88 6.40 19.28 -8.76
    
     $fitted
     1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
     923 1013 1058 1153 1169 1195 1241 1279 1204 1311 1346 1531 1591 1698 1620 1618
     17 18 19 20
     1693 1749 1868 2001
    
     $coef
     a_0 a_1 a_2 a_3 b_1_1 b_1_2 b_1_3 b_2_2
     -1.33e+04 1.42e+04 -1.28e+01 6.89e+00 -4.78e+03 3.04e+01 -1.05e+01 -1.97e+00
     b_2_3 b_3_3 d_1 d_2
     1.45e-01 7.72e-03 3.97e+01 -2.58e+00
    
     $coefCov
     a_0 a_1 a_2 a_3 b_1_1 b_1_2 b_1_3
     a_0 6.85e+07 -7.39e+07 -1.41e+06 2.72e+04 3.49e+07 6.95e+05 2.24e+02
     a_1 -7.39e+07 1.08e+08 5.92e+05 -5.44e+04 -8.54e+07 -8.91e+04 4.02e+04
     a_2 -1.41e+06 5.92e+05 1.30e+05 -2.42e+03 3.23e+05 -7.70e+04 1.41e+03
     a_3 2.72e+04 -5.44e+04 -2.42e+03 1.37e+02 7.83e+04 1.24e+03 -1.43e+02
     b_1_1 3.49e+07 -8.54e+07 3.23e+05 7.83e+04 1.09e+08 -4.56e+05 -1.03e+05
     b_1_2 6.95e+05 -8.91e+04 -7.70e+04 1.24e+03 -4.56e+05 4.82e+04 -7.32e+02
     b_1_3 2.24e+02 4.02e+04 1.41e+03 -1.43e+02 -1.03e+05 -7.32e+02 1.99e+02
     b_2_2 -5.24e+02 1.76e+02 1.83e+02 -5.84e+00 7.65e+02 -1.02e+02 2.31e+00
     b_2_3 3.50e+02 -5.22e+02 -1.77e+01 8.30e-01 4.71e+02 4.45e+00 -4.55e-01
     b_3_3 -5.44e+01 9.99e+00 1.08e+00 8.87e-02 9.86e+01 -3.43e-01 -2.21e-01
     d_1 4.36e+04 -1.27e+04 -3.18e+03 2.38e+01 -1.59e+04 1.91e+03 -1.99e+01
     d_2 1.33e+03 -2.92e+03 1.16e+02 -1.16e+00 2.06e+03 -7.90e+01 2.49e+00
     b_2_2 b_2_3 b_3_3 d_1 d_2
     a_0 -524.2018 3.50e+02 -5.44e+01 4.36e+04 1.33e+03
     a_1 175.9629 -5.22e+02 9.99e+00 -1.27e+04 -2.92e+03
     a_2 183.2068 -1.77e+01 1.08e+00 -3.18e+03 1.16e+02
     a_3 -5.8447 8.30e-01 8.87e-02 2.38e+01 -1.16e+00
     b_1_1 764.5635 4.71e+02 9.86e+01 -1.59e+04 2.06e+03
     b_1_2 -102.0921 4.45e+00 -3.43e-01 1.91e+03 -7.90e+01
     b_1_3 2.3134 -4.55e-01 -2.21e-01 -1.99e+01 2.49e+00
     b_2_2 9.8807 -5.03e-01 2.51e-02 -1.04e+01 1.25e+00
     b_2_3 -0.5029 3.88e-02 -1.87e-03 1.03e+00 -8.41e-02
     b_3_3 0.0251 -1.87e-03 4.51e-04 -4.52e-02 6.91e-04
     d_1 -10.4405 1.03e+00 -4.52e-02 3.50e+02 -2.26e+01
     d_2 1.2548 -8.41e-02 6.91e-04 -2.26e+01 1.94e+00
    
     $r2
     [1] 0.995
    
     $r2bar
     [1] 0.989
    
     $nObs
     [1] 20
    
     $yName
     [1] "qOutput"
    
     $xNames
     [1] "qLabor" "land" "qVarInput"
    
     $shifterNames
     [1] "time" "timeSq"
    
     $regScale
     [1] 1
    
     $model.matrix
     (Intercept) a_1 a_2 a_3 b_1_1 b_1_2 b_1_3 b_2_2 b_2_3 b_3_3 d_1 d_2
     1 1 1.44 23.4 557 1.04 33.7 801 274 13023 154872 1 1
     2 1 1.45 24.2 607 1.05 35.1 880 293 14681 184006 2 4
     3 1 1.44 24.7 608 1.04 35.6 875 305 15009 184781 3 9
     4 1 1.48 24.9 654 1.10 36.9 968 310 16290 213832 4 16
     5 1 1.48 24.9 648 1.10 36.9 958 310 16132 209710 5 25
     6 1 1.47 25.2 657 1.08 37.1 966 318 16576 215817 6 36
     7 1 1.45 25.9 673 1.05 37.6 977 336 17449 226774 7 49
     8 1 1.49 26.0 648 1.11 38.7 965 337 16826 209890 8 64
     9 1 1.48 25.2 640 1.10 37.3 947 317 16115 204785 9 81
     10 1 1.53 26.1 648 1.17 39.9 992 340 16906 210262 10 100
     11 1 1.53 26.8 682 1.17 41.0 1044 358 18267 232820 11 121
     12 1 1.69 29.9 761 1.43 50.5 1286 446 22730 289533 12 144
     13 1 1.70 31.1 801 1.44 52.9 1362 484 24927 321010 13 169
     14 1 1.67 32.2 798 1.39 53.8 1332 518 25681 318247 14 196
     15 1 1.65 31.5 737 1.36 52.0 1216 497 23230 271572 15 225
     16 1 1.61 31.9 719 1.30 51.3 1157 508 22914 258318 16 256
     17 1 1.62 33.5 701 1.31 54.3 1135 562 23501 245488 17 289
     18 1 1.62 35.1 702 1.31 56.8 1137 615 24605 246256 18 324
     19 1 1.62 37.3 731 1.31 60.4 1185 696 27283 267367 19 361
     20 1 1.62 39.4 770 1.31 63.8 1248 776 30337 296583 20 400
     attr(,"assign")
     [1] 0 1 2 3 4 5 6 7 8 9 10 11
    
     attr(,"class")
     [1] "quadFuncEst"
     > # compute fitted values
     > fitted <- quadFuncCalc( c( "qLabor", "land", "qVarInput" ),
     + shifterNames = c( "time", "timeSq" ), data = germanFarms,
     + coef( estResultShifter2 ) )
     > all.equal( fitted, estResultShifter2$fitted )
     [1] TRUE
     > all.equal( fitted, predict( estResultShifter2 ) )
     [1] TRUE
     > all.equal( fitted, predict( estResultShifter2, newdata = germanFarms ) )
     [1] TRUE
     >
     > ## estimate a linear functions with quadFuncEst
     > estResultLinear <- quadFuncEst( yName = "qOutput", xNames = NULL,
     + shifterNames = c( "time", "qLabor", "land", "qVarInput" ),
     + data = germanFarms )
     > coef( estResultLinear )
     a_0 d_1 d_2 d_3 d_4
     -97.67 21.03 -185.95 29.34 1.06
     > print( estResultLinear )
     $call
     quadFuncEst(yName = "qOutput", xNames = NULL, data = germanFarms,
     shifterNames = c("time", "qLabor", "land", "qVarInput"))
    
     $nExog
     [1] 0
    
     $nShifter
     [1] 4
    
     $est
    
     Call:
     lm(formula = as.formula(estFormula), data = estData)
    
     Coefficients:
     (Intercept) d_1 d_2 d_3 d_4
     -97.67 21.03 -185.95 29.34 1.06
    
    
     $residuals
     1 2 3 4 5 6 7 8 9 10 11
     13.50 -65.69 2.54 35.86 27.87 -6.64 -15.27 45.70 -26.45 -2.61 2.04
     12 13 14 15 16 17 18 19 20
     16.62 -47.43 18.87 27.04 -11.33 -31.02 2.75 16.27 -2.61
    
     $fitted
     1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
     933 1028 1067 1136 1150 1192 1255 1243 1234 1281 1359 1524 1622 1677 1618 1637
     17 18 19 20
     1686 1753 1871 1994
    
     $coef
     a_0 d_1 d_2 d_3 d_4
     -97.67 21.03 -185.95 29.34 1.06
    
     $coefCov
     a_0 d_1 d_2 d_3 d_4
     a_0 52830.9 6.23e+02 -40094.9 -411.851 21.57957
     d_1 623.2 1.61e+01 -221.6 -15.403 -0.00291
     d_2 -40094.9 -2.22e+02 47108.1 25.245 -45.73182
     d_3 -411.9 -1.54e+01 25.2 21.110 -0.11185
     d_4 21.6 -2.91e-03 -45.7 -0.112 0.07665
    
     $r2
     [1] 0.992
    
     $r2bar
     [1] 0.99
    
     $nObs
     [1] 20
    
     $yName
     [1] "qOutput"
    
     $shifterNames
     [1] "time" "qLabor" "land" "qVarInput"
    
     $regScale
     [1] 1
    
     $model.matrix
     (Intercept) d_1 d_2 d_3 d_4
     1 1 1 1.44 23.4 557
     2 1 2 1.45 24.2 607
     3 1 3 1.44 24.7 608
     4 1 4 1.48 24.9 654
     5 1 5 1.48 24.9 648
     6 1 6 1.47 25.2 657
     7 1 7 1.45 25.9 673
     8 1 8 1.49 26.0 648
     9 1 9 1.48 25.2 640
     10 1 10 1.53 26.1 648
     11 1 11 1.53 26.8 682
     12 1 12 1.69 29.9 761
     13 1 13 1.70 31.1 801
     14 1 14 1.67 32.2 798
     15 1 15 1.65 31.5 737
     16 1 16 1.61 31.9 719
     17 1 17 1.62 33.5 701
     18 1 18 1.62 35.1 702
     19 1 19 1.62 37.3 731
     20 1 20 1.62 39.4 770
     attr(,"assign")
     [1] 0 1 2 3 4
    
     attr(,"class")
     [1] "quadFuncEst"
     > estResultLin <- quadFuncEst( yName = "qOutput",
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + data = germanFarms, linear = TRUE )
     > all.equal( coef( estResultLinear ), coef( estResultLin )[1:5],
     + check.attributes = FALSE )
     [1] TRUE
     > all.equal( vcov( estResultLinear ), vcov( estResultLin )[1:5,1:5],
     + check.attributes = FALSE )
     [1] TRUE
     > coef( estResultLin )
     a_0 a_1 a_2 a_3 a_4 b_1_1 b_1_2 b_1_3 b_1_4 b_2_2
     -97.67 21.03 -185.95 29.34 1.06 0.00 0.00 0.00 0.00 0.00
     b_2_3 b_2_4 b_3_3 b_3_4 b_4_4
     0.00 0.00 0.00 0.00 0.00
     > vcov( estResultLin )
     a_0 a_1 a_2 a_3 a_4 b_1_1 b_1_2 b_1_3 b_1_4
     a_0 52830.9 6.23e+02 -40094.9 -411.851 21.57957 0 0 0 0
     a_1 623.2 1.61e+01 -221.6 -15.403 -0.00291 0 0 0 0
     a_2 -40094.9 -2.22e+02 47108.1 25.245 -45.73182 0 0 0 0
     a_3 -411.9 -1.54e+01 25.2 21.110 -0.11185 0 0 0 0
     a_4 21.6 -2.91e-03 -45.7 -0.112 0.07665 0 0 0 0
     b_1_1 0.0 0.00e+00 0.0 0.000 0.00000 0 0 0 0
     b_1_2 0.0 0.00e+00 0.0 0.000 0.00000 0 0 0 0
     b_1_3 0.0 0.00e+00 0.0 0.000 0.00000 0 0 0 0
     b_1_4 0.0 0.00e+00 0.0 0.000 0.00000 0 0 0 0
     b_2_2 0.0 0.00e+00 0.0 0.000 0.00000 0 0 0 0
     b_2_3 0.0 0.00e+00 0.0 0.000 0.00000 0 0 0 0
     b_2_4 0.0 0.00e+00 0.0 0.000 0.00000 0 0 0 0
     b_3_3 0.0 0.00e+00 0.0 0.000 0.00000 0 0 0 0
     b_3_4 0.0 0.00e+00 0.0 0.000 0.00000 0 0 0 0
     b_4_4 0.0 0.00e+00 0.0 0.000 0.00000 0 0 0 0
     b_2_2 b_2_3 b_2_4 b_3_3 b_3_4 b_4_4
     a_0 0 0 0 0 0 0
     a_1 0 0 0 0 0 0
     a_2 0 0 0 0 0 0
     a_3 0 0 0 0 0 0
     a_4 0 0 0 0 0 0
     b_1_1 0 0 0 0 0 0
     b_1_2 0 0 0 0 0 0
     b_1_3 0 0 0 0 0 0
     b_1_4 0 0 0 0 0 0
     b_2_2 0 0 0 0 0 0
     b_2_3 0 0 0 0 0 0
     b_2_4 0 0 0 0 0 0
     b_3_3 0 0 0 0 0 0
     b_3_4 0 0 0 0 0 0
     b_4_4 0 0 0 0 0 0
     > print( estResultLin )
     $call
     quadFuncEst(yName = "qOutput", xNames = c("time", "qLabor", "land",
     "qVarInput"), data = germanFarms, linear = TRUE)
    
     $nExog
     [1] 4
    
     $nShifter
     [1] 0
    
     $est
    
     Call:
     lm(formula = as.formula(estFormula), data = estData)
    
     Coefficients:
     (Intercept) a_1 a_2 a_3 a_4
     -97.67 21.03 -185.95 29.34 1.06
    
    
     $residuals
     1 2 3 4 5 6 7 8 9 10 11
     13.50 -65.69 2.54 35.86 27.87 -6.64 -15.27 45.70 -26.45 -2.61 2.04
     12 13 14 15 16 17 18 19 20
     16.62 -47.43 18.87 27.04 -11.33 -31.02 2.75 16.27 -2.61
    
     $fitted
     1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
     933 1028 1067 1136 1150 1192 1255 1243 1234 1281 1359 1524 1622 1677 1618 1637
     17 18 19 20
     1686 1753 1871 1994
    
     $coef
     a_0 a_1 a_2 a_3 a_4 b_1_1 b_1_2 b_1_3 b_1_4 b_2_2
     -97.67 21.03 -185.95 29.34 1.06 0.00 0.00 0.00 0.00 0.00
     b_2_3 b_2_4 b_3_3 b_3_4 b_4_4
     0.00 0.00 0.00 0.00 0.00
    
     $coefCov
     a_0 a_1 a_2 a_3 a_4 b_1_1 b_1_2 b_1_3 b_1_4
     a_0 52830.9 6.23e+02 -40094.9 -411.851 21.57957 0 0 0 0
     a_1 623.2 1.61e+01 -221.6 -15.403 -0.00291 0 0 0 0
     a_2 -40094.9 -2.22e+02 47108.1 25.245 -45.73182 0 0 0 0
     a_3 -411.9 -1.54e+01 25.2 21.110 -0.11185 0 0 0 0
     a_4 21.6 -2.91e-03 -45.7 -0.112 0.07665 0 0 0 0
     b_1_1 0.0 0.00e+00 0.0 0.000 0.00000 0 0 0 0
     b_1_2 0.0 0.00e+00 0.0 0.000 0.00000 0 0 0 0
     b_1_3 0.0 0.00e+00 0.0 0.000 0.00000 0 0 0 0
     b_1_4 0.0 0.00e+00 0.0 0.000 0.00000 0 0 0 0
     b_2_2 0.0 0.00e+00 0.0 0.000 0.00000 0 0 0 0
     b_2_3 0.0 0.00e+00 0.0 0.000 0.00000 0 0 0 0
     b_2_4 0.0 0.00e+00 0.0 0.000 0.00000 0 0 0 0
     b_3_3 0.0 0.00e+00 0.0 0.000 0.00000 0 0 0 0
     b_3_4 0.0 0.00e+00 0.0 0.000 0.00000 0 0 0 0
     b_4_4 0.0 0.00e+00 0.0 0.000 0.00000 0 0 0 0
     b_2_2 b_2_3 b_2_4 b_3_3 b_3_4 b_4_4
     a_0 0 0 0 0 0 0
     a_1 0 0 0 0 0 0
     a_2 0 0 0 0 0 0
     a_3 0 0 0 0 0 0
     a_4 0 0 0 0 0 0
     b_1_1 0 0 0 0 0 0
     b_1_2 0 0 0 0 0 0
     b_1_3 0 0 0 0 0 0
     b_1_4 0 0 0 0 0 0
     b_2_2 0 0 0 0 0 0
     b_2_3 0 0 0 0 0 0
     b_2_4 0 0 0 0 0 0
     b_3_3 0 0 0 0 0 0
     b_3_4 0 0 0 0 0 0
     b_4_4 0 0 0 0 0 0
    
     $r2
     [1] 0.992
    
     $r2bar
     [1] 0.99
    
     $nObs
     [1] 20
    
     $yName
     [1] "qOutput"
    
     $xNames
     [1] "time" "qLabor" "land" "qVarInput"
    
     $regScale
     [1] 1
    
     $model.matrix
     (Intercept) a_1 a_2 a_3 a_4
     1 1 1 1.44 23.4 557
     2 1 2 1.45 24.2 607
     3 1 3 1.44 24.7 608
     4 1 4 1.48 24.9 654
     5 1 5 1.48 24.9 648
     6 1 6 1.47 25.2 657
     7 1 7 1.45 25.9 673
     8 1 8 1.49 26.0 648
     9 1 9 1.48 25.2 640
     10 1 10 1.53 26.1 648
     11 1 11 1.53 26.8 682
     12 1 12 1.69 29.9 761
     13 1 13 1.70 31.1 801
     14 1 14 1.67 32.2 798
     15 1 15 1.65 31.5 737
     16 1 16 1.61 31.9 719
     17 1 17 1.62 33.5 701
     18 1 18 1.62 35.1 702
     19 1 19 1.62 37.3 731
     20 1 20 1.62 39.4 770
     attr(,"assign")
     [1] 0 1 2 3 4
    
     attr(,"class")
     [1] "quadFuncEst"
     > # compute fitted values
     > fitted <- quadFuncCalc( xNames = NULL,
     + shifterNames = c( "time", "qLabor", "land", "qVarInput" ),
     + data = germanFarms, coef( estResultLinear ) )
     > all.equal( fitted, estResultLinear$fitted )
     [1] TRUE
     > all.equal( fitted, predict( estResultLinear ) )
     [1] TRUE
     > all.equal( fitted, predict( estResultLinear, newdata = germanFarms ) )
     [1] TRUE
     >
     > fitted <- quadFuncCalc( xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + data = germanFarms, coef( estResultLin ) )
     > all.equal( fitted, estResultLin$fitted )
     [1] TRUE
     > all.equal( fitted, predict( estResultLin ) )
     [1] TRUE
     > all.equal( fitted, predict( estResultLin, newdata = germanFarms ) )
     [1] TRUE
     > all.equal( estResultLinear$fitted, estResultLin$fitted )
     [1] TRUE
     > # compute partial derivatives
     > margProducts <- quadFuncDeriv(
     + c( "qLabor", "land", "qVarInput", "time" ),
     + data = germanFarms, coef = coef( estResultLin ),
     + coefCov = vcov( estResultLin ) )
     > sapply( margProducts, sd )
     qLabor land qVarInput time
     0 0 0 0
     > all.equal( margProducts[1,], coef( estResultLin )[2:5],
     + check.attributes = FALSE )
     [1] TRUE
     > all.equal( attributes( margProducts )$variance[1,], diag( vcov( estResultLin ) )[2:5],
     + check.attributes = FALSE )
     [1] TRUE
     >
     > ## estimate a quadratic production function with a logical variable as shifter
     > germanFarms$reUnif <- germanFarms$time >= 16
     > estResultShifterLogi <- quadFuncEst( yName = "qOutput",
     + xNames = c( "qLabor", "land", "qVarInput" ),
     + shifterNames = c( "reUnif" ), data = germanFarms )
     > coef( estResultShifterLogi )
     a_0 a_1 a_2 a_3 b_1_1 b_1_2 b_1_3 b_2_2
     -1.99e+04 1.69e+04 4.87e+02 8.21e-01 -4.35e+03 -2.33e+02 -5.45e+00 -1.18e+00
     b_2_3 b_3_3 d_1_TRUE
     -2.71e-02 1.31e-02 -9.48e+01
     > print( estResultShifterLogi )
     $call
     quadFuncEst(yName = "qOutput", xNames = c("qLabor", "land", "qVarInput"),
     data = germanFarms, shifterNames = c("reUnif"))
    
     $nExog
     [1] 3
    
     $nShifter
     [1] 1
    
     $est
    
     Call:
     lm(formula = as.formula(estFormula), data = estData)
    
     Coefficients:
     (Intercept) a_1 a_2 a_3 b_1_1 b_1_2
     -1.99e+04 1.69e+04 4.87e+02 8.21e-01 -4.35e+03 -2.33e+02
     b_1_3 b_2_2 b_2_3 b_3_3 d_1_TRUE
     -5.45e+00 -1.18e+00 -2.71e-02 1.31e-02 -9.48e+01
    
    
     $residuals
     1 2 3 4 5 6 7 8 9 10 11
     20.60 -64.61 6.52 10.39 20.72 2.26 -6.92 21.64 28.64 -27.53 -19.88
     12 13 14 15 16 17 18 19 20
     15.47 -17.18 5.18 4.68 13.37 -21.80 1.71 13.22 -6.50
    
     $fitted
     1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
     926 1027 1063 1161 1157 1184 1246 1267 1179 1306 1380 1525 1592 1691 1640 1613
     17 18 19 20
     1677 1754 1874 1998
    
     $coef
     a_0 a_1 a_2 a_3 b_1_1 b_1_2 b_1_3 b_2_2
     -1.99e+04 1.69e+04 4.87e+02 8.21e-01 -4.35e+03 -2.33e+02 -5.45e+00 -1.18e+00
     b_2_3 b_3_3 d_1_TRUE
     -2.71e-02 1.31e-02 -9.48e+01
    
     $coefCov
     a_0 a_1 a_2 a_3 b_1_1 b_1_2 b_1_3
     a_0 2.79e+07 -4.04e+07 -3.08e+05 2.26e+04 28500046 9.36e+04 -9.04e+03
     a_1 -4.04e+07 7.81e+07 -1.68e+05 -5.18e+04 -78103687 3.08e+05 4.97e+04
     a_2 -3.08e+05 -1.68e+05 8.98e+04 -2.25e+03 315003 -5.28e+04 1.55e+03
     a_3 2.26e+04 -5.18e+04 -2.25e+03 1.38e+02 79606 1.12e+03 -1.45e+02
     b_1_1 2.85e+07 -7.81e+07 3.15e+05 7.96e+04 106386622 -4.45e+05 -1.07e+05
     b_1_2 9.36e+04 3.08e+05 -5.28e+04 1.12e+03 -444670 3.40e+04 -7.68e+02
     b_1_3 -9.04e+03 4.97e+04 1.55e+03 -1.45e+02 -107096 -7.68e+02 1.96e+02
     b_2_2 -4.03e+03 4.15e+03 1.80e+02 -5.18e+00 -800 -9.32e+01 -4.73e-02
     b_2_3 3.99e+02 -6.40e+02 -1.37e+01 8.23e-01 575 1.16e+00 -3.93e-01
     b_3_3 -2.96e+01 -8.84e+00 2.67e-01 9.28e-02 101 1.06e-01 -2.17e-01
     d_1_TRUE 4.77e+04 -3.72e+04 -3.75e+03 9.03e+01 37570 1.26e+03 -7.27e+01
     b_2_2 b_2_3 b_3_3 d_1_TRUE
     a_0 -4.03e+03 3.99e+02 -2.96e+01 4.77e+04
     a_1 4.15e+03 -6.40e+02 -8.84e+00 -3.72e+04
     a_2 1.80e+02 -1.37e+01 2.67e-01 -3.75e+03
     a_3 -5.18e+00 8.23e-01 9.28e-02 9.03e+01
     b_1_1 -8.00e+02 5.75e+02 1.01e+02 3.76e+04
     b_1_2 -9.32e+01 1.16e+00 1.06e-01 1.26e+03
     b_1_3 -4.73e-02 -3.93e-01 -2.17e-01 -7.27e+01
     b_2_2 8.88e+00 -4.43e-01 2.63e-02 1.08e+01
     b_2_3 -4.43e-01 3.58e-02 -1.81e-03 1.45e+00
     b_3_3 2.63e-02 -1.81e-03 4.33e-04 -9.53e-03
     d_1_TRUE 1.08e+01 1.45e+00 -9.53e-03 2.53e+03
    
     $r2
     [1] 0.995
    
     $r2bar
     [1] 0.989
    
     $nObs
     [1] 20
    
     $yName
     [1] "qOutput"
    
     $xNames
     [1] "qLabor" "land" "qVarInput"
    
     $shifterNames
     [1] "reUnif"
    
     $regScale
     [1] 1
    
     $model.matrix
     (Intercept) a_1 a_2 a_3 b_1_1 b_1_2 b_1_3 b_2_2 b_2_3 b_3_3 d_1_TRUE
     1 1 1.44 23.4 557 1.04 33.7 801 274 13023 154872 0
     2 1 1.45 24.2 607 1.05 35.1 880 293 14681 184006 0
     3 1 1.44 24.7 608 1.04 35.6 875 305 15009 184781 0
     4 1 1.48 24.9 654 1.10 36.9 968 310 16290 213832 0
     5 1 1.48 24.9 648 1.10 36.9 958 310 16132 209710 0
     6 1 1.47 25.2 657 1.08 37.1 966 318 16576 215817 0
     7 1 1.45 25.9 673 1.05 37.6 977 336 17449 226774 0
     8 1 1.49 26.0 648 1.11 38.7 965 337 16826 209890 0
     9 1 1.48 25.2 640 1.10 37.3 947 317 16115 204785 0
     10 1 1.53 26.1 648 1.17 39.9 992 340 16906 210262 0
     11 1 1.53 26.8 682 1.17 41.0 1044 358 18267 232820 0
     12 1 1.69 29.9 761 1.43 50.5 1286 446 22730 289533 0
     13 1 1.70 31.1 801 1.44 52.9 1362 484 24927 321010 0
     14 1 1.67 32.2 798 1.39 53.8 1332 518 25681 318247 0
     15 1 1.65 31.5 737 1.36 52.0 1216 497 23230 271572 0
     16 1 1.61 31.9 719 1.30 51.3 1157 508 22914 258318 1
     17 1 1.62 33.5 701 1.31 54.3 1135 562 23501 245488 1
     18 1 1.62 35.1 702 1.31 56.8 1137 615 24605 246256 1
     19 1 1.62 37.3 731 1.31 60.4 1185 696 27283 267367 1
     20 1 1.62 39.4 770 1.31 63.8 1248 776 30337 296583 1
     attr(,"assign")
     [1] 0 1 2 3 4 5 6 7 8 9 10
     attr(,"contrasts")
     attr(,"contrasts")$d_1_
     [1] "contr.treatment"
    
    
     attr(,"class")
     [1] "quadFuncEst"
     > # compute fitted values
     > fitted <- quadFuncCalc( c( "qLabor", "land", "qVarInput" ),
     + shifterNames = c( "reUnif" ), data = germanFarms,
     + coef( estResultShifterLogi ) )
     > all.equal( fitted, estResultShifterLogi$fitted )
     [1] TRUE
     > all.equal( fitted, predict( estResultShifterLogi ) )
     [1] TRUE
     > all.equal( fitted, predict( estResultShifterLogi, newdata = germanFarms ) )
     [1] TRUE
     >
     > ## estimate a quadratic production function with a factor as shifter
     > germanFarms$decade <- as.factor( c( rep( "70s", 5 ), rep( "80s", 10 ),
     + rep( "90s", 5 ) ) )
     > estResultShifterFac <- quadFuncEst( yName = "qOutput",
     + xNames = c( "qLabor", "land", "qVarInput" ),
     + shifterNames = c( "decade" ), data = germanFarms )
     > coef( estResultShifterFac )
     a_0 a_1 a_2 a_3 b_1_1 b_1_2 b_1_3 b_2_2
     -1.93e+04 1.69e+04 4.38e+02 9.90e-01 -5.07e+03 -2.05e+02 -4.85e+00 -1.18e+00
     b_2_3 b_3_3 d_1_80s d_1_90s
     -2.07e-02 1.13e-02 7.61e+00 -8.29e+01
     > print( estResultShifterFac )
     $call
     quadFuncEst(yName = "qOutput", xNames = c("qLabor", "land", "qVarInput"),
     data = germanFarms, shifterNames = c("decade"))
    
     $nExog
     [1] 3
    
     $nShifter
     [1] 1
    
     $est
    
     Call:
     lm(formula = as.formula(estFormula), data = estData)
    
     Coefficients:
     (Intercept) a_1 a_2 a_3 b_1_1 b_1_2
     -1.93e+04 1.69e+04 4.38e+02 9.90e-01 -5.07e+03 -2.05e+02
     b_1_3 b_2_2 b_2_3 b_3_3 d_1_80s d_1_90s
     -4.85e+00 -1.18e+00 -2.07e-02 1.13e-02 7.61e+00 -8.29e+01
    
    
     $residuals
     1 2 3 4 5 6 7 8 9 10 11
     20.42 -64.92 8.65 12.73 23.11 -1.57 -6.41 21.06 24.80 -27.53 -18.46
     12 13 14 15 16 17 18 19 20
     15.59 -17.66 5.49 4.69 13.40 -21.93 2.04 12.90 -6.41
    
     $fitted
     1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
     926 1028 1061 1159 1155 1187 1246 1268 1183 1306 1379 1525 1593 1690 1640 1613
     17 18 19 20
     1677 1754 1875 1998
    
     $coef
     a_0 a_1 a_2 a_3 b_1_1 b_1_2 b_1_3 b_2_2
     -1.93e+04 1.69e+04 4.38e+02 9.90e-01 -5.07e+03 -2.05e+02 -4.85e+00 -1.18e+00
     b_2_3 b_3_3 d_1_80s d_1_90s
     -2.07e-02 1.13e-02 7.61e+00 -8.29e+01
    
     $coefCov
     a_0 a_1 a_2 a_3 b_1_1 b_1_2 b_1_3
     a_0 4.05e+07 -4.55e+07 -1.07e+06 2.78e+04 21264944 5.08e+05 -1.30e+03
     a_1 -4.55e+07 8.74e+07 -1.67e+05 -5.80e+04 -87097217 3.34e+05 5.54e+04
     a_2 -1.07e+06 -1.67e+05 1.57e+05 -2.72e+03 1180373 -9.06e+04 1.05e+03
     a_3 2.78e+04 -5.80e+04 -2.72e+03 1.55e+02 86227 1.36e+03 -1.60e+02
     b_1_1 2.13e+07 -8.71e+07 1.18e+06 8.62e+04 131222698 -9.60e+05 -1.30e+05
     b_1_2 5.08e+05 3.34e+05 -9.06e+04 1.36e+03 -960052 5.57e+04 -4.76e+02
     b_1_3 -1.30e+03 5.54e+04 1.05e+03 -1.60e+02 -129947 -4.76e+02 2.28e+02
     b_2_2 -4.57e+03 4.64e+03 2.07e+02 -5.82e+00 -815 -1.07e+02 -1.20e-01
     b_2_3 5.41e+02 -7.19e+02 -2.26e+01 9.46e-01 536 5.39e+00 -3.50e-01
     b_3_3 -6.04e+01 -9.12e+00 2.43e+00 9.65e-02 144 -1.07e+00 -2.69e-01
     d_1_80s 1.12e+05 -3.20e+03 -8.74e+03 3.02e+01 -128559 4.88e+03 1.07e+02
     d_1_90s 2.30e+05 -4.66e+04 -1.79e+04 1.48e+02 -159729 9.07e+03 8.61e+01
     b_2_2 b_2_3 b_3_3 d_1_80s d_1_90s
     a_0 -4.57e+03 5.41e+02 -6.04e+01 1.12e+05 2.30e+05
     a_1 4.64e+03 -7.19e+02 -9.12e+00 -3.20e+03 -4.66e+04
     a_2 2.07e+02 -2.26e+01 2.43e+00 -8.74e+03 -1.79e+04
     a_3 -5.82e+00 9.46e-01 9.65e-02 3.02e+01 1.48e+02
     b_1_1 -8.15e+02 5.36e+02 1.44e+02 -1.29e+05 -1.60e+05
     b_1_2 -1.07e+02 5.39e+00 -1.07e+00 4.88e+03 9.07e+03
     b_1_3 -1.20e-01 -3.50e-01 -2.69e-01 1.07e+02 8.61e+01
     b_2_2 9.93e+00 -4.96e-01 2.97e-02 -8.48e-01 1.07e+01
     b_2_3 -4.96e-01 4.10e-02 -2.31e-03 1.14e+00 3.41e+00
     b_3_3 2.97e-02 -2.31e-03 5.65e-04 -3.30e-01 -5.29e-01
     d_1_80s -8.48e-01 1.14e+00 -3.30e-01 1.36e+03 2.13e+03
     d_1_90s 1.07e+01 3.41e+00 -5.29e-01 2.13e+03 6.18e+03
    
     $r2
     [1] 0.995
    
     $r2bar
     [1] 0.988
    
     $nObs
     [1] 20
    
     $yName
     [1] "qOutput"
    
     $xNames
     [1] "qLabor" "land" "qVarInput"
    
     $shifterNames
     [1] "decade"
    
     $regScale
     [1] 1
    
     $model.matrix
     (Intercept) a_1 a_2 a_3 b_1_1 b_1_2 b_1_3 b_2_2 b_2_3 b_3_3 d_1_80s
     1 1 1.44 23.4 557 1.04 33.7 801 274 13023 154872 0
     2 1 1.45 24.2 607 1.05 35.1 880 293 14681 184006 0
     3 1 1.44 24.7 608 1.04 35.6 875 305 15009 184781 0
     4 1 1.48 24.9 654 1.10 36.9 968 310 16290 213832 0
     5 1 1.48 24.9 648 1.10 36.9 958 310 16132 209710 0
     6 1 1.47 25.2 657 1.08 37.1 966 318 16576 215817 1
     7 1 1.45 25.9 673 1.05 37.6 977 336 17449 226774 1
     8 1 1.49 26.0 648 1.11 38.7 965 337 16826 209890 1
     9 1 1.48 25.2 640 1.10 37.3 947 317 16115 204785 1
     10 1 1.53 26.1 648 1.17 39.9 992 340 16906 210262 1
     11 1 1.53 26.8 682 1.17 41.0 1044 358 18267 232820 1
     12 1 1.69 29.9 761 1.43 50.5 1286 446 22730 289533 1
     13 1 1.70 31.1 801 1.44 52.9 1362 484 24927 321010 1
     14 1 1.67 32.2 798 1.39 53.8 1332 518 25681 318247 1
     15 1 1.65 31.5 737 1.36 52.0 1216 497 23230 271572 1
     16 1 1.61 31.9 719 1.30 51.3 1157 508 22914 258318 0
     17 1 1.62 33.5 701 1.31 54.3 1135 562 23501 245488 0
     18 1 1.62 35.1 702 1.31 56.8 1137 615 24605 246256 0
     19 1 1.62 37.3 731 1.31 60.4 1185 696 27283 267367 0
     20 1 1.62 39.4 770 1.31 63.8 1248 776 30337 296583 0
     d_1_90s
     1 0
     2 0
     3 0
     4 0
     5 0
     6 0
     7 0
     8 0
     9 0
     10 0
     11 0
     12 0
     13 0
     14 0
     15 0
     16 1
     17 1
     18 1
     19 1
     20 1
     attr(,"assign")
     [1] 0 1 2 3 4 5 6 7 8 9 10 10
     attr(,"contrasts")
     attr(,"contrasts")$d_1_
     [1] "contr.treatment"
    
    
     attr(,"class")
     [1] "quadFuncEst"
     > # compute fitted values
     > fitted <- quadFuncCalc( c( "qLabor", "land", "qVarInput" ),
     + shifterNames = c( "decade" ), data = germanFarms,
     + coef( estResultShifterFac ) )
     > all.equal( fitted, estResultShifterFac$fitted )
     [1] TRUE
     > all.equal( fitted, predict( estResultShifterFac ) )
     [1] TRUE
     > all.equal( fitted, predict( estResultShifterFac, newdata = germanFarms ) )
     [1] TRUE
     >
     > ## estimate a quadratic production function with some shifters are logical
     > estResultShifterLogi2 <- quadFuncEst( yName = "qOutput",
     + xNames = c( "qLabor", "land", "qVarInput" ),
     + shifterNames = c( "time", "reUnif" ), data = germanFarms )
     > coef( estResultShifterLogi2 )
     a_0 a_1 a_2 a_3 b_1_1 b_1_2 b_1_3 b_2_2
     -1.61e+04 1.39e+04 3.62e+02 1.73e+00 -3.73e+03 -1.67e+02 -5.11e+00 -8.85e-01
     b_2_3 b_3_3 d_1 d_2_TRUE
     -1.95e-02 1.08e-02 5.35e+00 -8.70e+01
     > print( estResultShifterLogi2 )
     $call
     quadFuncEst(yName = "qOutput", xNames = c("qLabor", "land", "qVarInput"),
     data = germanFarms, shifterNames = c("time", "reUnif"))
    
     $nExog
     [1] 3
    
     $nShifter
     [1] 2
    
     $est
    
     Call:
     lm(formula = as.formula(estFormula), data = estData)
    
     Coefficients:
     (Intercept) a_1 a_2 a_3 b_1_1 b_1_2
     -1.61e+04 1.39e+04 3.62e+02 1.73e+00 -3.73e+03 -1.67e+02
     b_1_3 b_2_2 b_2_3 b_3_3 d_1 d_2_TRUE
     -5.11e+00 -8.85e-01 -1.95e-02 1.08e-02 5.35e+00 -8.70e+01
    
    
     $residuals
     1 2 3 4 5 6 7 8 9 10
     20.280 -62.629 9.130 16.474 22.003 0.344 -7.456 25.574 13.685 -26.917
     11 12 13 14 15 16 17 18 19 20
     -18.702 17.405 -20.083 7.416 3.476 13.421 -22.091 1.947 13.494 -6.772
    
     $fitted
     1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
     926 1025 1060 1155 1156 1185 1247 1263 1194 1305 1379 1523 1595 1689 1641 1613
     17 18 19 20
     1677 1754 1874 1999
    
     $coef
     a_0 a_1 a_2 a_3 b_1_1 b_1_2 b_1_3 b_2_2
     -1.61e+04 1.39e+04 3.62e+02 1.73e+00 -3.73e+03 -1.67e+02 -5.11e+00 -8.85e-01
     b_2_3 b_3_3 d_1 d_2_TRUE
     -1.95e-02 1.08e-02 5.35e+00 -8.70e+01
    
     $coefCov
     a_0 a_1 a_2 a_3 b_1_1 b_1_2 b_1_3
     a_0 8.13e+07 -84219919 -2.01e+06 3.68e+04 39262698 9.77e+05 -5.29e+03
     a_1 -8.42e+07 116647378 1.14e+06 -6.59e+04 -91400577 -3.56e+05 5.04e+04
     a_2 -2.01e+06 1140366 1.53e+05 -2.85e+03 69726 -8.61e+04 1.54e+03
     a_3 3.68e+04 -65896 -2.85e+03 1.53e+02 88472 1.42e+03 -1.56e+02
     b_1_1 3.93e+07 -91400577 6.97e+04 8.85e+04 116928660 -3.41e+05 -1.16e+05
     b_1_2 9.77e+05 -355785 -8.61e+04 1.42e+03 -340778 5.20e+04 -7.57e+02
     b_1_3 -5.29e+03 50423 1.54e+03 -1.56e+02 -115613 -7.57e+02 2.14e+02
     b_2_2 -4.62e+02 1420 6.72e+01 -4.69e+00 -234 -3.42e+01 2.96e-01
     b_2_3 5.35e+02 -775 -1.82e+01 9.18e-01 641 3.00e+00 -4.18e-01
     b_3_3 -6.33e+01 15 1.31e+00 9.33e-02 104 -4.20e-01 -2.39e-01
     d_1 7.18e+04 -56612 -2.36e+03 1.72e+01 11662 1.23e+03 6.37e+00
     d_2_TRUE 1.56e+05 -122693 -7.50e+03 1.23e+02 57774 3.15e+03 -6.97e+01
     b_2_2 b_2_3 b_3_3 d_1 d_2_TRUE
     a_0 -462.1618 5.35e+02 -6.33e+01 7.18e+04 1.56e+05
     a_1 1419.5359 -7.75e+02 1.50e+01 -5.66e+04 -1.23e+05
     a_2 67.1620 -1.82e+01 1.31e+00 -2.36e+03 -7.50e+03
     a_3 -4.6929 9.18e-01 9.33e-02 1.72e+01 1.23e+02
     b_1_1 -234.0715 6.41e+02 1.04e+02 1.17e+04 5.78e+04
     b_1_2 -34.1784 3.00e+00 -4.20e-01 1.23e+03 3.15e+03
     b_1_3 0.2961 -4.18e-01 -2.39e-01 6.37e+00 -6.97e+01
     b_2_2 9.9432 -4.73e-01 2.62e-02 5.49e+00 1.97e+01
     b_2_3 -0.4734 3.91e-02 -2.03e-03 1.43e-01 1.78e+00
     b_3_3 0.0262 -2.03e-03 4.89e-04 -4.38e-02 -7.41e-02
     d_1 5.4950 1.43e-01 -4.38e-02 1.01e+02 1.47e+02
     d_2_TRUE 19.7059 1.78e+00 -7.41e-02 1.47e+02 2.96e+03
    
     $r2
     [1] 0.995
    
     $r2bar
     [1] 0.988
    
     $nObs
     [1] 20
    
     $yName
     [1] "qOutput"
    
     $xNames
     [1] "qLabor" "land" "qVarInput"
    
     $shifterNames
     [1] "time" "reUnif"
    
     $regScale
     [1] 1
    
     $model.matrix
     (Intercept) a_1 a_2 a_3 b_1_1 b_1_2 b_1_3 b_2_2 b_2_3 b_3_3 d_1 d_2_TRUE
     1 1 1.44 23.4 557 1.04 33.7 801 274 13023 154872 1 0
     2 1 1.45 24.2 607 1.05 35.1 880 293 14681 184006 2 0
     3 1 1.44 24.7 608 1.04 35.6 875 305 15009 184781 3 0
     4 1 1.48 24.9 654 1.10 36.9 968 310 16290 213832 4 0
     5 1 1.48 24.9 648 1.10 36.9 958 310 16132 209710 5 0
     6 1 1.47 25.2 657 1.08 37.1 966 318 16576 215817 6 0
     7 1 1.45 25.9 673 1.05 37.6 977 336 17449 226774 7 0
     8 1 1.49 26.0 648 1.11 38.7 965 337 16826 209890 8 0
     9 1 1.48 25.2 640 1.10 37.3 947 317 16115 204785 9 0
     10 1 1.53 26.1 648 1.17 39.9 992 340 16906 210262 10 0
     11 1 1.53 26.8 682 1.17 41.0 1044 358 18267 232820 11 0
     12 1 1.69 29.9 761 1.43 50.5 1286 446 22730 289533 12 0
     13 1 1.70 31.1 801 1.44 52.9 1362 484 24927 321010 13 0
     14 1 1.67 32.2 798 1.39 53.8 1332 518 25681 318247 14 0
     15 1 1.65 31.5 737 1.36 52.0 1216 497 23230 271572 15 0
     16 1 1.61 31.9 719 1.30 51.3 1157 508 22914 258318 16 1
     17 1 1.62 33.5 701 1.31 54.3 1135 562 23501 245488 17 1
     18 1 1.62 35.1 702 1.31 56.8 1137 615 24605 246256 18 1
     19 1 1.62 37.3 731 1.31 60.4 1185 696 27283 267367 19 1
     20 1 1.62 39.4 770 1.31 63.8 1248 776 30337 296583 20 1
     attr(,"assign")
     [1] 0 1 2 3 4 5 6 7 8 9 10 11
     attr(,"contrasts")
     attr(,"contrasts")$d_2_
     [1] "contr.treatment"
    
    
     attr(,"class")
     [1] "quadFuncEst"
     > # compute fitted values
     > fitted <- quadFuncCalc( c( "qLabor", "land", "qVarInput" ),
     + shifterNames = c( "time", "reUnif" ), data = germanFarms,
     + coef( estResultShifterLogi2 ) )
     > all.equal( fitted, estResultShifterLogi2$fitted )
     [1] TRUE
     > all.equal( fitted, predict( estResultShifterLogi2 ) )
     [1] TRUE
     > all.equal( fitted, predict( estResultShifterLogi2, newdata = germanFarms ) )
     [1] TRUE
     >
     > ## estimate a quadratic production function with some shifters are factors
     > estResultShifterFac2 <- quadFuncEst( yName = "qOutput",
     + xNames = c( "qLabor", "land", "qVarInput" ),
     + shifterNames = c( "time", "decade" ), data = germanFarms )
     > coef( estResultShifterFac2 )
     a_0 a_1 a_2 a_3 b_1_1 b_1_2 b_1_3 b_2_2
     -1.53e+04 1.25e+04 3.85e+02 1.88e+00 -2.20e+03 -1.83e+02 -5.97e+00 -7.36e-01
     b_2_3 b_3_3 d_1 d_2_80s d_2_90s
     -2.68e-02 1.29e-02 7.93e+00 -1.30e+01 -1.04e+02
     > print( estResultShifterFac2 )
     $call
     quadFuncEst(yName = "qOutput", xNames = c("qLabor", "land", "qVarInput"),
     data = germanFarms, shifterNames = c("time", "decade"))
    
     $nExog
     [1] 3
    
     $nShifter
     [1] 2
    
     $est
    
     Call:
     lm(formula = as.formula(estFormula), data = estData)
    
     Coefficients:
     (Intercept) a_1 a_2 a_3 b_1_1 b_1_2
     -1.53e+04 1.25e+04 3.85e+02 1.88e+00 -2.20e+03 -1.83e+02
     b_1_3 b_2_2 b_2_3 b_3_3 d_1 d_2_80s
     -5.97e+00 -7.36e-01 -2.68e-02 1.29e-02 7.93e+00 -1.30e+01
     d_2_90s
     -1.04e+02
    
    
     $residuals
     1 2 3 4 5 6 7 8 9 10 11
     20.44 -61.15 6.75 15.41 18.54 5.95 -8.59 28.47 13.03 -26.62 -20.55
     12 13 14 15 16 17 18 19 20
     18.13 -20.67 7.97 2.87 13.40 -22.01 1.49 14.17 -7.05
    
     $fitted
     1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
     926 1024 1063 1156 1160 1180 1248 1260 1195 1305 1381 1523 1596 1688 1642 1613
     17 18 19 20
     1677 1754 1873 1999
    
     $coef
     a_0 a_1 a_2 a_3 b_1_1 b_1_2 b_1_3 b_2_2
     -1.53e+04 1.25e+04 3.85e+02 1.88e+00 -2.20e+03 -1.83e+02 -5.97e+00 -7.36e-01
     b_2_3 b_3_3 d_1 d_2_80s d_2_90s
     -2.68e-02 1.29e-02 7.93e+00 -1.30e+01 -1.04e+02
    
     $coefCov
     a_0 a_1 a_2 a_3 b_1_1 b_1_2 b_1_3
     a_0 1.03e+08 -1.15e+08 -1.96e+06 4.39e+04 6.59e+07 8.96e+05 -1.80e+04
     a_1 -1.15e+08 1.69e+08 6.87e+05 -7.87e+04 -1.43e+08 -8.06e+03 7.94e+04
     a_2 -1.96e+06 6.87e+05 1.83e+05 -3.17e+03 7.32e+05 -1.04e+05 1.38e+03
     a_3 4.39e+04 -7.87e+04 -3.17e+03 1.74e+02 1.05e+05 1.57e+03 -1.80e+02
     b_1_1 6.59e+07 -1.43e+08 7.32e+05 1.05e+05 1.75e+08 -8.13e+05 -1.55e+05
     b_1_2 8.96e+05 -8.06e+03 -1.04e+05 1.57e+03 -8.13e+05 6.32e+04 -6.19e+02
     b_1_3 -1.80e+04 7.94e+04 1.38e+03 -1.80e+02 -1.55e+05 -6.19e+02 2.56e+02
     b_2_2 1.55e+03 -2.25e+03 1.40e+02 -4.91e+00 3.89e+03 -8.02e+01 -2.00e+00
     b_2_3 5.06e+02 -6.91e+02 -2.37e+01 1.02e+00 5.24e+02 5.42e+00 -3.60e-01
     b_3_3 -4.33e+01 -3.59e+01 2.36e+00 1.11e-01 1.76e+02 -1.04e+00 -3.03e-01
     d_1 1.17e+05 -1.31e+05 -1.57e+03 2.66e+01 8.54e+04 6.76e+02 -3.33e+01
     d_2_80s -1.81e+05 3.37e+05 -5.55e+03 -3.59e+01 -3.63e+05 3.62e+03 2.04e+02
     d_2_90s -5.51e+04 2.93e+05 -1.56e+04 9.35e+01 -4.00e+05 8.21e+03 1.82e+02
     b_2_2 b_2_3 b_3_3 d_1 d_2_80s d_2_90s
     a_0 1.55e+03 5.06e+02 -4.33e+01 1.17e+05 -1.81e+05 -5.51e+04
     a_1 -2.25e+03 -6.91e+02 -3.59e+01 -1.31e+05 3.37e+05 2.93e+05
     a_2 1.40e+02 -2.37e+01 2.36e+00 -1.57e+03 -5.55e+03 -1.56e+04
     a_3 -4.91e+00 1.02e+00 1.11e-01 2.66e+01 -3.59e+01 9.35e+01
     b_1_1 3.89e+03 5.24e+02 1.76e+02 8.54e+04 -3.63e+05 -4.00e+05
     b_1_2 -8.02e+01 5.42e+00 -1.04e+00 6.76e+02 3.62e+03 8.21e+03
     b_1_3 -2.00e+00 -3.60e-01 -3.03e-01 -3.33e+01 2.04e+02 1.82e+02
     b_2_2 1.17e+01 -5.57e-01 3.53e-02 1.33e+01 -3.54e+01 -2.29e+01
     b_2_3 -5.57e-01 4.53e-02 -2.58e-03 -1.80e-01 1.72e+00 4.22e+00
     b_3_3 3.53e-02 -2.58e-03 6.31e-04 4.66e-02 -4.85e-01 -7.05e-01
     d_1 1.33e+01 -1.80e-01 4.66e-02 2.36e+02 -6.13e+02 -6.19e+02
     d_2_80s -3.54e+01 1.72e+00 -4.85e-01 -6.13e+02 3.09e+03 3.95e+03
     d_2_90s -2.29e+01 4.22e+00 -7.05e-01 -6.19e+02 3.95e+03 8.42e+03
    
     $r2
     [1] 0.995
    
     $r2bar
     [1] 0.987
    
     $nObs
     [1] 20
    
     $yName
     [1] "qOutput"
    
     $xNames
     [1] "qLabor" "land" "qVarInput"
    
     $shifterNames
     [1] "time" "decade"
    
     $regScale
     [1] 1
    
     $model.matrix
     (Intercept) a_1 a_2 a_3 b_1_1 b_1_2 b_1_3 b_2_2 b_2_3 b_3_3 d_1 d_2_80s
     1 1 1.44 23.4 557 1.04 33.7 801 274 13023 154872 1 0
     2 1 1.45 24.2 607 1.05 35.1 880 293 14681 184006 2 0
     3 1 1.44 24.7 608 1.04 35.6 875 305 15009 184781 3 0
     4 1 1.48 24.9 654 1.10 36.9 968 310 16290 213832 4 0
     5 1 1.48 24.9 648 1.10 36.9 958 310 16132 209710 5 0
     6 1 1.47 25.2 657 1.08 37.1 966 318 16576 215817 6 1
     7 1 1.45 25.9 673 1.05 37.6 977 336 17449 226774 7 1
     8 1 1.49 26.0 648 1.11 38.7 965 337 16826 209890 8 1
     9 1 1.48 25.2 640 1.10 37.3 947 317 16115 204785 9 1
     10 1 1.53 26.1 648 1.17 39.9 992 340 16906 210262 10 1
     11 1 1.53 26.8 682 1.17 41.0 1044 358 18267 232820 11 1
     12 1 1.69 29.9 761 1.43 50.5 1286 446 22730 289533 12 1
     13 1 1.70 31.1 801 1.44 52.9 1362 484 24927 321010 13 1
     14 1 1.67 32.2 798 1.39 53.8 1332 518 25681 318247 14 1
     15 1 1.65 31.5 737 1.36 52.0 1216 497 23230 271572 15 1
     16 1 1.61 31.9 719 1.30 51.3 1157 508 22914 258318 16 0
     17 1 1.62 33.5 701 1.31 54.3 1135 562 23501 245488 17 0
     18 1 1.62 35.1 702 1.31 56.8 1137 615 24605 246256 18 0
     19 1 1.62 37.3 731 1.31 60.4 1185 696 27283 267367 19 0
     20 1 1.62 39.4 770 1.31 63.8 1248 776 30337 296583 20 0
     d_2_90s
     1 0
     2 0
     3 0
     4 0
     5 0
     6 0
     7 0
     8 0
     9 0
     10 0
     11 0
     12 0
     13 0
     14 0
     15 0
     16 1
     17 1
     18 1
     19 1
     20 1
     attr(,"assign")
     [1] 0 1 2 3 4 5 6 7 8 9 10 11 11
     attr(,"contrasts")
     attr(,"contrasts")$d_2_
     [1] "contr.treatment"
    
    
     attr(,"class")
     [1] "quadFuncEst"
     > # compute fitted values
     > fitted <- quadFuncCalc( c( "qLabor", "land", "qVarInput" ),
     + shifterNames = c( "time", "decade" ), data = germanFarms,
     + coef( estResultShifterFac2 ) )
     > all.equal( fitted, estResultShifterFac2$fitted )
     [1] TRUE
     > all.equal( fitted, predict( estResultShifterFac2 ) )
     [1] TRUE
     > all.equal( fitted, predict( estResultShifterFac2, newdata = germanFarms ) )
     [1] TRUE
     >
     > ## estimate with further argument passed to lm()
     > estResult2 <- quadFuncEst( yName = "qOutput",
     + xNames = c( "qLabor", "land", "qVarInput", "time" ),
     + germanFarms, x = TRUE, y = TRUE )
     > coef( estResult2 )
     a_0 a_1 a_2 a_3 a_4 b_1_1 b_1_2 b_1_3
     -1.89e+04 1.64e+04 2.89e+01 1.92e+01 -1.50e+02 -1.14e+04 2.45e+02 -5.29e+00
     b_1_4 b_2_2 b_2_3 b_2_4 b_3_3 b_3_4 b_4_4
     -1.45e+02 -4.79e+00 -3.67e-01 5.18e+00 -7.90e-03 5.06e-01 -1.30e+01
     > print( estResult2 )
     $call
     quadFuncEst(yName = "qOutput", xNames = c("qLabor", "land", "qVarInput",
     "time"), data = germanFarms, x = TRUE, y = TRUE)
    
     $nExog
     [1] 4
    
     $nShifter
     [1] 0
    
     $est
    
     Call:
     lm(formula = as.formula(estFormula), data = estData, x = TRUE,
     y = TRUE)
    
     Coefficients:
     (Intercept) a_1 a_2 a_3 a_4 b_1_1
     -1.89e+04 1.64e+04 2.89e+01 1.92e+01 -1.50e+02 -1.14e+04
     b_1_2 b_1_3 b_1_4 b_2_2 b_2_3 b_2_4
     2.45e+02 -5.29e+00 -1.45e+02 -4.79e+00 -3.67e-01 5.18e+00
     b_3_3 b_3_4 b_4_4
     -7.90e-03 5.06e-01 -1.30e+01
    
    
     $residuals
     1 2 3 4 5 6 7 8 9 10
     7.432 -39.365 21.652 32.467 -0.816 -21.651 -0.640 -4.241 12.971 -7.827
     11 12 13 14 15 16 17 18 19 20
     -2.867 2.988 -6.250 0.863 7.942 7.057 -20.630 13.722 -3.067 0.260
    
     $fitted
     1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
     939 1002 1048 1139 1179 1207 1240 1293 1195 1286 1363 1538 1581 1695 1637 1619
     17 18 19 20
     1676 1742 1890 1992
    
     $coef
     a_0 a_1 a_2 a_3 a_4 b_1_1 b_1_2 b_1_3
     -1.89e+04 1.64e+04 2.89e+01 1.92e+01 -1.50e+02 -1.14e+04 2.45e+02 -5.29e+00
     b_1_4 b_2_2 b_2_3 b_2_4 b_3_3 b_3_4 b_4_4
     -1.45e+02 -4.79e+00 -3.67e-01 5.18e+00 -7.90e-03 5.06e-01 -1.30e+01
    
     $coefCov
     a_0 a_1 a_2 a_3 a_4 b_1_1 b_1_2
     a_0 1.94e+08 -2.20e+08 -6.68e+06 1.05e+05 6.70e+06 1.13e+08 4.31e+06
     a_1 -2.20e+08 2.81e+08 6.63e+06 -1.51e+05 -7.66e+06 -1.69e+08 -4.62e+06
     a_2 -6.68e+06 6.63e+06 5.13e+05 -1.06e+04 -3.64e+05 -2.55e+06 -3.15e+05
     a_3 1.05e+05 -1.51e+05 -1.06e+04 3.56e+02 6.68e+03 9.83e+04 6.98e+03
     a_4 6.70e+06 -7.66e+06 -3.64e+05 6.68e+03 3.83e+05 3.87e+06 2.36e+05
     b_1_1 1.13e+08 -1.69e+08 -2.55e+06 9.83e+04 3.87e+06 1.54e+08 1.38e+06
     b_1_2 4.31e+06 -4.62e+06 -3.15e+05 6.98e+03 2.36e+05 1.38e+06 2.19e+05
     b_1_3 -5.15e+04 8.65e+04 5.88e+03 -2.18e+02 -3.90e+03 -1.23e+05 -3.00e+03
     b_1_4 -4.18e+06 5.22e+06 1.98e+05 -4.24e+03 -2.25e+05 -2.28e+06 -1.55e+05
     b_2_2 -3.05e+04 5.44e+04 -4.26e+03 1.12e+02 1.34e+03 -2.62e+04 1.32e+03
     b_2_3 2.27e+03 -2.43e+03 1.66e+01 -2.32e+00 4.27e+01 2.20e+03 -2.74e+01
     b_2_4 -4.87e+04 4.09e+04 6.71e+03 -1.44e+02 -4.86e+03 -2.31e+04 -3.26e+03
     b_3_3 -1.41e+02 1.45e+02 3.27e+00 3.76e-03 -3.92e+00 4.58e+01 -3.77e+00
     b_3_4 3.10e+02 -8.51e+02 -9.78e+01 4.01e+00 5.87e+01 -3.90e+02 8.93e+01
     b_4_4 8.31e+04 -8.74e+04 -5.40e+03 9.41e+01 5.21e+03 5.26e+04 2.81e+03
     b_1_3 b_1_4 b_2_2 b_2_3 b_2_4 b_3_3 b_3_4
     a_0 -5.15e+04 -4.18e+06 -3.05e+04 2.27e+03 -4.87e+04 -1.41e+02 310.0540
     a_1 8.65e+04 5.22e+06 5.44e+04 -2.43e+03 4.09e+04 1.45e+02 -851.3935
     a_2 5.88e+03 1.98e+05 -4.26e+03 1.66e+01 6.71e+03 3.27e+00 -97.8391
     a_3 -2.18e+02 -4.24e+03 1.12e+02 -2.32e+00 -1.44e+02 3.76e-03 4.0064
     a_4 -3.90e+03 -2.25e+05 1.34e+03 4.27e+01 -4.86e+03 -3.92e+00 58.7104
     b_1_1 -1.23e+05 -2.28e+06 -2.62e+04 2.20e+03 -2.31e+04 4.58e+01 -390.2702
     b_1_2 -3.00e+03 -1.55e+05 1.32e+03 -2.74e+01 -3.26e+03 -3.77e+00 89.3295
     b_1_3 2.47e+02 1.53e+03 -8.48e+01 -8.32e-02 1.01e+02 -2.22e-01 -0.6176
     b_1_4 1.53e+03 1.63e+05 9.87e+02 -1.76e+01 1.55e+03 4.53e+00 -60.5660
     b_2_2 -8.48e+01 9.87e+02 2.33e+02 -3.65e+00 -1.69e+02 1.56e-01 1.4021
     b_2_3 -8.32e-02 -1.76e+01 -3.65e+00 1.66e-01 1.60e+00 -2.07e-03 -0.0899
     b_2_4 1.01e+02 1.55e+03 -1.69e+02 1.60e+00 1.67e+02 -5.80e-02 -1.3807
     b_3_3 -2.22e-01 4.53e+00 1.56e-01 -2.07e-03 -5.80e-02 6.19e-04 -0.0022
     b_3_4 -6.18e-01 -6.06e+01 1.40e+00 -8.99e-02 -1.38e+00 -2.20e-03 0.0971
     b_4_4 -7.19e+01 -2.31e+03 8.05e+01 1.74e-01 -1.10e+02 8.29e-03 0.4406
     b_4_4
     a_0 8.31e+04
     a_1 -8.74e+04
     a_2 -5.40e+03
     a_3 9.41e+01
     a_4 5.21e+03
     b_1_1 5.26e+04
     b_1_2 2.81e+03
     b_1_3 -7.19e+01
     b_1_4 -2.31e+03
     b_2_2 8.05e+01
     b_2_3 1.74e-01
     b_2_4 -1.10e+02
     b_3_3 8.29e-03
     b_3_4 4.41e-01
     b_4_4 1.01e+02
    
     $r2
     [1] 0.997
    
     $r2bar
     [1] 0.99
    
     $nObs
     [1] 20
    
     $yName
     [1] "qOutput"
    
     $xNames
     [1] "qLabor" "land" "qVarInput" "time"
    
     $regScale
     [1] 1
    
     $model.matrix
     (Intercept) a_1 a_2 a_3 a_4 b_1_1 b_1_2 b_1_3 b_1_4 b_2_2 b_2_3 b_2_4
     1 1 1.44 23.4 557 1 1.04 33.7 801 1.44 274 13023 23.4
     2 1 1.45 24.2 607 2 1.05 35.1 880 2.90 293 14681 48.4
     3 1 1.44 24.7 608 3 1.04 35.6 875 4.32 305 15009 74.1
     4 1 1.48 24.9 654 4 1.10 36.9 968 5.92 310 16290 99.6
     5 1 1.48 24.9 648 5 1.10 36.9 958 7.40 310 16132 124.5
     6 1 1.47 25.2 657 6 1.08 37.1 966 8.82 318 16576 151.4
     7 1 1.45 25.9 673 7 1.05 37.6 977 10.15 336 17449 181.4
     8 1 1.49 26.0 648 8 1.11 38.7 965 11.92 337 16826 207.8
     9 1 1.48 25.2 640 9 1.10 37.3 947 13.32 317 16115 226.6
     10 1 1.53 26.1 648 10 1.17 39.9 992 15.30 340 16906 260.7
     11 1 1.53 26.8 682 11 1.17 41.0 1044 16.83 358 18267 294.5
     12 1 1.69 29.9 761 12 1.43 50.5 1286 20.28 446 22730 358.4
     13 1 1.70 31.1 801 13 1.44 52.9 1362 22.10 484 24927 404.4
     14 1 1.67 32.2 798 14 1.39 53.8 1332 23.38 518 25681 450.7
     15 1 1.65 31.5 737 15 1.36 52.0 1216 24.75 497 23230 472.8
     16 1 1.61 31.9 719 16 1.30 51.3 1157 25.76 508 22914 510.1
     17 1 1.62 33.5 701 17 1.31 54.3 1135 27.54 562 23501 570.2
     18 1 1.62 35.1 702 18 1.31 56.8 1137 29.16 615 24605 631.1
     19 1 1.62 37.3 731 19 1.31 60.4 1185 30.78 696 27283 708.9
     20 1 1.62 39.4 770 20 1.31 63.8 1248 32.40 776 30337 787.8
     b_3_3 b_3_4 b_4_4
     1 154872 557 0.5
     2 184006 1213 2.0
     3 184781 1824 4.5
     4 213832 2616 8.0
     5 209710 3238 12.5
     6 215817 3942 18.0
     7 226774 4714 24.5
     8 209890 5183 32.0
     9 204785 5760 40.5
     10 210262 6485 50.0
     11 232820 7506 60.5
     12 289533 9132 72.0
     13 321010 10416 84.5
     14 318247 11169 98.0
     15 271572 11055 112.5
     16 258318 11500 128.0
     17 245488 11912 144.5
     18 246256 12632 162.0
     19 267367 13894 180.5
     20 296583 15403 200.0
     attr(,"assign")
     [1] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
    
     attr(,"class")
     [1] "quadFuncEst"
     >
     > ## calculating elasticities
     > estElaFit <- quadFuncEla(
     + xNames = c( "qLabor", "land", "qVarInput", "time" ),
     + data = germanFarms, coef = coef( estResult ) )
     > all.equal( estElaFit, elas( estResult ) )
     [1] TRUE
     > print( estElaFit )
     qLabor land qVarInput time
     1 3.907 1.75 -0.5199 0.0335
     2 3.210 1.35 -0.6738 0.0928
     3 3.163 1.31 -0.4316 0.1091
     4 1.961 1.15 -0.5131 0.1538
     5 1.755 1.27 -0.1855 0.1171
     6 1.701 1.21 0.0163 0.1116
     7 1.825 1.02 0.1424 0.1367
     8 1.277 1.47 0.3692 -0.0444
     9 1.148 1.74 0.8830 -0.2021
     10 0.455 1.88 0.7543 -0.2965
     11 0.258 1.61 0.7394 -0.2447
     12 -1.541 1.60 -0.3078 -0.0827
     13 -1.689 1.37 -0.4775 0.0147
     14 -1.073 1.20 -0.3044 -0.0249
     15 -0.854 1.72 0.3115 -0.4342
     16 -0.347 1.76 0.6310 -0.6121
     17 -0.103 1.92 0.5887 -0.7804
     18 0.108 1.88 0.5428 -0.8420
     19 0.314 1.52 0.3074 -0.6823
     20 0.427 1.15 0.0889 -0.5061
     > estElaObs <- quadFuncEla(
     + xNames = c( "qLabor", "land", "qVarInput", "time" ),
     + data = germanFarms, coef = coef( estResult ),
     + yName = "qOutput" )
     > all.equal( estElaObs, elas( estResult, yObs = TRUE ) )
     [1] TRUE
     > print( estElaObs )
     qLabor land qVarInput time
     1 3.876 1.74 -0.5159 0.0332
     2 3.341 1.40 -0.7014 0.0966
     3 3.099 1.29 -0.4228 0.1069
     4 1.906 1.12 -0.4989 0.1495
     5 1.757 1.27 -0.1856 0.1172
     6 1.732 1.23 0.0166 0.1136
     7 1.826 1.02 0.1425 0.1368
     8 1.282 1.47 0.3704 -0.0446
     9 1.136 1.72 0.8735 -0.1999
     10 0.458 1.89 0.7589 -0.2983
     11 0.259 1.61 0.7410 -0.2452
     12 -1.538 1.60 -0.3072 -0.0826
     13 -1.696 1.37 -0.4794 0.0147
     14 -1.073 1.20 -0.3042 -0.0249
     15 -0.850 1.71 0.3100 -0.4321
     16 -0.346 1.76 0.6283 -0.6095
     17 -0.104 1.94 0.5961 -0.7901
     18 0.107 1.87 0.5386 -0.8354
     19 0.315 1.52 0.3079 -0.6834
     20 0.427 1.15 0.0888 -0.5060
     > max( abs( estElaFit - estElaObs ) )
     [1] 0.131
     > # only at mean values
     > estElaMeanFit <- elas( estResult, data = germanFarmsMeans )
     > print( estElaMeanFit )
     qLabor land qVarInput time
     1 0.56 1.35 0.118 -0.0898
     > estElaMeanObs <- elas( estResult, data = germanFarmsMeans, yObs = TRUE )
     > print( estElaMeanObs )
     qLabor land qVarInput time
     1 0.616 1.49 0.13 -0.0989
     > print( estElaMeanFit - estElaMeanObs )
     qLabor land qVarInput time
     1 -0.0566 -0.136 -0.012 0.00908
     > # with a shifter
     > estElaShifterFit <- quadFuncEla(
     + xNames = c( "qLabor", "land", "qVarInput" ),
     + data = germanFarms, coef = coef( estResultShifter ),
     + shifterNames = "time" )
     > all.equal( estElaShifterFit, elas( estResultShifter ) )
     [1] TRUE
     > print( estElaShifterFit )
     qLabor land qVarInput
     1 2.538 1.132 0.367
     2 1.688 1.072 0.590
     3 1.607 1.086 0.636
     4 0.949 0.957 0.685
     5 1.005 0.951 0.647
     6 0.887 0.961 0.730
     7 0.689 0.983 0.884
     8 0.823 0.903 0.586
     9 1.012 0.921 0.587
     10 0.703 0.812 0.425
     11 0.336 0.807 0.581
     12 -0.906 0.606 0.399
     13 -1.293 0.605 0.558
     14 -1.208 0.632 0.635
     15 -0.702 0.637 0.425
     16 -0.493 0.677 0.469
     17 -0.497 0.658 0.374
     18 -0.592 0.655 0.385
     19 -0.884 0.659 0.505
     20 -1.175 0.661 0.651
     > estElaShifterObs <- quadFuncEla(
     + xNames = c( "qLabor", "land", "qVarInput" ),
     + data = germanFarms, coef = coef( estResultShifter ),
     + yName = "qOutput" )
     > all.equal( estElaShifterObs, elas( estResultShifter, yObs = TRUE ) )
     [1] TRUE
     > print( estElaShifterObs )
     qLabor land qVarInput
     1 2.490 1.111 0.360
     2 1.803 1.145 0.630
     3 1.578 1.066 0.624
     4 0.940 0.949 0.679
     5 0.992 0.940 0.639
     6 0.892 0.966 0.734
     7 0.692 0.987 0.887
     8 0.796 0.874 0.567
     9 1.011 0.920 0.586
     10 0.713 0.824 0.431
     11 0.338 0.812 0.584
     12 -0.898 0.600 0.395
     13 -1.317 0.616 0.568
     14 -1.196 0.626 0.629
     15 -0.691 0.626 0.418
     16 -0.499 0.685 0.475
     17 -0.507 0.671 0.381
     18 -0.590 0.652 0.384
     19 -0.874 0.651 0.499
     20 -1.181 0.664 0.654
     > max( abs( estElaShifterFit - estElaShifterObs ) )
     [1] 0.115
     > estElaShifterObs2 <- quadFuncEla(
     + xNames = c( "qLabor", "land", "qVarInput" ),
     + data = germanFarms, coef = coef( estResultShifter ),
     + yName = "qOutput", shifterNames = "time" )
     > all.equal( estElaShifterObs, estElaShifterObs2 )
     [1] TRUE
     > # only at mean values
     > estElaShifterMeanFit <- elas( estResultShifter, data = germanFarmsMeans )
     > print( estElaShifterMeanFit )
     qLabor land qVarInput
     1 0.0631 0.775 0.526
     > estElaShifterMeanObs <- elas( estResultShifter, data = germanFarmsMeans,
     + yObs = TRUE )
     > print( estElaShifterMeanObs )
     qLabor land qVarInput
     1 0.0653 0.802 0.544
     > print( estElaShifterMeanFit - estElaShifterMeanObs )
     qLabor land qVarInput
     1 -0.00216 -0.0265 -0.018
     >
     >
     > ################ imposing homogeneity #####################
     > ## linear functions with homogeneity imposed
     > estResultLinHom <- quadFuncEst( yName = "qOutput",
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + data = germanFarms, linear = TRUE,
     + homWeights = c( qLabor = 0.2, land = 0.5, qVarInput = 0.3 ) )
     > coef( estResultLinHom )
     a_0 a_1 a_2 a_3 a_4 b_1_1 b_1_2 b_1_3 b_1_4 b_2_2
     -204866 35 -169744 107691 62053 0 0 0 0 0
     b_2_3 b_2_4 b_3_3 b_3_4 b_4_4
     0 0 0 0 0
     > all.equal( sum( coef( estResultLinHom )[3:4] ), - coef( estResultLinHom )[5],
     + check.attributes = FALSE )
     [1] TRUE
     > vcov( estResultLinHom )
     a_0 a_1 a_2 a_3 a_4 b_1_1 b_1_2 b_1_3 b_1_4
     a_0 2.85e+09 197398.2 2.34e+09 -1.48e+09 -8.60e+08 0 0 0 0
     a_1 1.97e+05 23.5 1.65e+05 -1.06e+05 -5.95e+04 0 0 0 0
     a_2 2.34e+09 165444.1 1.93e+09 -1.22e+09 -7.07e+08 0 0 0 0
     a_3 -1.48e+09 -105986.7 -1.22e+09 7.74e+08 4.47e+08 0 0 0 0
     a_4 -8.60e+08 -59457.3 -7.07e+08 4.47e+08 2.59e+08 0 0 0 0
     b_1_1 0.00e+00 0.0 0.00e+00 0.00e+00 0.00e+00 0 0 0 0
     b_1_2 0.00e+00 0.0 0.00e+00 0.00e+00 0.00e+00 0 0 0 0
     b_1_3 0.00e+00 0.0 0.00e+00 0.00e+00 0.00e+00 0 0 0 0
     b_1_4 0.00e+00 0.0 0.00e+00 0.00e+00 0.00e+00 0 0 0 0
     b_2_2 0.00e+00 0.0 0.00e+00 0.00e+00 0.00e+00 0 0 0 0
     b_2_3 0.00e+00 0.0 0.00e+00 0.00e+00 0.00e+00 0 0 0 0
     b_2_4 0.00e+00 0.0 0.00e+00 0.00e+00 0.00e+00 0 0 0 0
     b_3_3 0.00e+00 0.0 0.00e+00 0.00e+00 0.00e+00 0 0 0 0
     b_3_4 0.00e+00 0.0 0.00e+00 0.00e+00 0.00e+00 0 0 0 0
     b_4_4 0.00e+00 0.0 0.00e+00 0.00e+00 0.00e+00 0 0 0 0
     b_2_2 b_2_3 b_2_4 b_3_3 b_3_4 b_4_4
     a_0 0 0 0 0 0 0
     a_1 0 0 0 0 0 0
     a_2 0 0 0 0 0 0
     a_3 0 0 0 0 0 0
     a_4 0 0 0 0 0 0
     b_1_1 0 0 0 0 0 0
     b_1_2 0 0 0 0 0 0
     b_1_3 0 0 0 0 0 0
     b_1_4 0 0 0 0 0 0
     b_2_2 0 0 0 0 0 0
     b_2_3 0 0 0 0 0 0
     b_2_4 0 0 0 0 0 0
     b_3_3 0 0 0 0 0 0
     b_3_4 0 0 0 0 0 0
     b_4_4 0 0 0 0 0 0
     > all.equal( rowSums( vcov( estResultLinHom )[ , 3:4 ] ),
     + - vcov( estResultLinHom )[ , 5 ] )
     [1] TRUE
     > all.equal( colSums( vcov( estResultLinHom )[ 3:4, ] ),
     + - vcov( estResultLinHom )[ 5, ] )
     [1] TRUE
     > # different order of weights
     > estResultLinHom2 <- quadFuncEst( yName = "qOutput",
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + data = germanFarms, linear = TRUE,
     + homWeights = c( qVarInput = 0.3, land = 0.5, qLabor = 0.2 ) )
     > all.equal( coef( estResultLinHom ), coef( estResultLinHom2 ) )
     [1] TRUE
     > all.equal( vcov( estResultLinHom ), vcov( estResultLinHom2 ) )
     [1] TRUE
     > # different order of xNames
     > estResultLinHom3 <- quadFuncEst( yName = "qOutput",
     + xNames = c( "qLabor", "land", "qVarInput", "time" ),
     + data = germanFarms, linear = TRUE,
     + homWeights = c( qLabor = 0.2, land = 0.5, qVarInput = 0.3 ) )
     > all.equal( coef( estResultLinHom ),
     + coef( estResultLinHom3 )[ c( 1, 5, 2:4, 6:15 ) ],
     + check.attributes = FALSE )
     [1] TRUE
     > all.equal( vcov( estResultLinHom ),
     + vcov( estResultLinHom3 )[ c( 1, 5, 2:4, 6:15 ), c( 1, 5, 2:4, 6:15 ) ],
     + check.attributes = FALSE )
     [1] TRUE
     > # homogenous in all variables
     > estResultLinHom4 <- quadFuncEst( yName = "qOutput",
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + data = germanFarms, linear = TRUE,
     + homWeights = c( qLabor = 0.2, land = 0.5, qVarInput = 0.3, time = 0 ) )
     > coef( estResultLinHom4 )
     a_0 a_1 a_2 a_3 a_4 b_1_1 b_1_2 b_1_3 b_1_4 b_2_2
     -281898 6871 -240607 148456 85281 0 0 0 0 0
     b_2_3 b_2_4 b_3_3 b_3_4 b_4_4
     0 0 0 0 0
     > all.equal( sum( coef( estResultLinHom4 )[2:4] ),
     + - coef( estResultLinHom4 )[5], check.attributes = FALSE )
     [1] TRUE
     > vcov( estResultLinHom4 )
     a_0 a_1 a_2 a_3 a_4 b_1_1 b_1_2 b_1_3 b_1_4
     a_0 4.02e+09 62725525 3.24e+09 -2.08e+09 -1.21e+09 0 0 0 0
     a_1 6.27e+07 1980508 5.08e+07 -3.38e+07 -1.89e+07 0 0 0 0
     a_2 3.24e+09 50755181 2.60e+09 -1.68e+09 -9.76e+08 0 0 0 0
     a_3 -2.08e+09 -33849741 -1.68e+09 1.08e+09 6.29e+08 0 0 0 0
     a_4 -1.21e+09 -18885947 -9.76e+08 6.29e+08 3.66e+08 0 0 0 0
     b_1_1 0.00e+00 0 0.00e+00 0.00e+00 0.00e+00 0 0 0 0
     b_1_2 0.00e+00 0 0.00e+00 0.00e+00 0.00e+00 0 0 0 0
     b_1_3 0.00e+00 0 0.00e+00 0.00e+00 0.00e+00 0 0 0 0
     b_1_4 0.00e+00 0 0.00e+00 0.00e+00 0.00e+00 0 0 0 0
     b_2_2 0.00e+00 0 0.00e+00 0.00e+00 0.00e+00 0 0 0 0
     b_2_3 0.00e+00 0 0.00e+00 0.00e+00 0.00e+00 0 0 0 0
     b_2_4 0.00e+00 0 0.00e+00 0.00e+00 0.00e+00 0 0 0 0
     b_3_3 0.00e+00 0 0.00e+00 0.00e+00 0.00e+00 0 0 0 0
     b_3_4 0.00e+00 0 0.00e+00 0.00e+00 0.00e+00 0 0 0 0
     b_4_4 0.00e+00 0 0.00e+00 0.00e+00 0.00e+00 0 0 0 0
     b_2_2 b_2_3 b_2_4 b_3_3 b_3_4 b_4_4
     a_0 0 0 0 0 0 0
     a_1 0 0 0 0 0 0
     a_2 0 0 0 0 0 0
     a_3 0 0 0 0 0 0
     a_4 0 0 0 0 0 0
     b_1_1 0 0 0 0 0 0
     b_1_2 0 0 0 0 0 0
     b_1_3 0 0 0 0 0 0
     b_1_4 0 0 0 0 0 0
     b_2_2 0 0 0 0 0 0
     b_2_3 0 0 0 0 0 0
     b_2_4 0 0 0 0 0 0
     b_3_3 0 0 0 0 0 0
     b_3_4 0 0 0 0 0 0
     b_4_4 0 0 0 0 0 0
     > all.equal( rowSums( vcov( estResultLinHom4 )[ , 2:4 ] ),
     + - vcov( estResultLinHom4 )[ , 5 ] )
     [1] TRUE
     > all.equal( colSums( vcov( estResultLinHom4 )[ 2:4, ] ),
     + - vcov( estResultLinHom4 )[ 5, ] )
     [1] TRUE
     >
     > ## computing fitted values of linear functions with homogeneity imposed
     > fitted <- quadFuncCalc(
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + coef = coef( estResultLinHom ), data = germanFarms,
     + homWeights = c( qLabor = 0.2, land = 0.5, qVarInput = 0.3 ) )
     > all.equal( estResultLinHom$fitted, fitted )
     [1] TRUE
     > all.equal( fitted, predict( estResultLinHom ) )
     [1] TRUE
     > all.equal( fitted, predict( estResultLinHom, newdata = germanFarms ) )
     [1] TRUE
     > fitted <- quadFuncCalc(
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + coef = coef( estResultLinHom ), data = germanFarms,
     + homWeights = c( qVarInput = 0.3, land = 0.5, qLabor = 0.2 ) )
     > all.equal( estResultLinHom$fitted, fitted )
     [1] TRUE
     > fitted <- quadFuncCalc(
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + coef = coef( estResultLinHom2 ), data = germanFarms,
     + homWeights = c( qVarInput = 0.3, land = 0.5, qLabor = 0.2 ) )
     > all.equal( estResultLinHom2$fitted, fitted )
     [1] TRUE
     > all.equal( fitted, predict( estResultLinHom2 ) )
     [1] TRUE
     > all.equal( fitted, predict( estResultLinHom2, newdata = germanFarms ) )
     [1] TRUE
     > fitted <- quadFuncCalc(
     + xNames = c( "qLabor", "land", "qVarInput", "time" ),
     + coef = coef( estResultLinHom3 ), data = germanFarms,
     + homWeights = c( qLabor = 0.2, land = 0.5, qVarInput = 0.3 ) )
     > all.equal( estResultLinHom3$fitted, fitted )
     [1] TRUE
     > all.equal( fitted, predict( estResultLinHom3 ) )
     [1] TRUE
     > all.equal( fitted, predict( estResultLinHom3, newdata = germanFarms ) )
     [1] TRUE
     > fitted <- quadFuncCalc(
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + coef = coef( estResultLinHom4 ), data = germanFarms,
     + homWeights = c( qLabor = 0.2, land = 0.5, qVarInput = 0.3, time = 0 ) )
     > all.equal( estResultLinHom4$fitted, fitted )
     [1] TRUE
     > all.equal( fitted, predict( estResultLinHom4 ) )
     [1] TRUE
     > all.equal( fitted, predict( estResultLinHom4, newdata = germanFarms ) )
     [1] TRUE
     >
     > ## derivatives of linear functions with homogeneity imposed
     > estResultLinHomDeriv <- quadFuncDeriv(
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + coef = coef( estResultLinHom ), data = germanFarms,
     + homWeights = c( qLabor = 0.2, land = 0.5, qVarInput = 0.3 ) )
     > print( estResultLinHomDeriv )
     time qLabor land qVarInput
     1 35 -1178 27.0 1.912
     2 35 -1085 24.6 1.610
     3 35 -1082 24.5 1.567
     4 35 -1009 22.8 1.416
     5 35 -1019 23.0 1.443
     6 35 -1004 22.6 1.378
     7 35 -980 21.9 1.266
     8 35 -1016 22.9 1.417
     9 35 -1029 23.3 1.465
     10 35 -1015 23.0 1.470
     11 35 -966 21.7 1.313
     12 35 -866 19.5 1.159
     13 35 -823 18.4 1.033
     14 35 -825 18.3 0.987
     15 35 -889 19.9 1.140
     16 35 -910 20.3 1.137
     17 35 -928 20.7 1.154
     18 35 -924 20.5 1.106
     19 35 -885 19.5 0.965
     20 35 -840 18.4 0.827
     > all.equal( estResultLinHomDeriv$qLabor * germanFarms$qLabor +
     + estResultLinHomDeriv$land * germanFarms$land,
     + - estResultLinHomDeriv$qVarInput * germanFarms$qVarInput )
     [1] TRUE
     > # different order of weights (different from order used for estimation)
     > estResultLinHom1Deriv <- quadFuncDeriv(
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + coef = coef( estResultLinHom ), data = germanFarms,
     + homWeights = c( qVarInput = 0.3, land = 0.5, qLabor = 0.2 ) )
     > all.equal( estResultLinHomDeriv, estResultLinHom1Deriv )
     [1] TRUE
     > # different order of weights (same order as used for estimation)
     > estResultLinHom2Deriv <- quadFuncDeriv(
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + coef = coef( estResultLinHom2 ), data = germanFarms,
     + homWeights = c( qVarInput = 0.3, land = 0.5, qLabor = 0.2 ) )
     > all.equal( estResultLinHomDeriv, estResultLinHom2Deriv )
     [1] TRUE
     > # different order of independent variables
     > estResultLinHom3Deriv <- quadFuncDeriv(
     + xNames = c( "qLabor", "land", "qVarInput", "time" ),
     + coef = coef( estResultLinHom3 ), data = germanFarms,
     + homWeights = c( qLabor = 0.2, land = 0.5, qVarInput = 0.3 ) )
     > all.equal( estResultLinHomDeriv,
     + estResultLinHom3Deriv[ , c( 4, 1, 2, 3 ) ] )
     [1] TRUE
     > # homogenous in all independent variables
     > estResultLinHom4Deriv <- quadFuncDeriv(
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + coef = coef( estResultLinHom4 ), data = germanFarms,
     + homWeights = c( qLabor = 0.2, land = 0.5, qVarInput = 0.3, time = 0 ) )
     > print( estResultLinHom4Deriv )
     time qLabor land qVarInput
     1 38.4 -1661 39.6 2.563
     2 35.3 -1529 36.0 2.101
     3 35.2 -1524 35.7 1.985
     4 32.9 -1423 33.2 1.754
     5 33.2 -1436 33.4 1.739
     6 32.7 -1415 32.8 1.609
     7 31.9 -1381 31.7 1.420
     8 33.1 -1431 33.0 1.559
     9 33.5 -1451 33.5 1.567
     10 33.1 -1430 33.0 1.538
     11 31.5 -1361 31.1 1.323
     12 28.2 -1221 27.9 1.170
     13 26.8 -1160 26.3 1.004
     14 26.9 -1162 26.2 0.904
     15 29.0 -1253 28.3 1.005
     16 29.6 -1282 28.8 0.934
     17 30.2 -1308 29.3 0.889
     18 30.1 -1302 29.0 0.785
     19 28.8 -1248 27.5 0.610
     20 27.4 -1184 25.9 0.454
     > all.equal( estResultLinHom4Deriv$qLabor * germanFarms$qLabor +
     + estResultLinHom4Deriv$land * germanFarms$land +
     + estResultLinHom4Deriv$qVarInput * germanFarms$qVarInput,
     + - estResultLinHom4Deriv$time * germanFarms$time )
     [1] TRUE
     >
     > ## quadratic functions with homogeneity imposed
     > estResultHom <- quadFuncEst( yName = "qOutput",
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + data = germanFarms,
     + homWeights = c( qLabor = 0.7, land = 0.1, qVarInput = 0.2 ) )
     > coef( estResultHom )
     a_0 a_1 a_2 a_3 a_4 b_1_1 b_1_2 b_1_3
     -1.01e+08 -3.36e+04 -6.65e+07 2.60e+07 4.06e+07 -1.53e+00 -1.08e+04 4.02e+03
     b_1_4 b_2_2 b_2_3 b_2_4 b_3_3 b_3_4 b_4_4
     6.78e+03 -2.19e+07 8.51e+06 1.34e+07 -3.28e+06 -5.23e+06 -8.17e+06
     > all.equal( sum( coef( estResultHom )[3:4] ), - coef( estResultHom )[5],
     + check.attributes = FALSE ) # a_2:4
     [1] TRUE
     > all.equal( sum( coef( estResultHom )[7:8] ), - coef( estResultHom )[9],
     + check.attributes = FALSE ) # b_1_2:4
     [1] TRUE
     > all.equal( sum( coef( estResultHom )[10:11] ), - coef( estResultHom )[12],
     + check.attributes = FALSE ) # b_2_2:4
     [1] TRUE
     > all.equal( sum( coef( estResultHom )[13:14] ), - coef( estResultHom )[11],
     + check.attributes = FALSE ) # b_3_2:4
     [1] TRUE
     > all.equal( sum( coef( estResultHom )[14:15] ), - coef( estResultHom )[12],
     + check.attributes = FALSE ) # b_4_2:4
     [1] TRUE
     > vcov( estResultHom )
     a_0 a_1 a_2 a_3 a_4 b_1_1 b_1_2
     a_0 1.34e+16 3.83e+12 8.72e+15 -3.32e+15 -5.40e+15 6.19e+08 1.27e+12
     a_1 3.83e+12 1.30e+09 2.54e+12 -9.90e+11 -1.55e+12 2.36e+05 4.41e+08
     a_2 8.72e+15 2.54e+12 5.68e+15 -2.17e+15 -3.52e+15 4.13e+08 8.42e+11
     a_3 -3.32e+15 -9.90e+11 -2.17e+15 8.32e+14 1.34e+15 -1.64e+08 -3.30e+11
     a_4 -5.40e+15 -1.55e+12 -3.52e+15 1.34e+15 2.18e+15 -2.49e+08 -5.12e+11
     b_1_1 6.19e+08 2.36e+05 4.13e+08 -1.64e+08 -2.49e+08 5.17e+01 8.06e+04
     b_1_2 1.27e+12 4.41e+08 8.42e+11 -3.30e+11 -5.12e+11 8.06e+04 1.50e+08
     b_1_3 -4.99e+11 -1.79e+08 -3.32e+11 1.31e+11 2.01e+11 -3.31e+04 -6.12e+07
     b_1_4 -7.72e+11 -2.62e+08 -5.11e+11 1.99e+11 3.11e+11 -4.75e+04 -8.88e+07
     b_2_2 2.85e+15 8.42e+11 1.86e+15 -7.11e+14 -1.15e+15 1.39e+08 2.80e+11
     b_2_3 -1.09e+15 -3.31e+11 -7.13e+14 2.74e+14 4.38e+14 -5.54e+07 -1.11e+11
     b_2_4 -1.76e+15 -5.11e+11 -1.15e+15 4.37e+14 7.09e+14 -8.32e+07 -1.70e+11
     b_3_3 4.19e+14 1.32e+11 2.76e+14 -1.07e+14 -1.69e+14 2.25e+07 4.43e+10
     b_3_4 6.68e+14 1.99e+11 4.37e+14 -1.68e+14 -2.69e+14 3.29e+07 6.65e+10
     b_4_4 1.09e+15 3.11e+11 7.09e+14 -2.70e+14 -4.39e+14 5.02e+07 1.03e+11
     b_1_3 b_1_4 b_2_2 b_2_3 b_2_4 b_3_3 b_3_4
     a_0 -4.99e+11 -7.72e+11 2.85e+15 -1.09e+15 -1.76e+15 4.19e+14 6.68e+14
     a_1 -1.79e+08 -2.62e+08 8.42e+11 -3.31e+11 -5.11e+11 1.32e+11 1.99e+11
     a_2 -3.32e+11 -5.11e+11 1.86e+15 -7.13e+14 -1.15e+15 2.76e+14 4.37e+14
     a_3 1.31e+11 1.99e+11 -7.11e+14 2.74e+14 4.37e+14 -1.07e+14 -1.68e+14
     a_4 2.01e+11 3.11e+11 -1.15e+15 4.38e+14 7.09e+14 -1.69e+14 -2.69e+14
     b_1_1 -3.31e+04 -4.75e+04 1.39e+08 -5.54e+07 -8.32e+07 2.25e+07 3.29e+07
     b_1_2 -6.12e+07 -8.88e+07 2.80e+11 -1.11e+11 -1.70e+11 4.43e+10 6.65e+10
     b_1_3 2.52e+07 3.60e+07 -1.11e+11 4.41e+10 6.68e+10 -1.78e+10 -2.63e+10
     b_1_4 3.60e+07 5.28e+07 -1.69e+11 6.67e+10 1.03e+11 -2.65e+10 -4.01e+10
     b_2_2 -1.11e+11 -1.69e+11 6.09e+14 -2.34e+14 -3.75e+14 9.09e+13 1.43e+14
     b_2_3 4.41e+10 6.67e+10 -2.34e+14 9.07e+13 1.44e+14 -3.54e+13 -5.52e+13
     b_2_4 6.68e+10 1.03e+11 -3.75e+14 1.44e+14 2.31e+14 -5.55e+13 -8.81e+13
     b_3_3 -1.78e+10 -2.65e+10 9.09e+13 -3.54e+13 -5.55e+13 1.39e+13 2.15e+13
     b_3_4 -2.63e+10 -4.01e+10 1.43e+14 -5.52e+13 -8.81e+13 2.15e+13 3.38e+13
     b_4_4 -4.05e+10 -6.27e+10 2.31e+14 -8.84e+13 -1.43e+14 3.40e+13 5.43e+13
     b_4_4
     a_0 1.09e+15
     a_1 3.11e+11
     a_2 7.09e+14
     a_3 -2.70e+14
     a_4 -4.39e+14
     b_1_1 5.02e+07
     b_1_2 1.03e+11
     b_1_3 -4.05e+10
     b_1_4 -6.27e+10
     b_2_2 2.31e+14
     b_2_3 -8.84e+13
     b_2_4 -1.43e+14
     b_3_3 3.40e+13
     b_3_4 5.43e+13
     b_4_4 8.86e+13
     > all.equal( rowSums( vcov( estResultHom )[ , 3:4 ] ),
     + - vcov( estResultHom )[ , 5 ] ) # a_2:4
     [1] TRUE
     > all.equal( rowSums( vcov( estResultHom )[ , 7:8 ] ),
     + - vcov( estResultHom )[ , 9 ] ) # b_1_2:4
     [1] TRUE
     > all.equal( rowSums( vcov( estResultHom )[ , 10:11 ] ),
     + - vcov( estResultHom )[ , 12 ] ) # b_2_2:4
     [1] TRUE
     > all.equal( rowSums( vcov( estResultHom )[ , 13:14 ] ),
     + - vcov( estResultHom )[ , 11 ] ) # b_3_2:4
     [1] TRUE
     > all.equal( rowSums( vcov( estResultHom )[ , 14:15 ] ),
     + - vcov( estResultHom )[ , 12 ] ) # b_4_2:4
     [1] TRUE
     > all.equal( colSums( vcov( estResultHom )[ 3:4, ] ),
     + - vcov( estResultHom )[ 5, ] ) # a_2:4
     [1] TRUE
     > all.equal( colSums( vcov( estResultHom )[ 7:8, ] ),
     + - vcov( estResultHom )[ 9, ] ) # b_1_2:4
     [1] TRUE
     > all.equal( colSums( vcov( estResultHom )[ 10:11, ] ),
     + - vcov( estResultHom )[ 12, ] ) # b_2_2:4
     [1] TRUE
     > all.equal( colSums( vcov( estResultHom )[ 13:14, ] ),
     + - vcov( estResultHom )[ 11, ] ) # b_3_2:4
     [1] TRUE
     > all.equal( colSums( vcov( estResultHom )[ 14:15, ] ),
     + - vcov( estResultHom )[ 12, ] ) # b_4_2:4
     [1] TRUE
     > # different order of weights
     > estResultHom2 <- quadFuncEst( yName = "qOutput",
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + data = germanFarms,
     + homWeights = c( qVarInput = 0.2, land = 0.1, qLabor = 0.7 ) )
     > all.equal( coef( estResultHom ), coef( estResultHom2 ) )
     [1] TRUE
     > all.equal( vcov( estResultHom ), vcov( estResultHom2 ) )
     [1] TRUE
     > # different order of xNames
     > estResultHom3 <- quadFuncEst( yName = "qOutput",
     + xNames = c( "qLabor", "land", "qVarInput", "time" ),
     + data = germanFarms,
     + homWeights = c( qLabor = 0.7, land = 0.1, qVarInput = 0.2 ) )
     > coefOrderHom3 <- c( 1, 5, 2:4, 15, 9, 12, 14, 6:8, 10, 11, 13 )
     > all.equal( coef( estResultHom ), coef( estResultHom3 )[ coefOrderHom3 ],
     + check.attributes = FALSE )
     [1] TRUE
     > all.equal( vcov( estResultHom ),
     + vcov( estResultHom3 )[ coefOrderHom3, coefOrderHom3 ],
     + check.attributes = FALSE )
     [1] TRUE
     > # homogenous in all variables
     > estResultHom4 <- quadFuncEst( yName = "qOutput",
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + data = germanFarms,
     + homWeights = c( qLabor = 0.7, land = 0.1, qVarInput = 0.2, time = 0 ) )
     > coef( estResultHom4 )
     a_0 a_1 a_2 a_3 a_4 b_1_1 b_1_2 b_1_3
     -1.33e+08 -8.59e+06 -7.99e+07 3.48e+07 5.37e+07 -1.33e+05 -2.67e+06 1.07e+06
     b_1_4 b_2_2 b_2_3 b_2_4 b_3_3 b_3_4 b_4_4
     1.73e+06 -2.39e+07 1.05e+07 1.61e+07 -4.58e+06 -7.00e+06 -1.08e+07
     > all.equal( sum( coef( estResultHom4 )[2:4] ), - coef( estResultHom4 )[5],
     + check.attributes = FALSE ) # a_1:4
     [1] TRUE
     > all.equal( sum( coef( estResultHom4 )[6:8] ), - coef( estResultHom4 )[9],
     + check.attributes = FALSE ) # b_1_1:4
     [1] TRUE
     > all.equal( sum( coef( estResultHom4 )[10:12] ), - coef( estResultHom4 )[7],
     + check.attributes = FALSE ) # b_2_1:4
     [1] TRUE
     > all.equal( sum( coef( estResultHom4 )[c(11,13,14)] ), - coef( estResultHom4 )[8],
     + check.attributes = FALSE ) # b_3_1:4
     [1] TRUE
     > all.equal( sum( coef( estResultHom4 )[c(12,14,15)] ), - coef( estResultHom4 )[9],
     + check.attributes = FALSE ) # b_4_1:4
     [1] TRUE
     > vcov( estResultHom4 )
     a_0 a_1 a_2 a_3 a_4 b_1_1 b_1_2
     a_0 1.23e+16 4.91e+14 7.41e+15 -2.94e+15 -4.97e+15 1.15e+13 1.48e+14
     a_1 4.91e+14 2.88e+13 2.94e+14 -1.25e+14 -1.98e+14 8.54e+11 9.00e+12
     a_2 7.41e+15 2.94e+14 4.47e+15 -1.77e+15 -2.99e+15 6.90e+12 8.88e+13
     a_3 -2.94e+15 -1.25e+14 -1.77e+15 7.13e+14 1.19e+15 -3.12e+12 -3.80e+13
     a_4 -4.97e+15 -1.98e+14 -2.99e+15 1.19e+15 2.00e+15 -4.63e+12 -5.98e+13
     b_1_1 1.15e+13 8.54e+11 6.90e+12 -3.12e+12 -4.63e+12 3.58e+10 2.64e+11
     b_1_2 1.48e+14 9.00e+12 8.88e+13 -3.80e+13 -5.98e+13 2.64e+11 2.83e+12
     b_1_3 -6.08e+13 -4.07e+12 -3.64e+13 1.59e+13 2.45e+13 -1.28e+11 -1.29e+12
     b_1_4 -9.89e+13 -5.78e+12 -5.93e+13 2.52e+13 3.99e+13 -1.72e+11 -1.81e+12
     b_2_2 2.23e+15 8.83e+13 1.35e+15 -5.35e+14 -9.02e+14 2.08e+12 2.66e+13
     b_2_3 -8.87e+14 -3.80e+13 -5.35e+14 2.16e+14 3.58e+14 -9.58e+11 -1.16e+13
     b_2_4 -1.50e+15 -5.93e+13 -9.02e+14 3.58e+14 6.03e+14 -1.39e+12 -1.79e+13
     b_3_3 3.55e+14 1.69e+13 2.14e+14 -8.78e+13 -1.43e+14 4.58e+11 5.18e+12
     b_3_4 5.93e+14 2.52e+13 3.58e+14 -1.44e+14 -2.39e+14 6.28e+11 7.66e+12
     b_4_4 1.00e+15 3.99e+13 6.03e+14 -2.39e+14 -4.04e+14 9.31e+11 1.20e+13
     b_1_3 b_1_4 b_2_2 b_2_3 b_2_4 b_3_3 b_3_4
     a_0 -6.08e+13 -9.89e+13 2.23e+15 -8.87e+14 -1.50e+15 3.55e+14 5.93e+14
     a_1 -4.07e+12 -5.78e+12 8.83e+13 -3.80e+13 -5.93e+13 1.69e+13 2.52e+13
     a_2 -3.64e+13 -5.93e+13 1.35e+15 -5.35e+14 -9.02e+14 2.14e+14 3.58e+14
     a_3 1.59e+13 2.52e+13 -5.35e+14 2.16e+14 3.58e+14 -8.78e+13 -1.44e+14
     a_4 2.45e+13 3.99e+13 -9.02e+14 3.58e+14 6.03e+14 -1.43e+14 -2.39e+14
     b_1_1 -1.28e+11 -1.72e+11 2.08e+12 -9.58e+11 -1.39e+12 4.58e+11 6.28e+11
     b_1_2 -1.29e+12 -1.81e+12 2.66e+13 -1.16e+13 -1.79e+13 5.18e+12 7.66e+12
     b_1_3 5.99e+11 8.16e+11 -1.09e+13 4.85e+12 7.33e+12 -2.25e+12 -3.21e+12
     b_1_4 8.16e+11 1.16e+12 -1.78e+13 7.66e+12 1.20e+13 -3.39e+12 -5.08e+12
     b_2_2 -1.09e+13 -1.78e+13 4.07e+14 -1.62e+14 -2.72e+14 6.47e+13 1.08e+14
     b_2_3 4.85e+12 7.66e+12 -1.62e+14 6.53e+13 1.08e+14 -2.67e+13 -4.35e+13
     b_2_4 7.33e+12 1.20e+13 -2.72e+14 1.08e+14 1.82e+14 -4.32e+13 -7.21e+13
     b_3_3 -2.25e+12 -3.39e+12 6.47e+13 -2.67e+13 -4.32e+13 1.12e+13 1.77e+13
     b_3_4 -3.21e+12 -5.08e+12 1.08e+14 -4.35e+13 -7.21e+13 1.77e+13 2.90e+13
     b_4_4 -4.94e+12 -8.04e+12 1.82e+14 -7.22e+13 -1.22e+14 2.89e+13 4.82e+13
     b_4_4
     a_0 1.00e+15
     a_1 3.99e+13
     a_2 6.03e+14
     a_3 -2.39e+14
     a_4 -4.04e+14
     b_1_1 9.31e+11
     b_1_2 1.20e+13
     b_1_3 -4.94e+12
     b_1_4 -8.04e+12
     b_2_2 1.82e+14
     b_2_3 -7.22e+13
     b_2_4 -1.22e+14
     b_3_3 2.89e+13
     b_3_4 4.82e+13
     b_4_4 8.16e+13
     > all.equal( rowSums( vcov( estResultHom4 )[ , 2:4 ] ),
     + - vcov( estResultHom4 )[ , 5 ] ) # a_1:4
     [1] TRUE
     > all.equal( rowSums( vcov( estResultHom4 )[ , 6:8 ] ),
     + - vcov( estResultHom4 )[ , 9 ] ) # b_1_1:4
     [1] TRUE
     > all.equal( rowSums( vcov( estResultHom4 )[ , 10:12 ] ),
     + - vcov( estResultHom4 )[ , 7 ] ) # b_2_1:4
     [1] TRUE
     > all.equal( rowSums( vcov( estResultHom4 )[ , c(11,13,14) ] ),
     + - vcov( estResultHom4 )[ , 8 ] ) # b_3_1:4
     [1] TRUE
     > all.equal( rowSums( vcov( estResultHom4 )[ , c(12,14,15) ] ),
     + - vcov( estResultHom4 )[ , 9 ] ) # b_4_1:4
     [1] TRUE
     > all.equal( colSums( vcov( estResultHom4 )[ 2:4, ] ),
     + - vcov( estResultHom4 )[ 5, ] ) # a_1:4
     [1] TRUE
     > all.equal( colSums( vcov( estResultHom4 )[ 6:8, ] ),
     + - vcov( estResultHom4 )[ 9, ] ) # b_1_1:4
     [1] TRUE
     > all.equal( colSums( vcov( estResultHom4 )[ 10:12, ] ),
     + - vcov( estResultHom4 )[ 7, ] ) # b_2_1:4
     [1] TRUE
     > all.equal( colSums( vcov( estResultHom4 )[ c(11,13,14), ] ),
     + - vcov( estResultHom4 )[ 8, ] ) # b_3_1:4
     [1] TRUE
     > all.equal( colSums( vcov( estResultHom4 )[ c(12,14,15), ] ),
     + - vcov( estResultHom4 )[ 9, ] ) # b_4_1:4
     [1] TRUE
     >
     > ## computing fitted values of quadratic functions with homogeneity imposed
     > fitted <- quadFuncCalc(
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + coef = coef( estResultHom ), data = germanFarms,
     + homWeights = c( qLabor = 0.7, land = 0.1, qVarInput = 0.2 ) )
     > all.equal( estResultHom$fitted, fitted )
     [1] TRUE
     > all.equal( fitted, predict( estResultHom ) )
     [1] TRUE
     > all.equal( fitted, predict( estResultHom, newdata = germanFarms ) )
     [1] TRUE
     > fitted <- quadFuncCalc(
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + coef = coef( estResultHom ), data = germanFarms,
     + homWeights = c( qVarInput = 0.2, land = 0.1, qLabor = 0.7 ) )
     > all.equal( estResultHom$fitted, fitted )
     [1] TRUE
     > fitted <- quadFuncCalc(
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + coef = coef( estResultHom2 ), data = germanFarms,
     + homWeights = c( qVarInput = 0.2, land = 0.1, qLabor = 0.7 ) )
     > all.equal( estResultHom2$fitted, fitted )
     [1] TRUE
     > all.equal( fitted, predict( estResultHom2 ) )
     [1] TRUE
     > all.equal( fitted, predict( estResultHom2, newdata = germanFarms ) )
     [1] TRUE
     > fitted <- quadFuncCalc(
     + xNames = c( "qLabor", "land", "qVarInput", "time" ),
     + coef = coef( estResultHom3 ), data = germanFarms,
     + homWeights = c( qLabor = 0.7, land = 0.1, qVarInput = 0.2 ) )
     > all.equal( estResultHom3$fitted, fitted )
     [1] TRUE
     > all.equal( fitted, predict( estResultHom3 ) )
     [1] TRUE
     > all.equal( fitted, predict( estResultHom3, newdata = germanFarms ) )
     [1] TRUE
     > fitted <- quadFuncCalc(
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + coef = coef( estResultHom4 ), data = germanFarms,
     + homWeights = c( qLabor = 0.7, land = 0.1, qVarInput = 0.2, time = 0 ) )
     > all.equal( estResultHom4$fitted, fitted )
     [1] TRUE
     > all.equal( fitted, predict( estResultHom4 ) )
     [1] TRUE
     > all.equal( fitted, predict( estResultHom4, newdata = germanFarms ) )
     [1] TRUE
     >
     > ## derivatives of quadratic functions with homogeneity imposed
     > estResultHomDeriv <- quadFuncDeriv(
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + coef = coef( estResultHom ), data = germanFarms,
     + homWeights = c( qLabor = 0.7, land = 0.1, qVarInput = 0.2 ) )
     > print( estResultHomDeriv )
     time qLabor land qVarInput
     1 5.57 -1158.7 26.07 1.902
     2 30.04 -196.1 -7.96 0.786
     3 34.40 -125.6 -10.41 0.720
     4 42.46 -94.9 -18.44 0.917
     5 38.42 -446.5 -10.24 1.414
     6 44.69 -339.0 -15.22 1.343
     7 57.50 71.6 -27.92 0.920
     8 36.58 -982.6 1.84 2.186
     9 30.55 -1519.1 12.35 3.027
     10 23.94 -1935.7 24.14 3.597
     11 38.90 -1416.0 6.83 2.907
     12 41.00 -1343.6 6.32 2.736
     13 54.71 -932.0 -6.17 2.217
     14 62.76 -698.0 -11.59 1.929
     15 44.58 -1522.6 11.80 2.904
     16 47.90 -1493.2 11.61 2.830
     17 45.49 -1589.5 19.15 2.758
     18 51.17 -1385.5 16.05 2.396
     19 68.46 -718.1 -1.17 1.651
     20 85.95 -145.6 -17.41 1.196
     > all.equal( estResultHomDeriv$qLabor * germanFarms$qLabor +
     + estResultHomDeriv$land * germanFarms$land,
     + - estResultHomDeriv$qVarInput * germanFarms$qVarInput )
     [1] TRUE
     > # different order of weights (different from order used for estimation)
     > estResultHom1Deriv <- quadFuncDeriv(
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + coef = coef( estResultHom ), data = germanFarms,
     + homWeights = c( qVarInput = 0.2, land = 0.1, qLabor = 0.7 ) )
     > all.equal( estResultHomDeriv, estResultHom1Deriv )
     [1] TRUE
     > # different order of weights (same order as used for estimation)
     > estResultHom2Deriv <- quadFuncDeriv(
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + coef = coef( estResultHom2 ), data = germanFarms,
     + homWeights = c( qVarInput = 0.2, land = 0.1, qLabor = 0.7 ) )
     > all.equal( estResultHomDeriv, estResultHom2Deriv )
     [1] TRUE
     > # different order of independent variables
     > estResultHom3Deriv <- quadFuncDeriv(
     + xNames = c( "qLabor", "land", "qVarInput", "time" ),
     + coef = coef( estResultHom3 ), data = germanFarms,
     + homWeights = c( qLabor = 0.7, land = 0.1, qVarInput = 0.2 ) )
     > all.equal( estResultHomDeriv,
     + estResultHom3Deriv[ , c( 4, 1, 2, 3 ) ] )
     [1] TRUE
     > # homogenous in all independent variables
     > estResultHom4Deriv <- quadFuncDeriv(
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + coef = coef( estResultHom4 ), data = germanFarms,
     + homWeights = c( qLabor = 0.7, land = 0.1, qVarInput = 0.2, time = 0 ) )
     > print( estResultHom4Deriv )
     time qLabor land qVarInput
     1 11.35 -606.9 7.66 1.2280
     2 51.77 293.2 -19.61 -0.0891
     3 56.28 192.5 -21.27 0.1301
     4 60.85 77.0 -15.94 0.0607
     5 49.44 -535.9 -1.18 0.8883
     6 56.47 -529.6 -4.11 0.8270
     7 75.52 -90.2 -19.94 0.1763
     8 34.66 -1657.0 21.23 2.5316
     9 16.83 -2579.7 46.59 3.8959
     10 1.75 -3170.2 61.33 4.9871
     11 26.67 -2422.8 39.55 3.4508
     12 31.27 -1896.0 27.51 2.6378
     13 50.76 -1241.4 8.37 1.4855
     14 62.46 -991.2 -3.48 1.1191
     15 31.21 -2455.0 31.00 3.5355
     16 34.21 -2639.4 29.98 3.8210
     17 29.73 -2955.8 30.48 4.6538
     18 39.12 -2742.6 18.78 4.3895
     19 69.07 -1651.7 -14.26 2.5918
     20 96.01 -627.6 -42.79 1.0153
     > all.equal( estResultHom4Deriv$qLabor * germanFarms$qLabor +
     + estResultHom4Deriv$land * germanFarms$land +
     + estResultHom4Deriv$qVarInput * germanFarms$qVarInput,
     + - estResultHom4Deriv$time * germanFarms$time )
     [1] TRUE
     >
     > ## elasticities of quadratic functions with homogeneity imposed
     > estResultHomEla <- quadFuncEla(
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + coef = coef( estResultHom ), data = germanFarms,
     + homWeights = c( qLabor = 0.7, land = 0.1, qVarInput = 0.2 ) )
     > all.equal( estResultHomEla, elas( estResultHom ) )
     [1] TRUE
     > print( estResultHomEla )
     time qLabor land qVarInput
     1 0.00594 -1.7801 0.6507 1.129
     2 0.05889 -0.2788 -0.1889 0.468
     3 0.09824 -0.1722 -0.2447 0.417
     4 0.15175 -0.1255 -0.4103 0.536
     5 0.16670 -0.5735 -0.2213 0.795
     6 0.22220 -0.4130 -0.3182 0.731
     7 0.31842 0.0821 -0.5723 0.490
     8 0.23342 -1.1677 0.0381 1.130
     9 0.21589 -1.7652 0.2442 1.521
     10 0.19018 -2.3527 0.4999 1.853
     11 0.30331 -1.5358 0.1297 1.406
     12 0.33426 -1.5428 0.1282 1.415
     13 0.44241 -0.9856 -0.1194 1.105
     14 0.52490 -0.6963 -0.2230 0.919
     15 0.41674 -1.5656 0.2317 1.334
     16 0.46079 -1.4454 0.2226 1.223
     17 0.46322 -1.5425 0.3848 1.158
     18 0.52712 -1.2846 0.3220 0.963
     19 0.69109 -0.6180 -0.0232 0.641
     20 0.86196 -0.1183 -0.3438 0.462
     > all.equal( estResultHomEla$qLabor + estResultHomEla$land,
     + - estResultHomEla$qVarInput )
     [1] TRUE
     > estResultHomElaObs <- quadFuncEla(
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + coef = coef( estResultHom ), data = germanFarms, yName = "qOutput",
     + homWeights = c( qLabor = 0.7, land = 0.1, qVarInput = 0.2 ) )
     > all.equal( estResultHomElaObs, elas( estResultHom, yObs = TRUE ) )
     [1] TRUE
     > print( estResultHomElaObs )
     time qLabor land qVarInput
     1 0.00589 -1.7635 0.6447 1.119
     2 0.06240 -0.2954 -0.2001 0.496
     3 0.09647 -0.1691 -0.2403 0.409
     4 0.14494 -0.1199 -0.3919 0.512
     5 0.16306 -0.5610 -0.2164 0.777
     6 0.22610 -0.4203 -0.3238 0.744
     7 0.32477 0.0838 -0.5838 0.500
     8 0.22712 -1.1362 0.0370 1.099
     9 0.22768 -1.8616 0.2576 1.604
     10 0.18727 -2.3167 0.4923 1.824
     11 0.31447 -1.5923 0.1344 1.458
     12 0.31930 -1.4738 0.1225 1.351
     13 0.45152 -1.0059 -0.1219 1.128
     14 0.51808 -0.6873 -0.2201 0.907
     15 0.40660 -1.5275 0.2261 1.301
     16 0.47133 -1.4785 0.2277 1.251
     17 0.46723 -1.5559 0.3881 1.168
     18 0.52461 -1.2785 0.3205 0.958
     19 0.68919 -0.6163 -0.0232 0.640
     20 0.86298 -0.1184 -0.3442 0.463
     > all.equal( estResultHomElaObs$qLabor + estResultHomElaObs$land,
     + - estResultHomElaObs$qVarInput )
     [1] TRUE
     > max( abs( estResultHomEla - estResultHomElaObs ) )
     [1] 0.0964
     > # only at mean values
     > estResultHomElaMeanFit <- elas( estResultHom, data = germanFarmsMeans )
     > print( estResultHomElaMeanFit )
     time qLabor land qVarInput
     1 0.351 -0.915 -0.0414 0.956
     > estResultHomElaMeanObs <- elas( estResultHom, data = germanFarmsMeans,
     + yObs = TRUE )
     > print( estResultHomElaMeanObs )
     time qLabor land qVarInput
     1 0.343 -0.894 -0.0405 0.935
     > print( estResultHomElaMeanFit - estResultHomElaMeanObs )
     time qLabor land qVarInput
     1 0.00785 -0.0205 -0.000926 0.0214
     > # different order of weights (different from order used for estimation)
     > estResultHom1Ela <- quadFuncEla(
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + coef = coef( estResultHom ), data = germanFarms,
     + homWeights = c( qVarInput = 0.2, land = 0.1, qLabor = 0.7 ) )
     > all.equal( estResultHomEla, estResultHom1Ela )
     [1] TRUE
     > estResultHom1ElaObs <- quadFuncEla(
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + coef = coef( estResultHom ), data = germanFarms, yName = "qOutput",
     + homWeights = c( qVarInput = 0.2, land = 0.1, qLabor = 0.7 ) )
     > all.equal( estResultHomElaObs, estResultHom1ElaObs )
     [1] TRUE
     > # different order of weights (same order as used for estimation)
     > estResultHom2Ela <- quadFuncEla(
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + coef = coef( estResultHom2 ), data = germanFarms,
     + homWeights = c( qVarInput = 0.2, land = 0.1, qLabor = 0.7 ) )
     > all.equal( estResultHom2Ela, elas( estResultHom2 ) )
     [1] TRUE
     > all.equal( estResultHomEla, estResultHom2Ela )
     [1] TRUE
     > estResultHom2ElaObs <- quadFuncEla(
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + coef = coef( estResultHom2 ), data = germanFarms, yName = "qOutput",
     + homWeights = c( qVarInput = 0.2, land = 0.1, qLabor = 0.7 ) )
     > all.equal( estResultHom2ElaObs, elas( estResultHom2, yObs = TRUE ) )
     [1] TRUE
     > all.equal( estResultHomElaObs, estResultHom2ElaObs )
     [1] TRUE
     > # different order of independent variables
     > estResultHom3Ela <- quadFuncEla(
     + xNames = c( "qLabor", "land", "qVarInput", "time" ),
     + coef = coef( estResultHom3 ), data = germanFarms,
     + homWeights = c( qLabor = 0.7, land = 0.1, qVarInput = 0.2 ) )
     > all.equal( estResultHom3Ela, elas( estResultHom3 ) )
     [1] TRUE
     > all.equal( estResultHomEla, estResultHom3Ela[ , c( 4, 1, 2, 3 ) ] )
     [1] TRUE
     > estResultHom3ElaObs <- quadFuncEla(
     + xNames = c( "qLabor", "land", "qVarInput", "time" ),
     + coef = coef( estResultHom3 ), data = germanFarms, yName = "qOutput",
     + homWeights = c( qLabor = 0.7, land = 0.1, qVarInput = 0.2 ) )
     > all.equal( estResultHom3ElaObs, elas( estResultHom3, yObs = TRUE ) )
     [1] TRUE
     > all.equal( estResultHomElaObs, estResultHom3ElaObs[ , c( 4, 1, 2, 3 ) ] )
     [1] TRUE
     > # homogenous in all independent variables
     > estResultHom4Ela <- quadFuncEla(
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + coef = coef( estResultHom4 ), data = germanFarms,
     + homWeights = c( qLabor = 0.7, land = 0.1, qVarInput = 0.2, time = 0 ) )
     > all.equal( estResultHom4Ela, elas( estResultHom4 ) )
     [1] TRUE
     > print( estResultHom4Ela )
     time qLabor land qVarInput
     1 0.0120 -0.922 0.1889 0.7207
     2 0.1035 0.425 -0.4743 -0.0540
     3 0.1620 0.266 -0.5038 0.0759
     4 0.2200 0.103 -0.3588 0.0359
     5 0.2133 -0.684 -0.0253 0.4964
     6 0.2767 -0.636 -0.0847 0.4438
     7 0.4077 -0.101 -0.3984 0.0916
     8 0.2158 -1.921 0.4290 1.2764
     9 0.1184 -2.983 0.9165 1.9479
     10 0.0142 -3.940 1.2987 2.6268
     11 0.2062 -2.605 0.7441 1.6549
     12 0.2589 -2.211 0.5671 1.3853
     13 0.4180 -1.337 0.1649 0.7539
     14 0.5246 -0.993 -0.0672 0.5356
     15 0.2919 -2.525 0.6091 1.6245
     16 0.3253 -2.526 0.5680 1.6323
     17 0.3043 -2.884 0.6157 1.9640
     18 0.4053 -2.558 0.3790 1.7733
     19 0.6917 -1.410 -0.2804 0.9989
     20 0.9657 -0.511 -0.8477 0.3933
     > all.equal( estResultHom4Ela$qLabor + estResultHom4Ela$land +
     + estResultHom4Ela$qVarInput, - estResultHom4Ela$time )
     [1] TRUE
     > estResultHom4ElaObs <- quadFuncEla(
     + xNames = c( "time", "qLabor", "land", "qVarInput" ),
     + coef = coef( estResultHom4 ), data = germanFarms, yName = "qOutput",
     + homWeights = c( qLabor = 0.7, land = 0.1, qVarInput = 0.2, time = 0 ) )
     > all.equal( estResultHom4ElaObs, elas( estResultHom4, yObs = TRUE ) )
     [1] TRUE
     > print( estResultHom4ElaObs )
     time qLabor land qVarInput
     1 0.0120 -0.9237 0.1894 0.7224
     2 0.1076 0.4416 -0.4930 -0.0562
     3 0.1579 0.2591 -0.4909 0.0739
     4 0.2077 0.0973 -0.3388 0.0339
     5 0.2098 -0.6732 -0.0249 0.4883
     6 0.2857 -0.6565 -0.0874 0.4582
     7 0.4265 -0.1055 -0.4168 0.0958
     8 0.2152 -1.9160 0.4279 1.2729
     9 0.1254 -3.1613 0.9714 2.0645
     10 0.0137 -3.7941 1.2507 2.5298
     11 0.2156 -2.7244 0.7782 1.7307
     12 0.2435 -2.0796 0.5333 1.3028
     13 0.4190 -1.3399 0.1652 0.7557
     14 0.5156 -0.9760 -0.0660 0.5264
     15 0.2847 -2.4629 0.5940 1.5843
     16 0.3366 -2.6134 0.5878 1.6890
     17 0.3053 -2.8932 0.6176 1.9703
     18 0.4011 -2.5308 0.3750 1.7547
     19 0.6954 -1.4176 -0.2819 1.0042
     20 0.9640 -0.5104 -0.8462 0.3926
     > all.equal( estResultHom4ElaObs$qLabor + estResultHom4ElaObs$land +
     + estResultHom4ElaObs$qVarInput, - estResultHom4ElaObs$time )
     [1] TRUE
     > max( abs( estResultHom4Ela - estResultHom4ElaObs ) )
     [1] 0.179
     >
     >
     > ################ panel data #####################
     > data( "GrunfeldGreene", package = "systemfit" )
     Error in find.package(package, lib.loc, verbose = verbose) :
     there is no package called 'systemfit'
     Calls: data -> find.package
     Execution halted
Flavor: r-devel-windows-x86_64-new-TK