-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathREADME.Rmd
More file actions
85 lines (61 loc) · 3.31 KB
/
Copy pathREADME.Rmd
File metadata and controls
85 lines (61 loc) · 3.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# IndexNumR
<!-- badges: start -->
[](https://github.com/grahamjwhite/IndexNumR)
[](https://app.codecov.io/gh/grahamjwhite/IndexNumR?branch=master)
[](https://www.r-pkg.org/badges/version/IndexNumR)
<!-- badges: end -->
An R package for computation of index numbers
IndexNumR provides a set of functions for computing various bilateral and multilateral indices. It is designed to compute price or quantity indices over time. Bilateral indices include Laspeyres, Paasche, Fisher, Tornqvist, Sato-Vartia, Walsh, CES, geometric Laspeyres, geometric Paasche, time-product-dummy and Geary-Khamis as well as elementary indices Dutot, Carli, Harmonic mean, CSWD and Jevons. All of these bilateral indices can be computed as period-on-period, fixed-base or chained.
Multilateral indices can be computed in the time series context using the GEKS, Weighted Time Product Dummy or Geary-Khamis indexes, and updating is provided via the window, movement, half, mean, fbew or fbmw splicing methods. The GEKS method is computed using either the Fisher, Tornqvist, Walsh, Jevons or TPD index number methods.
The package also provides functions to compute measures of dissimilarity between time periods, which can be used to choose the linking period for chained indices.
A sample dataset is included called CES_sigma_2, which is a dataset containing prices and quantities on four products over twelve periods, but additional datasets assuming different values of the elasticity of substitution can be computed using the function `CESData`.
There is also a function `dominicksData` that can be used to download the Dominicks Finer Foods scanner data from the [Chicago Booth School of Business](https://www.chicagobooth.edu/research/kilts/research-data/dominicks).
## Installation
You can install the released version of IndexNumR from [CRAN](https://cran.r-project.org) with:
``` r
install.packages("IndexNumR")
```
And the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("grahamjwhite/IndexNumR")
```
## Example
To estimate a simple chained Laspeyres price index using the `CES_sigma_2` dataset,
```{r}
library(IndexNumR)
priceIndex(CES_sigma_2,
pvar = "prices",
qvar = "quantities",
pervar = "time",
prodID = "prodID",
indexMethod = "laspeyres",
output = "chained")
```
A GEKS index with mean splicing and an 11 period window is estimated as follows,
```{r}
GEKSIndex(CES_sigma_2,
pvar = "prices",
qvar = "quantities",
pervar = "time",
prodID = "prodID",
indexMethod = "tornqvist",
window = 11,
splice = "mean")
```
More examples are contained in the package vignette.
```r
vignette("indexnumr", package = "IndexNumR")
```