calculate_market_basket: Compute market basket cost at a store

View source: R/nems_s.R

calculate_market_basketR Documentation

Compute market basket cost at a store

Description

Compute market basket cost at a store

Usage

calculate_market_basket(nems_data)

Arguments

nems_data

A dataframe or tibble containing one row per store, cleaned from raw qualtrics survey data with the read_nemss function

Details

This function applies the market basket outline found in the [Thrifty Food Plan, 2021](https://fns-prod.azureedge.us/sites/default/files/resource-files/TFP2021.pdf) Some adjustments needed to be made because the NEMS-S survey is mostly focused on the availability of low-calorie and low-fat options, and the market basket is based more on the price of observed consumer purchases. For example, the market basket includes a certain amount of poultry, but because low-fat poultry is not really a thing in the way that lean beef is, the NEMS-S instrument does not collect the price of poultry.

Additionally, if a price was not available, we replaced it with the average price for all stores in the dataset.

One score that the NEMS-S tool on its own does not contain is a straightforward way to compute the affordability of groceries; we therefore created a market basket-based affordability measure that could be compared across stores. This market basket score was created using the USDA 2021 Thrifty Food Plan. In the Food Plan it contains a Market Basket for a reference family of four. We used amount values from the Thrifty Food Plan and multiplied by the price of the good in the store. Because this market basket contained more (and sometimes different) items than what we had data on, we chose relevant items from our NEMS-S data and used those amounts to create the market basket such as replacing chicken in the market basket with ground beef. For example, the market basket calls for 6.7 pounds of whole grain staples and 5.65 pounds of refined grain staples. We used those pounds values for amounts of whole bread and white bread. For any stores that were missing any of the ingredients for the market basket, we tried to substitute with any other ingredient that would fit the requirements, and if that did not work, we substituted with the average price across stores multiplied by 1.5 as a penalty for not containing the product. The final market basket score is the total cost of all foods in the market basket.

Value

A tibble containing the weighted price for several types of goods including dairy, grain, etc. An additional column is appended with the number of replacements with mean values that had to be made in each type. A 'total' column contains the cost of filling the market basket in that store.

Examples

calculate_market_basket(nems_sample)


byu-transpolab/nemsr documentation built on Feb. 10, 2023, 11:24 p.m.