{"id":26631171,"url":"https://github.com/marberts/piar","last_synced_at":"2025-07-25T09:33:47.473Z","repository":{"id":56934124,"uuid":"370889275","full_name":"marberts/piar","owner":"marberts","description":"Price index aggregation in R","archived":false,"fork":false,"pushed_at":"2024-05-06T13:46:21.000Z","size":9477,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-07T04:29:44.120Z","etag":null,"topics":["cran","economics","inflation","official-statistics","r","r-package","rstats","statistics"],"latest_commit_sha":null,"homepage":"https://marberts.github.io/piar/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marberts.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-26T02:58:35.000Z","updated_at":"2024-05-30T06:09:10.000Z","dependencies_parsed_at":"2022-08-21T00:40:29.195Z","dependency_job_id":"447e1d7b-0343-4842-b88b-fead284a73ee","html_url":"https://github.com/marberts/piar","commit_stats":{"total_commits":232,"total_committers":2,"mean_commits":116.0,"dds":0.008620689655172376,"last_synced_commit":"37a0f11b64b38d1024cb29eadd9545bd2d622018"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marberts%2Fpiar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marberts%2Fpiar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marberts%2Fpiar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marberts%2Fpiar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marberts","download_url":"https://codeload.github.com/marberts/piar/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248260611,"owners_count":21074214,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cran","economics","inflation","official-statistics","r","r-package","rstats","statistics"],"created_at":"2025-03-24T14:49:34.660Z","updated_at":"2025-04-10T17:06:56.328Z","avatar_url":"https://github.com/marberts.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file. --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  out.width = \"100%\"\n)\n```\n\n# Price Index Aggregation in R \u003ca href=\"https://marberts.github.io/piar/\"\u003e\u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"139\" alt=\"piar website\" /\u003e\u003c/a\u003e\n\n\u003c!-- badges: start --\u003e\n[![CRAN status](https://www.r-pkg.org/badges/version/piar)](https://cran.r-project.org/package=piar)\n[![piar status badge](https://marberts.r-universe.dev/badges/piar)](https://marberts.r-universe.dev/piar)\n[![Conda Version](https://img.shields.io/conda/vn/conda-forge/r-piar.svg)](https://anaconda.org/conda-forge/r-piar)\n[![R-CMD-check](https://github.com/marberts/piar/workflows/R-CMD-check/badge.svg)](https://github.com/marberts/piar/actions)\n[![codecov](https://codecov.io/gh/marberts/piar/graph/badge.svg?token=lHDHsGHsLd)](https://app.codecov.io/gh/marberts/piar)\n[![DOI](https://zenodo.org/badge/370889275.svg)](https://zenodo.org/doi/10.5281/zenodo.10110046)\n[![Mentioned in Awesome Official Statistics ](https://awesome.re/mentioned-badge.svg)](https://github.com/SNStatComp/awesome-official-statistics-software)\n[![DOI](https://joss.theoj.org/papers/10.21105/joss.06781/status.svg)](https://doi.org/10.21105/joss.06781)\n\u003c!-- badges: end --\u003e\n\nMost 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.\n\nThe tools in this package are designed to be useful for both researching new\nsources of data and methods to construct price indexes, and the regular\nproduction of price statistics. It is targeted towards economists,\nstatisticians, and data scientists working at national statistical agencies,\ncentral banks, financial institutions, and in academia that want to measure and\nstudy the evolution of prices over time.\n\n## Installation\n\nGet the stable version from CRAN.\n\n```{r, eval=FALSE}\ninstall.packages(\"piar\")\n```\n\nThe development version can be installed from R-Universe\n\n```{r, eval=FALSE}\ninstall.packages(\"piar\", repos = c(\"https://marberts.r-universe.dev\", \"https://cloud.r-project.org\"))\n```\n\nor directly from Github.\n\n```{r, eval=FALSE}\npak::pak(\"marberts/piar\")\n```\n\n## Usage\n\nThere are several detailed vignette showing how to use **piar**: `browseVignettes(\"piar\")`. But the basic work flow is fairly simple. \n\nThe starting point is to make period-over-period elemental price indexes with the `elemental_index()` function.\n\n```{r}\nlibrary(piar)\n\n# Make Jevons business-level elemental indexes\n\nhead(ms_prices)\n\nelementals \u003c- ms_prices |\u003e\n  transform(\n    relative = price_relative(price, period = period, product = product)\n  ) |\u003e\n  elemental_index(relative ~ period + business, na.rm = TRUE)\n\nelementals\n```\n\nAnd an aggregation structure.\n\n```{r}\n# Make an aggregation structure from businesses to higher-level\n# industrial classifications\n\nms_weights\n\nms_weights[c(\"level1\", \"level2\")] \u003c-\n  expand_classification(ms_weights$classification)\n\npias \u003c- ms_weights[c(\"level1\", \"level2\", \"business\", \"weight\")]\n\npias\n```\n\nThe `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.\n\n```{r}\n# Aggregate elemental indexes with an arithmetic index\n\nindex \u003c- aggregate(elementals, pias, na.rm = TRUE)\n\n# Chain them to get a time series\n\nchain(index)\n```\n\n## Contributing\n\nAll contributions are welcome. Please start by opening an issue on GitHub to report any bugs or suggest improvements and new features. See the contribution \nguidelines for this project for more information.\n\n## References\n\nBalk, B. M. (2008). *Price and Quantity Index Numbers*. Cambridge University Press.\n\nChiru, 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.\n\nILO, IMF, UNECE, OECD, and World Bank. (2004). *Producer Price Index Manual: Theory and Practice*. International Monetary Fund.\n\nIMF, ILO, Eurostat, UNECE, OECD, and World Bank. (2020). *Consumer Price Index Manual: Concepts and Methods*. International Monetary Fund.\n\nvon der Lippe, P. (2007). *Index Theory and Price Statistics*. Peter Lang.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarberts%2Fpiar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarberts%2Fpiar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarberts%2Fpiar/lists"}