docs/HEI.md

What Is HEI?

The Healthy Eating Index (HEI) is developed by NIH's National Cancer Institute (NCI). It calculates a score that represents the quality of one's diet. There are several versions of the scoring system and the latest is HEI-2015. It calculates 9 adequacy components and 4 moderation components with a combined score that ranges from 0 to 100, where higher scores indicate higher quality.

How to Score Your Data in R?

To calculate HEI, it is necesary to estimate the intake of the above-mentioned 13 food components. One approach is to conduct a 24-hour recall (24HR) interview in which subjects report what they ate on their typical days. Such entries are entered into a database, and nutrients are calculated using a propriety software known as Nutrition Data System for Research (NDSR).

Step 1. Prepare the Data

The NDSR database provides several output files, and we shall only need the "File 04" and "File 09" (see NDSR User Manual). We assume both files are tab delimited with variable names in the first line. No special processing is needed.

Step 2. Run the Scoring Code

To calculate HEI using NDSR output, SAS code and full documentation and are available here.

While there are multiple versions possible for the data and NDSR software version, our assumption is to calculate the HEI-2015 scores per person when multiple days of intake data are available for each person and the data were collected in NDSR 2013 or subsequent version. The corresponding SAS code we followed is here. Our package provides an implementation in R. Despite a different programming language, we followed its variable naming convention as closely as possible.

You can run the following code to produce the HEI scores, as well as other variables of interest:

data_scored <- HEI_Scores(ID="Participant.ID",
                          DateVar="Date.of.Intake",
                          file4="file04.txt",
                          file9="file09.txt")

By default, the output data frame data_scored will include the ID and the computed variables.

Example

Input and Output

"rikcal","rina","riwholegrains","rirefinedgrains", "rias_ts","risfa","rimfa","ripfa","ripctsfa","water"

HEI Output Variables

Our NDSR to HEI scoring code will output the following variables in one data frame.

First, the HEI component and total scores:

Then, the intake variables extracted from NDSR:

Finally, the energy adjusted HEI component intake variables:



wzhou7/Fruved documentation built on June 15, 2025, 1:16 a.m.