{"id":26630807,"url":"https://github.com/marberts/gpindex","last_synced_at":"2025-04-10T17:06:56.393Z","repository":{"id":56934188,"uuid":"261861375","full_name":"marberts/gpindex","owner":"marberts","description":"An R package for calculating generalized price and quantity indexes","archived":false,"fork":false,"pushed_at":"2025-03-14T02:46:27.000Z","size":12265,"stargazers_count":7,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T14:21:23.290Z","etag":null,"topics":["cran","economics","inflation","official-statistics","r","r-package","rstats","statistics"],"latest_commit_sha":null,"homepage":"https://marberts.github.io/gpindex/","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":"NEWS.md","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":"2020-05-06T19:38:57.000Z","updated_at":"2025-03-14T02:44:54.000Z","dependencies_parsed_at":"2023-10-12T13:35:04.511Z","dependency_job_id":"1b38da1e-3181-4045-b394-59e89f4fdf85","html_url":"https://github.com/marberts/gpindex","commit_stats":{"total_commits":339,"total_committers":2,"mean_commits":169.5,"dds":0.01179941002949858,"last_synced_commit":"c9eb65e65dea2292fc9b1c1c44f5047c1e088368"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marberts%2Fgpindex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marberts%2Fgpindex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marberts%2Fgpindex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marberts%2Fgpindex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marberts","download_url":"https://codeload.github.com/marberts/gpindex/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248260614,"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:21:18.251Z","updated_at":"2025-04-10T17:06:56.374Z","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# Generalized Price and Quantity Indexes \u003ca href=\"https://marberts.github.io/gpindex/\"\u003e\u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"139\" alt=\"gpindex website\" /\u003e\u003c/a\u003e\n\n\u003c!-- badges: start --\u003e\n[![CRAN status](https://www.r-pkg.org/badges/version/gpindex)](https://cran.r-project.org/package=gpindex)\n[![gpindex status badge](https://marberts.r-universe.dev/badges/gpindex)](https://marberts.r-universe.dev/gpindex)\n[![Conda Version](https://img.shields.io/conda/vn/conda-forge/r-gpindex.svg)](https://anaconda.org/conda-forge/r-gpindex)\n[![R-CMD-check](https://github.com/marberts/gpindex/workflows/R-CMD-check/badge.svg)](https://github.com/marberts/gpindex/actions)\n[![codecov](https://codecov.io/gh/marberts/gpindex/graph/badge.svg?token=TL7V9QO0BH)](https://app.codecov.io/gh/marberts/gpindex)\n[![DOI](https://zenodo.org/badge/261861375.svg)](https://zenodo.org/doi/10.5281/zenodo.10097742)\n\u003c!-- badges: end --\u003e\n\nTools to build and work with bilateral generalized-mean price indexes (and by extension quantity indexes), and indexes composed of generalized-mean indexes (e.g., superlative quadratic-mean indexes, GEKS). Covers the core mathematical machinery for making bilateral price indexes, computing price relatives, detecting outliers, and decomposing indexes, with wrappers for all common (and many uncommon) index-number formulas. Implements and extends many of the methods in Balk (2008), von der Lippe (2007), and the CPI manual (2020).\n\n## Installation\n\nGet the stable release from CRAN.\n\n```{r, eval = FALSE}\ninstall.packages(\"gpindex\")\n```\n\nThe development version can be installed from R-Universe\n\n```{r, eval = FALSE}\ninstall.packages(\"gpindex\", 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/gpindex\")\n```\n\n## Usage\n\n```{r}\nlibrary(gpindex)\n\n# Start with some data on prices and quantities for 6 products\n# over 5 periods\nprice6\nquantity6\n\n# We'll only need prices and quantities for a few periods\np0 \u003c- price6[[1]]\np1 \u003c- price6[[2]]\np2 \u003c- price6[[3]]\nq0 \u003c- price6[[1]]\nq1 \u003c- price6[[2]]\n\n# There are functions to calculate all common price indexes,\n# like the Laspeyres and Paasche index\nlaspeyres_index(p1, p0, q0)\npaasche_index(p1, p0, q1)\n\n# The underlying mean functions are also available, as usually\n# only price relatives and weights are known\ns0 \u003c- p0 * q0\ns1 \u003c- p1 * q1\n\narithmetic_mean(p1 / p0, s0)\nharmonic_mean(p1 / p0, s1)\n\n# The mean representation of a Laspeyres index makes it easy to\n# chain by price-updating the weights\nlaspeyres_index(p2, p0, q0)\n\narithmetic_mean(p1 / p0, s0) *\n  arithmetic_mean(p2 / p1, update_weights(p1 / p0, s0))\n\n# The mean representation of a Paasche index makes it easy to\n# calculate percent-change contributions\nharmonic_contributions(p1 / p0, s1)\n\n# The ideas are the same for more exotic indexes,\n# like the Lloyd-Moulton index\n\n# Let's start by making some functions for the Lloyd-Moulton index\n# when the elasticity of substitution is -1 (an output index)\nlloyd_moulton \u003c- lm_index(-1)\nquadratic_mean \u003c- generalized_mean(2)\nquadratic_update \u003c- factor_weights(2)\nquadratic_contributions \u003c- contributions(2)\n\n# This index can be calculated as a mean of price relatives\nlloyd_moulton(p1, p0, q0)\nquadratic_mean(p1 / p0, s0)\n\n# Chained over time\nlloyd_moulton(p2, p0, q0)\nquadratic_mean(p1 / p0, s0) *\n  quadratic_mean(p2 / p1, quadratic_update(p1 / p0, s0))\n\n# And decomposed to get the contributions of each relative\nquadratic_contributions(p1 / p0, s0)\n```\n\n## Prior work\n\nThere are a number of R packages on the CRAN that implement the standard index-number formulas (e.g., **IndexNumber**, **productivity**, **IndexNumR**, **micEconIndex**, **PriceIndices**). While there is support for a large number of index-number formulas out-of-the box in this package, the focus is on the tools to easily make and work with any type of generalized-mean price index. Consequently, compared to existing packages, this package is suitable for building custom price/quantity indexes, calculating indexes with sample data, decomposing indexes, and learning about or researching different types of index-number formulas.\n\n## References\n\nBalk, B. M. (2008). *Price and Quantity Index Numbers*. Cambridge University Press.\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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarberts%2Fgpindex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarberts%2Fgpindex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarberts%2Fgpindex/lists"}