Description Usage Arguments Value Examples
A function to estimate the elasticity of substitution
1 2 3 4 5 6 7 8 9 10 | elasticity(
x,
pvar,
qvar,
pervar,
prodID,
compIndex = "ces",
lower = -20,
upper = 20
)
|
x |
A dataframe |
pvar |
A character string for the name of the price variable |
qvar |
A character string for the name of the quantity variable |
pervar |
A character string for the name of the time variable. This variable must contain integers starting at period 1 and increasing in increments of 1 period. There may be observations on multiple products for each time period. |
prodID |
A character string for the name of the product identifier |
compIndex |
The index number with which the CES index will be equated to calculate the elasticity. Acceptable options are lloydmoulton, fisher or satovartia. The lloydmoulton option equates the 'base period' lloyd-moulton index with the 'current period' lloyd-moulton index. |
lower |
lower limit to search for sigma. |
upper |
upper limit to search for sigma. |
A list with three elements: sigma (the average elasticity over all time periods); allsigma (a T-1 by 1 matrix of the estimated elasticities for each time period, except period one); and diff (the value of the difference between the two indexes, check this is zero for all time periods).
1 2 | elasticity(CES_sigma_2,pvar="prices",qvar="quantities",pervar="time",
prodID = "prodID")
|
$sigma
[1] 2
$allsigma
[,1]
[1,] 2.000000
[2,] 2.000001
[3,] 2.000000
[4,] 1.999999
[5,] 2.000000
[6,] 2.000000
[7,] 2.000000
[8,] 2.000000
[9,] 2.000000
[10,] 2.000000
[11,] 2.000000
$diff
[,1]
[1,] -5.418676e-09
[2,] -5.665104e-08
[3,] 3.426148e-13
[4,] 1.213978e-07
[5,] 2.196501e-10
[6,] -1.141232e-11
[7,] 3.118616e-13
[8,] 9.429124e-12
[9,] -7.997090e-09
[10,] 4.536105e-11
[11,] 5.087042e-13
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.