quadFuncDeriv {micEcon} | R Documentation |
Calculate the derivatives of a quadratic function.
quadFuncDeriv( xNames, data, coef, coefCov = NULL, homWeights = NULL, quadHalf = TRUE )
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 ). |
quadHalf |
logical. Multiply the quadratic terms by one half? |
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.
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.
Arne Henningsen
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