elasticity: Computes the elasticity of substitution

View source: R/elasticity.R

elasticityR Documentation

Computes the elasticity of substitution

Description

A function to estimate the elasticity of substitution

Usage

elasticity(
  x,
  pvar,
  qvar,
  pervar,
  prodID,
  compIndex = "ces",
  lower = -20,
  upper = 20
)

Arguments

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.

Value

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).

Examples

elasticity(CES_sigma_2,pvar="prices",qvar="quantities",pervar="time",
prodID = "prodID")

IndexNumR documentation built on Nov. 11, 2023, 1:07 a.m.