Learn R Programming

PriceIndices (version 0.1.1)

elasticity_fig: Presenting elasticities of substitution for time interval

Description

The function provides a data frame or a figure presenting elasticities of substitution calculated for time interval.

Usage

elasticity_fig(
  data,
  start,
  end,
  fixedbase = TRUE,
  figure = TRUE,
  date_breaks = "1 month",
  left = -10,
  right = 10,
  precision = 1e-06
)

Value

The function provides a data frame or a figure presenting elasticities of substitution calculated for time interval (see the figure parameter). The elasticities of substitution can be calculated for subsequent months or for a fixed base month (see the start parameter) and rest of months from the given time interval (it depends on the fixedbase parameter). The above-mentioned parameters for compared months are calculated by using the elasticity function.

Arguments

data

The user's data frame with information about sold products. It must contain columns: time (as Date in format: year-month-day,e.g. '2020-12-01'), prices (as positive numeric), quantities (as positive numeric) and prodID (as numeric, factor or character).

start

The base period (as character) limited to the year and month, e.g. "2020-03".

end

The research period (as character) limited to the year and month, e.g. "2020-04".

fixedbase

A logical parameter indicating whether the procedure is to work for subsequent months from the considered time interval (fixedbase=FALSE). Otherwise the period defined by start plays a role of fixed base month (fixedbase=TRUE)

figure

A logical parameter indicating whether the function returns a figure (TRUE) or a data frame (FALSE) with values of elasticity of substitution.

date_breaks

A string giving the distance between breaks on the X axis like "1 month" (default value) or "4 months".

left

The beginning of an interval for estimation of each elasticity of substitution (its default value is -10)

right

The end of an interval for estimation of each elasticity of substitution (its default value is 10)

precision

The precision of estimation (a 'stop' condition for the procedure). A default value of this parameter is 0.000001.

References

de Haan, J., Balk, B.M., Hansen, C.B. (2010). Retrospective Approximations of Superlative Price Indexes for Years Where Expenditure Data Is Unavailable. In: Biggeri, L., Ferrari, G. (eds) Price Indexes in Time and Space. Contributions to Statistics. Physica-Verlag HD.

(2004). Consumer Price Index Manual. Theory and practice. ILO/IMF/OECD/UNECE/Eurostat/The World Bank, International Labour Office (ILO), Geneva.

Examples

Run this code
elasticity_fig (milk,start="2018-12",end="2019-12",figure=TRUE)
elasticity_fig (milk,start="2018-12",end="2019-12",figure=FALSE)

Run the code above in your browser using DataLab