quadFuncDeriv: Derivatives of a quadratic function

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/quadFuncDeriv.R

Description

Calculate the derivatives of a quadratic function.

Usage

1
2
   quadFuncDeriv( xNames, data, coef, coefCov = NULL, 
      homWeights = NULL )

Arguments

xNames

a vector of strings containing the names of the independent variables.

data

dataframe or a vector with named elements containing the data.

coef

vector containing all coefficients: if there are n exogenous variables in xNames, the n+1 alpha coefficients must have names a_0, ..., a_n and the n*(n+1)/2 beta coefficients must have names b_1_1, ..., b_1_n, ..., b_n_n (only the elements of the upper right triangle of the beta matrix are directly obtained from coef; the elements of the lower left triangle are obtained by assuming symmetry of the beta matrix).

coefCov

optional covariance matrix of the coefficients: the row names and column names must be the same as the names of coef.

homWeights

numeric vector with named elements that are weighting factors for calculating an index that is used to normalize the variables for imposing homogeneity of degree zero in these variables (see documentation of quadFuncEst).

Details

Shifter variables do not need to be specified, because they have no effect on the partial derivatives. Hence, you can use this function to calculate partial derivatives even for quadratic functions that have been estimated with shifter variables.

Value

A data frame containing the derivatives, where each column corresponds to one of the independent variables. If argument coefCov is provided, it has the attributes variance and stdDev, which are two data frames containing the variances and the standard deviations, respectively, of the derivatives.

Author(s)

Arne Henningsen

See Also

quadFuncEst and quadFuncCalc

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
   data( germanFarms )
   # output quantity:
   germanFarms$qOutput <- germanFarms$vOutput / germanFarms$pOutput
   # quantity of variable inputs
   germanFarms$qVarInput <- germanFarms$vVarInput / germanFarms$pVarInput
   # a time trend to account for technical progress:
   germanFarms$time <- c(1:20)

   # estimate a quadratic production function
   estResult <- quadFuncEst( "qOutput", c( "qLabor", "land", "qVarInput", "time" ),
      germanFarms )

   # compute the marginal products of the inputs
   margProducts <- quadFuncDeriv( c( "qLabor", "land", "qVarInput", "time" ),
      germanFarms, coef( estResult ), vcov( estResult ) )
   # all marginal products
   margProducts
   # their t-values
   margProducts / attributes( margProducts )$stdDev

Example output

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/
       qLabor     land   qVarInput       time
1   2546.6963 70.37321 -0.87697378  31.415311
2   2218.5034 55.78284 -1.11310030  46.483105
3   2301.6866 55.70200 -0.74397019  38.124492
4   1509.4055 52.72320 -0.89393206  43.800087
5   1398.3578 60.23202 -0.33770187  27.603970
6   1397.1054 57.99605  0.02997629  22.457520
7   1560.8988 48.97724  0.26225368  24.220550
8   1108.3537 73.05437  0.73659135  -7.177405
9    926.7102 82.48118  1.64839516 -26.829001
10   382.7553 92.52914  1.49605442 -38.131223
11   230.2419 81.91353  1.47746659 -30.332660
12 -1402.5828 82.58996 -0.62207350 -10.604369
13 -1571.1647 69.48917 -0.94239273   1.786045
14 -1089.4578 63.42216 -0.64667010  -3.018705
15  -847.2839 89.24736  0.69181322 -47.379138
16  -349.3805 89.59520  1.42135451 -61.938159
17  -106.1504 95.91727  1.40790948 -76.920291
18   115.7999 93.42042  1.34735027 -81.477061
19   366.4300 77.01233  0.79468293 -67.890172
20   525.3894 57.94714  0.22976523 -50.399087
         qLabor       land    qVarInput        time
1   0.146232445 0.09538935 -0.045951339  0.04957423
2   0.128654745 0.07576750 -0.058411057  0.07356631
3   0.134721112 0.07627918 -0.039327033  0.06075738
4   0.088716783 0.07183617 -0.046892425  0.06962119
5   0.082942116 0.08265707 -0.017824420  0.04416982
6   0.083826478 0.08029848  0.001593992  0.03624268
7   0.094769904 0.06850821  0.014062575  0.03945619
8   0.066854392 0.10158611  0.039300354 -0.01161060
9   0.056834446 0.11615480  0.088848265 -0.04400093
10  0.023200233 0.12871598  0.079612337 -0.06173473
11  0.014079022 0.11441331  0.078927511 -0.04935584
12 -0.081420041 0.10901477 -0.031469144 -0.01631884
13 -0.091398413 0.09160703 -0.047558217  0.00274558
14 -0.063935779 0.08466675 -0.033041060 -0.00468205
15 -0.050279581 0.12103233  0.035902360 -0.07443200
16 -0.021034626 0.12369107  0.075017704 -0.09877841
17 -0.006312906 0.13190103  0.073971425 -0.12153140
18  0.006851554 0.12844646  0.070767382 -0.12822562
19  0.021526072 0.10555068  0.041673076 -0.10609272
20  0.030708362 0.07922631  0.012021423 -0.07832333

micEcon documentation built on Jan. 7, 2021, 3:01 p.m.