piar

piar: Price Index Aggregation in R - Published in JOSS (2024)

https://github.com/marberts/piar

Science Score: 98.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 5 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org, zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

cran economics inflation official-statistics r r-package rstats statistics
Last synced: 6 months ago · JSON representation ·

Repository

Price index aggregation in R

Basic Info
Statistics
  • Stars: 5
  • Watchers: 1
  • Forks: 0
  • Open Issues: 5
  • Releases: 6
Topics
cran economics inflation official-statistics r r-package rstats statistics
Created over 4 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing License Citation

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  out.width = "100%"
)
```

# Price Index Aggregation in R piar website


[![CRAN status](https://www.r-pkg.org/badges/version/piar)](https://cran.r-project.org/package=piar)
[![piar status badge](https://marberts.r-universe.dev/badges/piar)](https://marberts.r-universe.dev/piar)
[![Conda Version](https://img.shields.io/conda/vn/conda-forge/r-piar.svg)](https://anaconda.org/conda-forge/r-piar)
[![R-CMD-check](https://github.com/marberts/piar/workflows/R-CMD-check/badge.svg)](https://github.com/marberts/piar/actions)
[![codecov](https://codecov.io/gh/marberts/piar/graph/badge.svg?token=lHDHsGHsLd)](https://app.codecov.io/gh/marberts/piar)
[![DOI](https://zenodo.org/badge/370889275.svg)](https://zenodo.org/doi/10.5281/zenodo.10110046)
[![Mentioned in Awesome Official Statistics ](https://awesome.re/mentioned-badge.svg)](https://github.com/SNStatComp/awesome-official-statistics-software)
[![DOI](https://joss.theoj.org/papers/10.21105/joss.06781/status.svg)](https://doi.org/10.21105/joss.06781)


Most price indexes are made with a two-step procedure, where period-over-period *elemental indexes* are first calculated for a collection of *elemental aggregates* at each point in time, and then aggregated according to a *price index aggregation structure*. These indexes can then be chained together to form a time series that gives the evolution of prices with respect to a fixed base period. This package contains a collection of functions that revolve around this work flow, making it easy to build standard price indexes, and implement the methods described by Balk (2008), von der Lippe (2007), and the CPI manual (2020) / PPI manual (2004) for bilateral price indexes.

The tools in this package are designed to be useful for both researching new
sources of data and methods to construct price indexes, and the regular
production of price statistics. It is targeted towards economists,
statisticians, and data scientists working at national statistical agencies,
central banks, financial institutions, and in academia that want to measure and
study the evolution of prices over time.

## Installation

Get the stable version from CRAN.

```{r, eval=FALSE}
install.packages("piar")
```

The development version can be installed from R-Universe

```{r, eval=FALSE}
install.packages(
  "piar",
  repos = c("https://marberts.r-universe.dev", "https://cloud.r-project.org")
)
```

or directly from Github.

```{r, eval=FALSE}
pak::pak("marberts/piar")
```

## Usage

There are several detailed vignette showing how to use **piar**: `browseVignettes("piar")`. But the basic work flow is fairly simple. 

The starting point is to make period-over-period elemental price indexes with the `elemental_index()` function.

```{r}
library(piar)

# Make Jevons business-level elemental indexes

head(ms_prices)

elementals <- ms_prices |>
  transform(
    relative = price_relative(price, period = period, product = product)
  ) |>
  elemental_index(relative ~ period + business, na.rm = TRUE)

elementals
```

And an aggregation structure.

```{r}
# Make an aggregation structure from businesses to higher-level
# industrial classifications

ms_weights

ms_weights[c("level1", "level2")] <-
  expand_classification(ms_weights$classification)

pias <- ms_weights[c("level1", "level2", "business", "weight")]

pias
```

The `aggregate()` method can then be used to aggregate the elemental indexes according to the aggregation structure (the first three rows below) and fill in missing elemental indexes while maintaining consistency in aggregation. There are a variety of methods to work with these index objects, such as chaining them over time.

```{r}
# Aggregate elemental indexes with an arithmetic index

index <- aggregate(elementals, pias, na.rm = TRUE)

# Chain them to get a time series

chain(index)
```

## Contributing

All contributions are welcome. Please start by opening an issue on GitHub to report any bugs or suggest improvements and new features. See the contribution 
guidelines for this project for more information.

## References

Balk, B. M. (2008). *Price and Quantity Index Numbers*. Cambridge University Press.

Chiru, R., Huang, N., Lequain, M. Smith, P., and Wright, A. (2015). *The Canadian Consumer Price Index Reference Paper*, Statistics Canada catalogue 62-553-X. Statistics Canada.

ILO, IMF, UNECE, OECD, and World Bank. (2004). *Producer Price Index Manual: Theory and Practice*. International Monetary Fund.

IMF, ILO, Eurostat, UNECE, OECD, and World Bank. (2020). *Consumer Price Index Manual: Concepts and Methods*. International Monetary Fund.

von der Lippe, P. (2007). *Index Theory and Price Statistics*. Peter Lang.

Owner

  • Name: Steve Martin
  • Login: marberts
  • Kind: user
  • Location: Ottawa, Canada
  • Company: Government of Canada

I build tools to measure inflation :chart_with_upwards_trend:

JOSS Publication

piar: Price Index Aggregation in R
Published
September 06, 2024
Volume 9, Issue 101, Page 6781
Authors
Steve Martin ORCID
Statistics Canada, Ottawa, ON, Canada
Editor
Chris Vernon ORCID
Tags
economics inflation official statistics

Citation (CITATION.cff)

cff-version: "1.2.0"
authors:
- family-names: Martin
  given-names: Steve
  orcid: "https://orcid.org/0000-0003-2544-9480"
doi: 10.5281/zenodo.13323298
message: If you use this software, please cite our article in the
  Journal of Open Source Software.
preferred-citation:
  authors:
  - family-names: Martin
    given-names: Steve
    orcid: "https://orcid.org/0000-0003-2544-9480"
  date-published: 2024-09-06
  doi: 10.21105/joss.06781
  issn: 2475-9066
  issue: 101
  journal: Journal of Open Source Software
  publisher:
    name: Open Journals
  start: 6781
  title: "piar: Price Index Aggregation in R"
  type: article
  url: "https://joss.theoj.org/papers/10.21105/joss.06781"
  volume: 9
title: "piar: Price Index Aggregation in R"

GitHub Events

Total
  • Create event: 4
  • Release event: 1
  • Issues event: 44
  • Watch event: 1
  • Issue comment event: 6
  • Push event: 98
  • Pull request event: 15
Last Year
  • Create event: 4
  • Release event: 1
  • Issues event: 44
  • Watch event: 1
  • Issue comment event: 6
  • Push event: 98
  • Pull request event: 15

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 392
  • Total Committers: 1
  • Avg Commits per committer: 392.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 75
  • Committers: 1
  • Avg Commits per committer: 75.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Steve Martin s****1@g****m 392

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 45
  • Total pull requests: 24
  • Average time to close issues: 13 days
  • Average time to close pull requests: about 4 hours
  • Total issue authors: 3
  • Total pull request authors: 1
  • Average comments per issue: 0.98
  • Average comments per pull request: 0.21
  • Merged pull requests: 22
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 33
  • Pull requests: 24
  • Average time to close issues: 4 days
  • Average time to close pull requests: about 4 hours
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.06
  • Average comments per pull request: 0.21
  • Merged pull requests: 22
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • marberts (39)
  • schneiderpy (6)
  • realxinzhao (1)
Pull Request Authors
  • marberts (25)
Top Labels
Issue Labels
enhancement (21) documentation (9) bug (7) needs further thought (7) internals (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 327 last-month
  • Total dependent packages: 1
  • Total dependent repositories: 1
  • Total versions: 7
  • Total maintainers: 1
cran.r-project.org: piar

Price Index Aggregation

  • Versions: 7
  • Dependent Packages: 1
  • Dependent Repositories: 1
  • Downloads: 327 Last month
Rankings
Dependent packages count: 18.1%
Dependent repos count: 23.8%
Average: 26.2%
Forks count: 27.7%
Downloads: 30.4%
Stargazers count: 30.8%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.5 depends
  • gpindex >= 0.4.2 imports
  • stats * imports
  • utils * imports
  • knitr * suggests
  • rmarkdown * suggests
  • sps * suggests