Declarative Nutritional Knowledge Scores and Their Effect on Accurate Macro Nutrient Evaluation in Foods Consumed on Binghamton University’s Campus

Author
Affiliation

Anna Vishnevetsky

Published

November 6, 2025

Abstract

Obesity has long been a problem in the United States, with obesity rates increasing exponentially over the last twenty years. A factor contributing to the rising obesity rate can be attributed to a lack of consumer nutritional knowledge. Specifically, because if consumers are unaware of the adverse health effects of the foods they consume, they are more likely to consume an excess of unhealthy and fattening foods. This problem is especially prevalent among college students, as they are just entering adulthood and forming lifelong dietary habits. This study aims to examine the relationship between college students’ declarative nutritional knowledge and their practical knowledge of the dietary quality of food items in the university dining hall. The question this study aims to answer is whether there is an association between declarative nutritional knowledge and nutrition accuracy scores for dining hall foods consumed daily by students. Data was collected from a convenience sample from campus tabling, distribution of flyers, and in-class recruitment. This data was then analyzed using a Pearson correlation test and simple linear regression in R. Similar to some of the inconsistent results yielded in similar studies discussed throughout this paper, the test showed no statistically significant correlation between declarative nutritional knowledge and nutritional accuracy scores. However, it would be difficult to generalize the results of this study because of the limited sample (exclusively Binghamton University students). It could, however, demonstrate the positive effect of nutritional knowledge on college students’ awareness of the dietary quality of the foods they eat daily.

Keywords

obesity, nutrition, declarative knowledge, college student, college dining

1 Results

##Load

library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.4
✔ forcats   1.0.0     ✔ stringr   1.5.0
✔ ggplot2   4.0.0     ✔ tibble    3.2.1
✔ lubridate 1.9.2     ✔ tidyr     1.3.0
✔ purrr     1.0.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(psych)

Attaching package: 'psych'

The following objects are masked from 'package:ggplot2':

    %+%, alpha
library(knitr)
library(tibble)
library(dplyr)
library(tidyr)
library(ggplot2)
library(hexbin)
library(scales)     # for number formatting like comma()

Attaching package: 'scales'

The following objects are masked from 'package:psych':

    alpha, rescale

The following object is masked from 'package:purrr':

    discard

The following object is masked from 'package:readr':

    col_factor
library(english)    # to convert numbers to words

Attaching package: 'english'

The following object is masked from 'package:scales':

    ordinal
library(stringr)    # for text functions like str_c()
library(NHANES)
library(haven)
library(readxl)
# source: (Hei & McCarty, 2025) https://shanemccarty.github.io/FRIplaybook/import-once.html 
library(readxl)

##IMPORT

library(readxl)
library(dplyr)
primary_data <- read_excel("/cloud/project/10.20.2025.perceptiondata.team5.clean.xlsx", col_names = TRUE)
# source:  (Hei & McCarty, 2025) https://shanemccarty.github.io/FRIplaybook/import-once.html 
# explanation: import perceptions survey data as data frame primary_data
primary_data[primary_data == -99] <- NA
head(primary_data, 10)
# A tibble: 10 × 143
   StartDate           EndDate             Status IPAddress       Progress
   <dttm>              <dttm>               <dbl> <chr>              <dbl>
 1 NA                  NA                      NA <NA>                  NA
 2 2025-10-01 11:08:40 2025-10-01 11:15:05      0 149.125.187.238      100
 3 2025-10-01 11:28:22 2025-10-01 11:39:49      0 174.254.255.221      100
 4 2025-10-01 11:50:07 2025-10-01 11:50:19      0 172.59.177.124       100
 5 2025-10-01 11:48:30 2025-10-01 11:50:28      0 172.59.177.124       100
 6 2025-10-01 11:38:50 2025-10-01 11:51:45      0 74.254.78.49         100
 7 2025-10-01 11:41:56 2025-10-01 11:53:54      0 149.125.86.214       100
 8 2025-10-01 11:55:57 2025-10-01 12:04:56      0 149.125.51.245       100
 9 2025-10-01 11:52:59 2025-10-01 12:07:43      0 174.254.252.174      100
10 2025-10-01 12:42:10 2025-10-01 12:51:48      0 104.28.55.254        100
# ℹ 138 more variables: `Duration (in seconds)` <dbl>, Finished <dbl>,
#   RecordedDate <dttm>, ResponseId <chr>, RecipientLastName <lgl>,
#   RecipientFirstName <lgl>, RecipientEmail <lgl>, ExternalReference <lgl>,
#   LocationLatitude <dbl>, LocationLongitude <dbl>, DistributionChannel <chr>,
#   UserLanguage <chr>, Q_RecaptchaScore <dbl>, CONSENT <dbl>,
#   AFFILIATION <dbl>, MEAL_PLAN <dbl>, `MEAL_PLAN_-50_TEXT` <lgl>,
#   VEGGIE_PARTICIPATION <dbl>, PASSWORD <chr>, UNHEALTHY_QUAL <chr>, …
names(primary_data)
  [1] "StartDate"               "EndDate"                
  [3] "Status"                  "IPAddress"              
  [5] "Progress"                "Duration (in seconds)"  
  [7] "Finished"                "RecordedDate"           
  [9] "ResponseId"              "RecipientLastName"      
 [11] "RecipientFirstName"      "RecipientEmail"         
 [13] "ExternalReference"       "LocationLatitude"       
 [15] "LocationLongitude"       "DistributionChannel"    
 [17] "UserLanguage"            "Q_RecaptchaScore"       
 [19] "CONSENT"                 "AFFILIATION"            
 [21] "MEAL_PLAN"               "MEAL_PLAN_-50_TEXT"     
 [23] "VEGGIE_PARTICIPATION"    "PASSWORD"               
 [25] "UNHEALTHY_QUAL"          "HEALTHY_QUAL"           
 [27] "DECISION_QUAL"           "CHOICES_QUAL"           
 [29] "DINING"                  "HEALTHY"                
 [31] "KNOW1"                   "KNOW2"                  
 [33] "KNOW3"                   "KNOW4"                  
 [35] "KNOW5"                   "KNOW6"                  
 [37] "KNOW7"                   "KNOW8"                  
 [39] "NOVA_ACCURACY_0_GROUP"   "NOVA_ACCURACY_1_GROUP"  
 [41] "NOVA_ACCURACY_2_GROUP"   "NOVA_ACCURACY_3_GROUP"  
 [43] "NOVA_ACCURACY_4_GROUP"   "NOVA_ACCURACY_0_1_RANK" 
 [45] "NOVA_ACCURACY_0_4_RANK"  "NOVA_ACCURACY_0_5_RANK" 
 [47] "NOVA_ACCURACY_0_6_RANK"  "NOVA_ACCURACY_0_7_RANK" 
 [49] "NOVA_ACCURACY_0_8_RANK"  "NOVA_ACCURACY_0_9_RANK" 
 [51] "NOVA_ACCURACY_0_10_RANK" "NOVA_ACCURACY_0_13_RANK"
 [53] "NOVA_ACCURACY_1_1_RANK"  "NOVA_ACCURACY_1_4_RANK" 
 [55] "NOVA_ACCURACY_1_5_RANK"  "NOVA_ACCURACY_1_6_RANK" 
 [57] "NOVA_ACCURACY_1_7_RANK"  "NOVA_ACCURACY_1_8_RANK" 
 [59] "NOVA_ACCURACY_1_9_RANK"  "NOVA_ACCURACY_1_10_RANK"
 [61] "NOVA_ACCURACY_1_13_RANK" "NOVA_ACCURACY_2_1_RANK" 
 [63] "NOVA_ACCURACY_2_4_RANK"  "NOVA_ACCURACY_2_5_RANK" 
 [65] "NOVA_ACCURACY_2_6_RANK"  "NOVA_ACCURACY_2_7_RANK" 
 [67] "NOVA_ACCURACY_2_8_RANK"  "NOVA_ACCURACY_2_9_RANK" 
 [69] "NOVA_ACCURACY_2_10_RANK" "NOVA_ACCURACY_2_13_RANK"
 [71] "NOVA_ACCURACY_3_1_RANK"  "NOVA_ACCURACY_3_4_RANK" 
 [73] "NOVA_ACCURACY_3_5_RANK"  "NOVA_ACCURACY_3_6_RANK" 
 [75] "NOVA_ACCURACY_3_7_RANK"  "NOVA_ACCURACY_3_8_RANK" 
 [77] "NOVA_ACCURACY_3_9_RANK"  "NOVA_ACCURACY_3_10_RANK"
 [79] "NOVA_ACCURACY_3_13_RANK" "NOVA_ACCURACY_4_1_RANK" 
 [81] "NOVA_ACCURACY_4_4_RANK"  "NOVA_ACCURACY_4_5_RANK" 
 [83] "NOVA_ACCURACY_4_6_RANK"  "NOVA_ACCURACY_4_7_RANK" 
 [85] "NOVA_ACCURACY_4_8_RANK"  "NOVA_ACCURACY_4_9_RANK" 
 [87] "NOVA_ACCURACY_4_10_RANK" "NOVA_ACCURACY_4_13_RANK"
 [89] "CALORIES_1"              "CALORIES_2"             
 [91] "CALORIES_3"              "CALORIES_4"             
 [93] "CALORIES_5"              "CALORIES_6"             
 [95] "CALORIES_7"              "CALORIES_8"             
 [97] "CALORIES_9"              "SATFAT_1"               
 [99] "SATFAT_2"                "SATFAT_3"               
[101] "SATFAT_4"                "SATFAT_5"               
[103] "SATFAT_6"                "SATFAT_7"               
[105] "SATFAT_8"                "SATFAT_9"               
[107] "CARBS_1"                 "CARBS_2"                
[109] "CARBS_3"                 "CARBS_4"                
[111] "CARBS_5"                 "CARBS_6"                
[113] "CARBS_7"                 "CARBS_8"                
[115] "CARBS_9"                 "SUGAR_1"                
[117] "SUGAR_2"                 "SUGAR_3"                
[119] "SUGAR_4"                 "SUGAR_5"                
[121] "SUGAR_6"                 "SUGAR_7"                
[123] "SUGAR_8"                 "SUGAR_9"                
[125] "PROTEIN_1"               "PROTEIN_2"              
[127] "PROTEIN_3"               "PROTEIN_4"              
[129] "PROTEIN_5"               "PROTEIN_6"              
[131] "PROTEIN_7"               "PROTEIN_8"              
[133] "PROTEIN_9"               "ILLNESS_1"              
[135] "AGE"                     "HEALTHSTATUS"           
[137] "HOPE"                    "ANXIETY"                
[139] "GENDER"                  "RACIALIZED"             
[141] "RACIALIZED_8_TEXT"       "SOCIALSTATUS"           
[143] "INCOME"                 
summary(primary_data)
   StartDate                         EndDate                           Status 
 Min.   :2025-09-26 13:34:04.00   Min.   :2025-09-26 13:57:36.00   Min.   :0  
 1st Qu.:2025-10-03 12:11:36.50   1st Qu.:2025-10-03 12:21:32.50   1st Qu.:0  
 Median :2025-10-08 13:24:48.00   Median :2025-10-08 13:27:30.00   Median :0  
 Mean   :2025-10-08 13:34:56.26   Mean   :2025-10-08 13:57:32.34   Mean   :0  
 3rd Qu.:2025-10-13 13:05:30.50   3rd Qu.:2025-10-13 13:16:45.00   3rd Qu.:0  
 Max.   :2025-10-19 00:06:38.00   Max.   :2025-10-19 00:29:46.00   Max.   :0  
 NA's   :1                        NA's   :1                        NA's   :1  
  IPAddress            Progress      Duration (in seconds)    Finished     
 Length:188         Min.   :  3.00   Min.   :    5.0       Min.   :0.0000  
 Class :character   1st Qu.: 16.00   1st Qu.:   23.0       1st Qu.:0.0000  
 Mode  :character   Median :100.00   Median :  124.0       Median :1.0000  
                    Mean   : 70.88   Mean   : 1355.5       Mean   :0.6364  
                    3rd Qu.:100.00   3rd Qu.:  778.5       3rd Qu.:1.0000  
                    Max.   :100.00   Max.   :80341.0       Max.   :1.0000  
                    NA's   :1        NA's   :1             NA's   :1       
  RecordedDate                     ResponseId        RecipientLastName
 Min.   :2025-10-01 11:15:05.98   Length:188         Mode:logical     
 1st Qu.:2025-10-08 12:42:28.44   Class :character   NA's:188         
 Median :2025-10-10 14:03:43.45   Mode  :character                    
 Mean   :2025-10-11 03:03:06.03                                       
 3rd Qu.:2025-10-15 14:45:23.24                                       
 Max.   :2025-10-19 11:36:44.72                                       
 NA's   :1                                                            
 RecipientFirstName RecipientEmail ExternalReference LocationLatitude
 Mode:logical       Mode:logical   Mode:logical      Min.   :39.95   
 NA's:188           NA's:188       NA's:188          1st Qu.:40.77   
                                                     Median :41.53   
                                                     Mean   :41.60   
                                                     3rd Qu.:42.10   
                                                     Max.   :43.18   
                                                     NA's   :1       
 LocationLongitude DistributionChannel UserLanguage       Q_RecaptchaScore
 Min.   :-76.22    Length:188          Length:188         Min.   :0.4000  
 1st Qu.:-75.89    Class :character    Class :character   1st Qu.:1.0000  
 Median :-74.05    Mode  :character    Mode  :character   Median :1.0000  
 Mean   :-74.73                                           Mean   :0.9775  
 3rd Qu.:-73.90                                           3rd Qu.:1.0000  
 Max.   :-71.06                                           Max.   :1.0000  
 NA's   :1                                                NA's   :1       
    CONSENT        AFFILIATION      MEAL_PLAN      MEAL_PLAN_-50_TEXT
 Min.   :0.0000   Min.   :1.000   Min.   :-50.00   Mode:logical      
 1st Qu.:1.0000   1st Qu.:1.000   1st Qu.:  3.00   NA's:188          
 Median :1.0000   Median :1.000   Median :  3.00                     
 Mean   :0.9462   Mean   :1.382   Mean   :  1.36                     
 3rd Qu.:1.0000   3rd Qu.:1.000   3rd Qu.:  6.00                     
 Max.   :1.0000   Max.   :5.000   Max.   :  9.00                     
 NA's   :2        NA's   :18      NA's   :63                         
 VEGGIE_PARTICIPATION   PASSWORD         UNHEALTHY_QUAL     HEALTHY_QUAL      
 Min.   :0.0000       Length:188         Length:188         Length:188        
 1st Qu.:1.0000       Class :character   Class :character   Class :character  
 Median :1.0000       Mode  :character   Mode  :character   Mode  :character  
 Mean   :0.9278                                                               
 3rd Qu.:1.0000                                                               
 Max.   :1.0000                                                               
 NA's   :91                                                                   
 DECISION_QUAL      CHOICES_QUAL           DINING         HEALTHY     
 Length:188         Length:188         Min.   :1.000   Min.   :1.000  
 Class :character   Class :character   1st Qu.:2.000   1st Qu.:1.000  
 Mode  :character   Mode  :character   Median :2.000   Median :2.000  
                                       Mean   :2.036   Mean   :1.929  
                                       3rd Qu.:2.000   3rd Qu.:2.000  
                                       Max.   :4.000   Max.   :4.000  
                                       NA's   :160     NA's   :160    
     KNOW1            KNOW2            KNOW3            KNOW4       
 Min.   :0.0000   Min.   :0.0000   Min.   :0.0000   Min.   :0.0000  
 1st Qu.:0.0000   1st Qu.:1.0000   1st Qu.:1.0000   1st Qu.:1.0000  
 Median :0.0000   Median :1.0000   Median :1.0000   Median :1.0000  
 Mean   :0.3671   Mean   :0.7975   Mean   :0.9747   Mean   :0.9241  
 3rd Qu.:1.0000   3rd Qu.:1.0000   3rd Qu.:1.0000   3rd Qu.:1.0000  
 Max.   :1.0000   Max.   :1.0000   Max.   :1.0000   Max.   :1.0000  
 NA's   :109      NA's   :109      NA's   :109      NA's   :109     
     KNOW5            KNOW6            KNOW7            KNOW8       
 Min.   :0.0000   Min.   :0.0000   Min.   :0.0000   Min.   :0.0000  
 1st Qu.:0.0000   1st Qu.:1.0000   1st Qu.:1.0000   1st Qu.:1.0000  
 Median :1.0000   Median :1.0000   Median :1.0000   Median :1.0000  
 Mean   :0.6835   Mean   :0.8861   Mean   :0.9241   Mean   :0.8481  
 3rd Qu.:1.0000   3rd Qu.:1.0000   3rd Qu.:1.0000   3rd Qu.:1.0000  
 Max.   :1.0000   Max.   :1.0000   Max.   :1.0000   Max.   :1.0000  
 NA's   :109      NA's   :109      NA's   :109      NA's   :109     
 NOVA_ACCURACY_0_GROUP NOVA_ACCURACY_1_GROUP NOVA_ACCURACY_2_GROUP
 Length:188            Length:188            Length:188           
 Class :character      Class :character      Class :character     
 Mode  :character      Mode  :character      Mode  :character     
                                                                  
                                                                  
                                                                  
                                                                  
 NOVA_ACCURACY_3_GROUP NOVA_ACCURACY_4_GROUP NOVA_ACCURACY_0_1_RANK
 Length:188            Length:188            Min.   :1.000         
 Class :character      Class :character      1st Qu.:1.500         
 Mode  :character      Mode  :character      Median :2.000         
                                             Mean   :1.667         
                                             3rd Qu.:2.000         
                                             Max.   :2.000         
                                             NA's   :185           
 NOVA_ACCURACY_0_4_RANK NOVA_ACCURACY_0_5_RANK NOVA_ACCURACY_0_6_RANK
 Min.   :1.000          Min.   :1.0            Min.   :1.000         
 1st Qu.:1.000          1st Qu.:1.5            1st Qu.:2.000         
 Median :2.000          Median :2.0            Median :3.000         
 Mean   :2.286          Mean   :2.0            Mean   :3.097         
 3rd Qu.:3.000          3rd Qu.:2.5            3rd Qu.:4.000         
 Max.   :5.000          Max.   :3.0            Max.   :6.000         
 NA's   :167            NA's   :186            NA's   :157           
 NOVA_ACCURACY_0_7_RANK NOVA_ACCURACY_0_8_RANK NOVA_ACCURACY_0_9_RANK
 Min.   :1.00           Min.   :1.00           Min.   :1.000         
 1st Qu.:1.00           1st Qu.:1.00           1st Qu.:2.000         
 Median :2.00           Median :2.00           Median :3.000         
 Mean   :2.30           Mean   :2.22           Mean   :3.222         
 3rd Qu.:2.75           3rd Qu.:3.00           3rd Qu.:5.000         
 Max.   :8.00           Max.   :7.00           Max.   :5.000         
 NA's   :158            NA's   :138            NA's   :179           
 NOVA_ACCURACY_0_10_RANK NOVA_ACCURACY_0_13_RANK NOVA_ACCURACY_1_1_RANK
 Min.   :1.000           Min.   :1.000           Min.   :1.000         
 1st Qu.:1.000           1st Qu.:2.500           1st Qu.:1.500         
 Median :2.000           Median :3.000           Median :3.000         
 Mean   :2.244           Mean   :3.455           Mean   :2.947         
 3rd Qu.:3.000           3rd Qu.:4.500           3rd Qu.:4.000         
 Max.   :5.000           Max.   :6.000           Max.   :8.000         
 NA's   :143             NA's   :177             NA's   :169           
 NOVA_ACCURACY_1_4_RANK NOVA_ACCURACY_1_5_RANK NOVA_ACCURACY_1_6_RANK
 Min.   :1.000          Min.   :1.000          Min.   :1.0           
 1st Qu.:1.000          1st Qu.:1.750          1st Qu.:2.0           
 Median :2.000          Median :2.000          Median :2.0           
 Mean   :2.217          Mean   :2.833          Mean   :2.5           
 3rd Qu.:3.000          3rd Qu.:3.250          3rd Qu.:3.0           
 Max.   :6.000          Max.   :9.000          Max.   :6.0           
 NA's   :165            NA's   :176            NA's   :156           
 NOVA_ACCURACY_1_7_RANK NOVA_ACCURACY_1_8_RANK NOVA_ACCURACY_1_9_RANK
 Min.   :1.000          Min.   :1.000          Min.   :1.00          
 1st Qu.:1.000          1st Qu.:1.000          1st Qu.:1.00          
 Median :2.000          Median :1.500          Median :2.00          
 Mean   :2.533          Mean   :2.222          Mean   :2.45          
 3rd Qu.:3.750          3rd Qu.:2.750          3rd Qu.:3.00          
 Max.   :7.000          Max.   :6.000          Max.   :6.00          
 NA's   :158            NA's   :170            NA's   :168           
 NOVA_ACCURACY_1_10_RANK NOVA_ACCURACY_1_13_RANK NOVA_ACCURACY_2_1_RANK
 Min.   :1.000           Min.   :1.000           Min.   :1.000         
 1st Qu.:1.000           1st Qu.:1.000           1st Qu.:1.000         
 Median :3.000           Median :2.000           Median :2.000         
 Mean   :2.619           Mean   :2.316           Mean   :1.852         
 3rd Qu.:3.000           3rd Qu.:3.000           3rd Qu.:2.000         
 Max.   :8.000           Max.   :7.000           Max.   :5.000         
 NA's   :167             NA's   :150             NA's   :161           
 NOVA_ACCURACY_2_4_RANK NOVA_ACCURACY_2_5_RANK NOVA_ACCURACY_2_6_RANK
 Min.   :1.0            Min.   :1.000          Min.   :1             
 1st Qu.:1.0            1st Qu.:1.000          1st Qu.:1             
 Median :2.0            Median :2.000          Median :2             
 Mean   :2.4            Mean   :1.808          Mean   :2             
 3rd Qu.:3.0            3rd Qu.:2.000          3rd Qu.:3             
 Max.   :6.0            Max.   :4.000          Max.   :3             
 NA's   :168            NA's   :162            NA's   :183           
 NOVA_ACCURACY_2_7_RANK NOVA_ACCURACY_2_8_RANK NOVA_ACCURACY_2_9_RANK
 Min.   :1.000          Min.   :1.000          Min.   :1             
 1st Qu.:1.000          1st Qu.:1.000          1st Qu.:1             
 Median :2.000          Median :1.000          Median :2             
 Mean   :1.778          Mean   :1.667          Mean   :2             
 3rd Qu.:2.000          3rd Qu.:2.000          3rd Qu.:2             
 Max.   :3.000          Max.   :3.000          Max.   :5             
 NA's   :179            NA's   :185            NA's   :155           
 NOVA_ACCURACY_2_10_RANK NOVA_ACCURACY_2_13_RANK NOVA_ACCURACY_3_1_RANK
 Min.   :1               Min.   :1.000           Min.   :1.000         
 1st Qu.:1               1st Qu.:1.500           1st Qu.:1.000         
 Median :1               Median :2.000           Median :1.000         
 Mean   :1               Mean   :2.316           Mean   :1.273         
 3rd Qu.:1               3rd Qu.:3.000           3rd Qu.:1.750         
 Max.   :1               Max.   :4.000           Max.   :2.000         
 NA's   :184             NA's   :169             NA's   :166           
 NOVA_ACCURACY_3_4_RANK NOVA_ACCURACY_3_5_RANK NOVA_ACCURACY_3_6_RANK
 Min.   :1.000          Min.   :1.000          Min.   :3             
 1st Qu.:1.000          1st Qu.:1.000          1st Qu.:3             
 Median :1.500          Median :1.000          Median :3             
 Mean   :1.833          Mean   :1.452          Mean   :3             
 3rd Qu.:2.750          3rd Qu.:2.000          3rd Qu.:3             
 Max.   :3.000          Max.   :3.000          Max.   :3             
 NA's   :182            NA's   :157            NA's   :187           
 NOVA_ACCURACY_3_7_RANK NOVA_ACCURACY_3_8_RANK NOVA_ACCURACY_3_9_RANK
 Min.   :2              Mode:logical           Min.   :1.000         
 1st Qu.:2              NA's:188               1st Qu.:1.000         
 Median :2                                     Median :2.000         
 Mean   :2                                     Mean   :1.556         
 3rd Qu.:2                                     3rd Qu.:2.000         
 Max.   :2                                     Max.   :2.000         
 NA's   :187                                   NA's   :179           
 NOVA_ACCURACY_3_10_RANK NOVA_ACCURACY_3_13_RANK NOVA_ACCURACY_4_1_RANK
 Mode:logical            Min.   :1.0             Min.   :1             
 NA's:188                1st Qu.:1.5             1st Qu.:1             
                         Median :2.0             Median :1             
                         Mean   :2.0             Mean   :1             
                         3rd Qu.:2.5             3rd Qu.:1             
                         Max.   :3.0             Max.   :1             
                         NA's   :185             NA's   :187           
 NOVA_ACCURACY_4_4_RANK NOVA_ACCURACY_4_5_RANK NOVA_ACCURACY_4_6_RANK
 Min.   :3.0            Min.   :1              Min.   :1             
 1st Qu.:3.5            1st Qu.:1              1st Qu.:1             
 Median :4.0            Median :1              Median :1             
 Mean   :4.0            Mean   :1              Mean   :1             
 3rd Qu.:4.5            3rd Qu.:1              3rd Qu.:1             
 Max.   :5.0            Max.   :1              Max.   :1             
 NA's   :186            NA's   :187            NA's   :185           
 NOVA_ACCURACY_4_7_RANK NOVA_ACCURACY_4_8_RANK NOVA_ACCURACY_4_9_RANK
 Min.   :2.00           Min.   :6              Min.   :7             
 1st Qu.:2.25           1st Qu.:6              1st Qu.:7             
 Median :2.50           Median :6              Median :7             
 Mean   :2.50           Mean   :6              Mean   :7             
 3rd Qu.:2.75           3rd Qu.:6              3rd Qu.:7             
 Max.   :3.00           Max.   :6              Max.   :7             
 NA's   :186            NA's   :187            NA's   :187           
 NOVA_ACCURACY_4_10_RANK NOVA_ACCURACY_4_13_RANK   CALORIES_1   
 Min.   :2.0             Min.   :2               Min.   : 50.0  
 1st Qu.:2.5             1st Qu.:2               1st Qu.:102.0  
 Median :3.0             Median :2               Median :185.0  
 Mean   :3.0             Mean   :2               Mean   :191.3  
 3rd Qu.:3.5             3rd Qu.:2               3rd Qu.:251.5  
 Max.   :4.0             Max.   :2               Max.   :500.0  
 NA's   :186             NA's   :187             NA's   :117    
   CALORIES_2      CALORIES_3      CALORIES_4      CALORIES_5   
 Min.   : 23.0   Min.   : 31.0   Min.   : 20.0   Min.   : 21.0  
 1st Qu.: 97.5   1st Qu.:170.5   1st Qu.:100.0   1st Qu.:150.0  
 Median :139.0   Median :207.0   Median :132.0   Median :197.0  
 Mean   :142.9   Mean   :233.0   Mean   :142.8   Mean   :200.1  
 3rd Qu.:180.5   3rd Qu.:286.0   3rd Qu.:182.0   3rd Qu.:246.0  
 Max.   :342.0   Max.   :500.0   Max.   :334.0   Max.   :497.0  
 NA's   :117     NA's   :117     NA's   :117     NA's   :117    
   CALORIES_6       CALORIES_7      CALORIES_8      CALORIES_9   
 Min.   : 16.00   Min.   :129.0   Min.   : 19.0   Min.   : 30.0  
 1st Qu.: 59.00   1st Qu.:247.5   1st Qu.: 72.0   1st Qu.:135.0  
 Median : 90.00   Median :286.0   Median :105.0   Median :181.0  
 Mean   : 99.69   Mean   :298.6   Mean   :131.5   Mean   :203.3  
 3rd Qu.:123.00   3rd Qu.:348.5   3rd Qu.:162.5   3rd Qu.:265.0  
 Max.   :293.00   Max.   :500.0   Max.   :500.0   Max.   :500.0  
 NA's   :117      NA's   :117     NA's   :117     NA's   :117    
    SATFAT_1        SATFAT_2       SATFAT_3        SATFAT_4     
 Min.   : 0.00   Min.   : 0.0   Min.   : 0.00   Min.   : 0.000  
 1st Qu.: 8.25   1st Qu.: 3.0   1st Qu.: 6.00   1st Qu.: 2.000  
 Median :10.50   Median : 4.0   Median :11.00   Median : 4.000  
 Mean   :11.38   Mean   : 5.2   Mean   :10.51   Mean   : 3.883  
 3rd Qu.:15.00   3rd Qu.: 7.0   3rd Qu.:15.00   3rd Qu.: 5.000  
 Max.   :20.00   Max.   :17.0   Max.   :20.00   Max.   :15.000  
 NA's   :122     NA's   :123    NA's   :123     NA's   :128     
    SATFAT_5         SATFAT_6       SATFAT_7        SATFAT_8     
 Min.   : 0.000   Min.   : 0.0   Min.   : 0.00   Min.   : 0.000  
 1st Qu.: 3.000   1st Qu.: 1.0   1st Qu.: 8.00   1st Qu.: 1.750  
 Median : 4.000   Median : 2.0   Median :12.00   Median : 3.000  
 Mean   : 5.422   Mean   : 3.4   Mean   :11.34   Mean   : 3.783  
 3rd Qu.: 7.000   3rd Qu.: 4.0   3rd Qu.:15.00   3rd Qu.: 5.000  
 Max.   :20.000   Max.   :15.0   Max.   :20.00   Max.   :14.000  
 NA's   :124      NA's   :128    NA's   :123     NA's   :128     
    SATFAT_9         CARBS_1          CARBS_2          CARBS_3     
 Min.   : 0.000   Min.   : 0.000   Min.   : 0.000   Min.   : 2.00  
 1st Qu.: 3.000   1st Qu.: 2.000   1st Qu.: 4.000   1st Qu.:12.00  
 Median : 5.000   Median : 6.000   Median : 6.000   Median :17.00  
 Mean   : 6.238   Mean   : 7.933   Mean   : 7.397   Mean   :16.94  
 3rd Qu.: 9.000   3rd Qu.:11.250   3rd Qu.:10.000   3rd Qu.:21.00  
 Max.   :16.000   Max.   :30.000   Max.   :25.000   Max.   :30.00  
 NA's   :125      NA's   :128      NA's   :130      NA's   :123    
    CARBS_4         CARBS_5          CARBS_6          CARBS_7     
 Min.   : 2.00   Min.   : 0.000   Min.   : 0.000   Min.   : 2.00  
 1st Qu.: 8.00   1st Qu.: 4.000   1st Qu.: 3.000   1st Qu.: 9.00  
 Median :13.50   Median : 7.000   Median : 5.000   Median :14.00  
 Mean   :14.86   Mean   : 8.367   Mean   : 6.576   Mean   :13.73  
 3rd Qu.:21.00   3rd Qu.:10.250   3rd Qu.: 9.000   3rd Qu.:17.25  
 Max.   :30.00   Max.   :24.000   Max.   :21.000   Max.   :30.00  
 NA's   :124     NA's   :128      NA's   :129      NA's   :124    
    CARBS_8          CARBS_9         SUGAR_1          SUGAR_2      
 Min.   : 0.000   Min.   : 4.00   Min.   : 0.000   Min.   : 0.000  
 1st Qu.: 3.000   1st Qu.:10.50   1st Qu.: 2.000   1st Qu.: 2.000  
 Median : 5.000   Median :15.00   Median : 3.500   Median : 3.000  
 Mean   : 6.456   Mean   :15.95   Mean   : 4.661   Mean   : 3.368  
 3rd Qu.: 8.000   3rd Qu.:22.00   3rd Qu.: 6.250   3rd Qu.: 5.000  
 Max.   :20.000   Max.   :30.00   Max.   :15.000   Max.   :11.000  
 NA's   :131      NA's   :125     NA's   :132      NA's   :131     
    SUGAR_3          SUGAR_4          SUGAR_5         SUGAR_6      
 Min.   : 0.000   Min.   : 0.000   Min.   : 0.00   Min.   : 0.000  
 1st Qu.: 3.000   1st Qu.: 2.000   1st Qu.: 3.00   1st Qu.: 2.250  
 Median : 4.500   Median : 3.000   Median : 5.00   Median : 4.000  
 Mean   : 5.167   Mean   : 4.379   Mean   : 5.15   Mean   : 4.707  
 3rd Qu.: 7.250   3rd Qu.: 6.750   3rd Qu.: 7.00   3rd Qu.: 6.000  
 Max.   :15.000   Max.   :13.000   Max.   :12.00   Max.   :13.000  
 NA's   :128      NA's   :130      NA's   :128     NA's   :130     
    SUGAR_7          SUGAR_8          SUGAR_9         PROTEIN_1    
 Min.   : 2.000   Min.   : 0.000   Min.   : 0.000   Min.   : 0.00  
 1st Qu.: 4.000   1st Qu.: 2.000   1st Qu.: 3.000   1st Qu.: 7.00  
 Median : 6.000   Median : 3.000   Median : 4.000   Median :10.00  
 Mean   : 6.677   Mean   : 3.661   Mean   : 4.772   Mean   :11.34  
 3rd Qu.: 9.000   3rd Qu.: 5.000   3rd Qu.: 6.000   3rd Qu.:16.00  
 Max.   :15.000   Max.   :13.000   Max.   :15.000   Max.   :30.00  
 NA's   :126      NA's   :129      NA's   :131      NA's   :123    
   PROTEIN_2       PROTEIN_3        PROTEIN_4       PROTEIN_5    
 Min.   : 3.00   Min.   : 0.000   Min.   : 0.00   Min.   : 2.00  
 1st Qu.: 9.00   1st Qu.: 1.750   1st Qu.: 1.75   1st Qu.:13.00  
 Median :12.00   Median : 2.500   Median : 3.00   Median :17.00  
 Mean   :13.17   Mean   : 3.732   Mean   : 4.75   Mean   :17.95  
 3rd Qu.:17.00   3rd Qu.: 5.000   3rd Qu.: 6.00   3rd Qu.:23.00  
 Max.   :30.00   Max.   :14.000   Max.   :19.00   Max.   :30.00  
 NA's   :123     NA's   :132      NA's   :136     NA's   :123    
   PROTEIN_6       PROTEIN_7       PROTEIN_8        PROTEIN_9     
 Min.   : 0.00   Min.   : 5.00   Min.   : 0.000   Min.   : 0.000  
 1st Qu.: 2.00   1st Qu.:11.00   1st Qu.: 2.000   1st Qu.: 2.000  
 Median : 3.00   Median :15.00   Median : 3.000   Median : 3.000  
 Mean   : 3.92   Mean   :16.48   Mean   : 4.868   Mean   : 4.966  
 3rd Qu.: 5.00   3rd Qu.:22.00   3rd Qu.: 5.000   3rd Qu.: 7.750  
 Max.   :17.00   Max.   :30.00   Max.   :30.000   Max.   :30.000  
 NA's   :138     NA's   :124     NA's   :135      NA's   :130     
   ILLNESS_1          AGE             HEALTHSTATUS      HOPE      
 Min.   : 1.000   Length:188         Min.   :1.0   Min.   :1.000  
 1st Qu.: 1.000   Class :character   1st Qu.:3.0   1st Qu.:3.000  
 Median : 1.000   Mode  :character   Median :3.0   Median :4.000  
 Mean   : 2.394                      Mean   :3.2   Mean   :3.625  
 3rd Qu.: 4.000                      3rd Qu.:4.0   3rd Qu.:4.000  
 Max.   :10.000                      Max.   :5.0   Max.   :5.000  
 NA's   :122                         NA's   :123   NA's   :124    
    ANXIETY          GENDER        RACIALIZED        RACIALIZED_8_TEXT 
 Min.   :1.000   Min.   :0.0000   Length:188         Length:188        
 1st Qu.:2.750   1st Qu.:0.0000   Class :character   Class :character  
 Median :3.000   Median :0.0000   Mode  :character   Mode  :character  
 Mean   :3.359   Mean   :0.2923                                        
 3rd Qu.:4.000   3rd Qu.:1.0000                                        
 Max.   :5.000   Max.   :1.0000                                        
 NA's   :124     NA's   :123                                           
  SOCIALSTATUS     INCOME     
 Min.   :3.0   Min.   :1.000  
 1st Qu.:6.0   1st Qu.:3.000  
 Median :7.0   Median :3.000  
 Mean   :6.6   Mean   :3.185  
 3rd Qu.:7.0   3rd Qu.:4.000  
 Max.   :9.0   Max.   :5.000  
 NA's   :123   NA's   :123    
# source: (Hei & McCarty, 2025) https://shanemccarty.github.io/FRIplaybook/import-once.html 
# explanation: Filtered out NA responses from primary_data and used names() and summary() functions to see the column names and summarize the column descriptive statistics from the data frame based on code from the FRI playbook (Hei & McCarty, 2025)

1.1 Transform

1.1.1 Defining True Values

## list of calories for each food
CAL_true <- c(
  BACON_CAL_true = 250,  # true value for food 1
  EGGS_CAL_true = 180,  # true value for food 2
  TOTS_CAL_true = 320,  # true value for food 3
  SESRICE_CAL_true = 150,  # true value for food 4 
  SESCHICK_CAL_true = 140, # true value for food 5
  SPROUTS_CAL_true = 150, #true value for food 6
  KORCHICK_CAL_true = 300, #true value for food 7
  BOK_CAL_true = 60, #true value for food 8
  VEGGIERICE_CAL_true = 150  #true value for food 9
)
## list of fat for each food
FAT_true <- c(
  BACON_FAT_true = 1.5,  # true value for food 1
  EGGS_FAT_true = 4.5,  # true value for food 2
  TOTS_FAT_true = 3,  # true value for food 3
  SESRICE_FAT_true = 0, # true value for food 4
  SESCHICK_FAT_true = 1, # true value for food 5
  SPROUTS_FAT_true = 1, # true value for food 6
  KORCHICK_FAT_true = 4.5, # true value for food 7
  BOK_FAT_true = 0.5, # true value for food 8
  VEGGIERICE_FAT_true = 0 # true value for food 9
)
## list of carbohydrates for each food 
CARB_true <- c(
  BACON_CARB_true = 0,  # true value for food 1
  EGGS_CARB_true = 1,  # true value for food 2
  TOTS_CARB_true = 20,  # true value for food 3
  SESRICE_CARB_true = 21,  # true value for food 4
  SESCHICK_CARB_true = 0, # true value for food 5 
  SPROUTS_CARB_true = 12, # true value for food 6
  KORCHICK_CARB_true = 7, # true value for food 7
  BOK_CARB_true = 3, # true value for food 8
  VEGGIERICE_CARB_true = 25 # true value for food 9
)
## list of sugar for each food 
SUG_true <- c(
  BACON_SUG_true = 0,  # true value for food 1
  EGGS_SUG_true = 0,  # true value for food 2
  TOTS_SUG_true = 1,  # true value for food 3
  SESRICE_SUG_true = 0,  # true value for food 4
  SESCHICK_SUG_true = 0, # true value for food 5
  SPROUTS_SUG_true = 5, # true value for food 6
  KORCHICK_SUG_true = 4, # true value for food 7
  BOK_SUG_true = 1, # true value for food 8
  VEGGIERICE_SUG_true = 2 # true value for food 9
)
## list of protein for each food 
PRO_true <- c(
  BACON_PRO_true = 5,  # true value for food 1
  EGGS_PRO_true = 13,  # true value for food 2
  TOTS_PRO_true = 2,  # true value for food 3
  SESRICE_PRO_true = 2,  # true value for food 4
  SESCHICK_PRO_true = 26, # true value for food 5
  SPROUTS_PRO_true = 2, # true value for food 6
  KORCHICK_PRO_true = 21, # true value for food 7
  BOK_PRO_true = 2, # true value for food 8 
  VEGGIERICE_PRO_true = 4 # true value for food 9
)
# source: datacamp
# explain: created true values for every column of the macro-nutrient accuracy assessment. these values will compared to the estimated values chosen by the participant.

1.1.2 Create Difference Scores

# Create absolute difference scores (absolute value of raw differences)
## combined absolute difference scores
primary_data <- primary_data %>%
  mutate(
## calorie absolute difference scores
  BACON_CAL_abs_diff = abs(CALORIES_1 - CAL_true["BACON_CAL_true"]),
  EGGS_CAL_abs_diff = abs(CALORIES_2 - CAL_true["EGGS_CAL_true"]),
  TOTS_CAL_abs_diff = abs(CALORIES_3 - CAL_true["TOTS_CAL_true"]),
  SESRICE_CAL_abs_diff = abs(CALORIES_4 - CAL_true["SESRICE_CAL_true"]),
  SESCHICK_CAL_abs_diff = abs(CALORIES_5 - CAL_true["SESCHICK_CAL_true"]),
  SPROUTS_CAL_abs_diff = abs(CALORIES_6 - CAL_true["SPROUTS_CAL_true"]),
  KORCHICK_CAL_abs_diff = abs(CALORIES_7 - CAL_true["KORCHICK_CAL_true"]),
  BOK_CAL_abs_diff = abs(CALORIES_8 - CAL_true["BOK_CAL_true"]),
  VEGGIERICE_CAL_abs_diff = abs(CALORIES_9 - CAL_true["VEGGIERICE_CAL_true"]),
  ## fat absolute difference scores 
  BACON_FAT_abs_diff = abs(SATFAT_1 - FAT_true["BACON_FAT_true"]),
  EGGS_FAT_abs_diff = abs(SATFAT_2 - FAT_true["EGGS_FAT_true"]),
  TOTS_FAT_abs_diff = abs(SATFAT_3 - FAT_true["TOTS_FAT_true"]),
  SESRICE_FAT_abs_diff = abs(SATFAT_4 - FAT_true["SESRICE_FAT_true"]),
  SESCHICK_FAT_abs_diff = abs(SATFAT_5 - FAT_true["SESCHICK_FAT_true"]),
  SPROUTS_FAT_abs_diff = abs(SATFAT_6 - FAT_true["SPROUTS_FAT_true"]),
  KORCHICK_FAT_abs_diff = abs(SATFAT_7 - FAT_true["KORCHICK_FAT_true"]),
  BOK_FAT_abs_diff = abs(SATFAT_8 - FAT_true["BOK_FAT_true"]),
  VEGGIERICE_FAT_abs_diff = abs(SATFAT_9 - FAT_true["VEGGIERICE_FAT_true"]),
  ## carbohydrate absolute difference scores
  BACON_CARB_abs_diff = abs(CARBS_1 - CARB_true["BACON_CARB_true"]),
  EGGS_CARB_abs_diff = abs(CARBS_2 - CARB_true["EGGS_CARB_true"]),
  TOTS_CARB_abs_diff = abs(CARBS_3 - CARB_true["TOTS_CARB_true"]),
  SESRICE_CARB_abs_diff = abs(CARBS_4 - CARB_true["SESRICE_CARB_true"]),
  SESCHICK_CARB_abs_diff = abs(CARBS_5 - CARB_true["SESCHICK_CARB_true"]),
  SPROUTS_CARB_abs_diff = abs(CARBS_6 - CARB_true["SPROUTS_CARB_true"]),
  KORCHICK_CARB_abs_diff = abs(CARBS_7 - CARB_true["KORCHICK_CARB_true"]),
  BOK_CARB_abs_diff = abs(CARBS_8 - CARB_true["BOK_CARB_true"]),
  VEGGIERICE_CARB_abs_diff = abs(CARBS_9 - CARB_true["VEGGIERICE_CARB_true"]),
  ## sugar absolute difference scores
  BACON_SUG_abs_diff = abs(SUGAR_1 - SUG_true["BACON_SUG_true"]),
  EGGS_SUG_abs_diff = abs(SUGAR_2 - SUG_true["EGGS_SUG_true"]),
  TOTS_SUG_abs_diff = abs(SUGAR_3 - SUG_true["TOTS_SUG_true"]),
  SESRICE_SUG_abs_diff = abs(SUGAR_4 - SUG_true["SESRICE_SUG_true"]),
  SESCHICK_SUG_abs_diff = abs(SUGAR_5 - SUG_true["SESCHICK_SUG_true"]),
  SPROUTS_SUG_abs_diff = abs(SUGAR_6 - SUG_true["SPROUTS_SUG_true"]),
  KORCHICK_SUG_abs_diff = abs(SUGAR_7 - SUG_true["KORCHICK_SUG_true"]),
  BOK_SUG_abs_diff = abs(SUGAR_8 - SUG_true["BOK_SUG_true"]),
  VEGGIERICE_SUG_abs_diff = abs(SUGAR_9 - SUG_true["VEGGIERICE_SUG_true"]),
  ## protein absolute difference scores 
  BACON_PRO_abs_diff = abs(PROTEIN_1 - PRO_true["BACON_PRO_true"]),
  EGGS_PRO_abs_diff = abs(PROTEIN_2 - PRO_true["EGGS_PRO_true"]),
  TOTS_PRO_abs_diff = abs(PROTEIN_3 - PRO_true["TOTS_PRO_true"]),
  SESRICE_PRO_abs_diff = abs(PROTEIN_4 - PRO_true["SESRICE_PRO_true"]),
  SESCHICK_PRO_abs_diff = abs(PROTEIN_5 - PRO_true["SESCHICK_PRO_true"]),
  SPROUTS_PRO_abs_diff = abs(PROTEIN_6 - PRO_true["SPROUTS_PRO_true"]),
  KORCHICK_PRO_abs_diff = abs(PROTEIN_7 - PRO_true["KORCHICK_PRO_true"]),
  BOK_PRO_abs_diff = abs(PROTEIN_8 - PRO_true["BOK_PRO_true"]),
  VEGGIERICE_PRO_abs_diff = abs(PROTEIN_9 - PRO_true["VEGGIERICE_PRO_true"])
  )
# source: (2024) https://www.projectpro.io/recipes/subtract-2-numbers-r 
# explanation: created difference scores for true values (as defined in the previous code chunk) and subtracted them from the estimates in the columns corresponding to each difference score in primary_data. these values had to be absolute so the function abs() was used in order to ensure there were no negative difference scores. 

1.1.3 Create Summed Difference Scores

library(dplyr)
# Create summed absolute difference scores 
primary_data <- primary_data %>%
  mutate(
## sum calorie absolute difference scores
   SUM_CAL_abs_diff = BACON_CAL_abs_diff + EGGS_CAL_abs_diff + TOTS_CAL_abs_diff + SESRICE_CAL_abs_diff + SESCHICK_CAL_abs_diff + SPROUTS_CAL_abs_diff + KORCHICK_CAL_abs_diff + BOK_CAL_abs_diff + VEGGIERICE_CAL_abs_diff,
## sum fat absolute difference scores
    SUM_FAT_abs_diff = BACON_FAT_abs_diff + EGGS_FAT_abs_diff + TOTS_FAT_abs_diff + SESRICE_FAT_abs_diff + SESCHICK_FAT_abs_diff + SPROUTS_FAT_abs_diff + KORCHICK_FAT_abs_diff + BOK_FAT_abs_diff + VEGGIERICE_FAT_abs_diff,
## sum carbohydrate absolute difference scores 
    SUM_CARB_abs_diff = BACON_CARB_abs_diff + EGGS_CARB_abs_diff + TOTS_CARB_abs_diff + SESRICE_CARB_abs_diff + SESCHICK_CARB_abs_diff + SPROUTS_CARB_abs_diff + KORCHICK_CARB_abs_diff + BOK_CARB_abs_diff + VEGGIERICE_CARB_abs_diff,
## sum sugar absolute difference scores
    SUM_SUG_abs_diff = BACON_SUG_abs_diff + EGGS_SUG_abs_diff + TOTS_SUG_abs_diff + SESRICE_SUG_abs_diff + SESCHICK_SUG_abs_diff + SPROUTS_SUG_abs_diff + KORCHICK_SUG_abs_diff + BOK_SUG_abs_diff + VEGGIERICE_SUG_abs_diff,
## sum protein absolute differences
    SUM_PRO_abs_diff = BACON_PRO_abs_diff + EGGS_PRO_abs_diff + TOTS_PRO_abs_diff + SESRICE_PRO_abs_diff + SESCHICK_PRO_abs_diff + SPROUTS_PRO_abs_diff + KORCHICK_PRO_abs_diff + BOK_PRO_abs_diff + VEGGIERICE_PRO_abs_diff
  ) 
# source: https://rstudio.github.io/cheatsheets/html/data-transformation.html
# explanation: used mutate() function to create new columns that summed all the individual foods' difference scores for all the different macro-nutrients. 

1.1.4 Create combined total difference scores

## create total absolute differences scores by summing all nutrient difference scores
primary_data <- primary_data %>%
  mutate(
    TOTAL_abs_diff = rowSums(across(c(
      SUM_CAL_abs_diff,
      SUM_FAT_abs_diff,
      SUM_CARB_abs_diff,
      SUM_SUG_abs_diff,
      SUM_PRO_abs_diff
    )))
  )
# source: https://dplyr.tidyverse.org/articles/rowwise.html
# explanation: took the sum of all the individual macro-nutrient difference score to obtain the final macro-nutrient accuracy score. 

1.1.5 Create Knowledge Scores

library(dplyr)
#| label: total knowledge score 
## create 'KNOW_total' which is the sum of all KNOW columns
primary_data <- primary_data %>%
  mutate(
    KNOW_total = KNOW1 + KNOW2 + KNOW3 + KNOW4 + KNOW5 + KNOW6 + KNOW7 + KNOW8
  )
# source: https://rstudio.github.io/cheatsheets/html/data-transformation.html
# explanation: created total nutritional knowledge score by summing the 'know' columns, which corresponded to nutritional knowledge scores (0 or 1). 

1.2 Visualize

library(dplyr)
# calculate descriptive statistics (mean, sd) for KNOW_total and TOTAL_abs_diff
## source: https://rstudio.github.io/cheatsheets/html/data-transformation.html
primary_data %>%
  summarize(
    mean_KNOW_total = mean(KNOW_total, na.rm = TRUE),
    sd_KNOW_total = sd(KNOW_total, na.rm = TRUE),
    mean_TOTAL_abs_diff = mean(TOTAL_abs_diff, na.rm = TRUE),
    sd_TOTAL_abs_diff = sd(TOTAL_abs_diff, na.rm = TRUE)
  )
# A tibble: 1 × 4
  mean_KNOW_total sd_KNOW_total mean_TOTAL_abs_diff sd_TOTAL_abs_diff
            <dbl>         <dbl>               <dbl>             <dbl>
1            6.41          1.43                844.              243.
# source: https://rstudio.github.io/cheatsheets/html/data-transformation.html
# explanation: mean and standard deviation calculations for variables KNOW_total and TOTAL_abs_diff.

The study sample consisted entirely of Binghamton University students (N = 208), and participants were between the ages of 18 and 22, with a mean age of 18.94 years. Female students accounted for about 70% of the sample, and about 80% of participants were White or Asian. According to the Binghamton University statistics, about 51% of students are female, and about 66% of students identify as either White or Asian (Binghamton University | Data USA, n.d.). Thus, this sample may be somewhat unrepresentative of Binghamton University’s demographics, as it includes significantly more female, White, and Asian students than the general Binghamton University population, which may make it difficult to generalize the study’s results to the larger population.

Displayed in Table 1 are the means and standard deviations of both variables, total nutritional knowledge (M = 6.405, SD = 1.428) and total macro nutrient accuracy scores (combined calories, saturated fat, carbohydrate, sugar, and protein) (M = 843.837, SD = 242.650). Total macronutrient accuracy score was calculated as the sum of the differences between individual macronutrient accuracy scores. 

1.2.1 Create histogram

library(ggplot2)
## create histograms to check for normality
ggplot(primary_data, aes(x = TOTAL_abs_diff)) +
  geom_histogram(binwidth = .5)
Warning: Removed 145 rows containing non-finite outside the scale range
(`stat_bin()`).

the first histogram has nutritional knowledge score on the x-axis and frequency on the y-axis. The second histogram has macro-nutrient accuracy score on the x-axis and frequency on the y-axis. The nutitional knoweldge score histogram appears to be right-skewed and is not a normall distribution. The macronutrient accuracy histogram simarlarly appears to be right-skewed and is not a normal distribution.

Two histograms depicting the distribution of nutritional knowledge scores and macro-nurtient accuracy scores.
ggplot(primary_data, aes(x = KNOW_total)) +
  geom_histogram(binwidth = .5)
Warning: Removed 109 rows containing non-finite outside the scale range
(`stat_bin()`).

the first histogram has nutritional knowledge score on the x-axis and frequency on the y-axis. The second histogram has macro-nutrient accuracy score on the x-axis and frequency on the y-axis. The nutitional knoweldge score histogram appears to be right-skewed and is not a normall distribution. The macronutrient accuracy histogram simarlarly appears to be right-skewed and is not a normal distribution.

Two histograms depicting the distribution of nutritional knowledge scores and macro-nurtient accuracy scores.
ggsave("plots/knowledge_scores_hist.png" , width = 6, height = 8)
Warning: Removed 109 rows containing non-finite outside the scale range
(`stat_bin()`).
# source: https://rstudio.github.io/cheatsheets/data-visualization.pdf
# explanation: made a histogram to check for normal distribution of variables. 

The charts above (figures 1 and 2) represents the distribution of both variables, nutritional knowledge scores and macro-nutrient accuracy scores. Because neither of these histograms appear to be normally distributed, both are heavily right skewed, the next step is to check for normality of residuals in a linear model of both variables.

1.2.2 Create scatterplot

library(ggplot2)
## create scatter plot to plot data 
ggplot(data = primary_data, aes(x = KNOW_total, y = TOTAL_abs_diff)) +
  geom_point() +
  geom_smooth(method = "lm")
`geom_smooth()` using formula = 'y ~ x'
Warning: Removed 145 rows containing non-finite outside the scale range
(`stat_smooth()`).
Warning: Removed 145 rows containing missing values or values outside the scale range
(`geom_point()`).

the scatterplot shows nutritional knowledge score on the x axis and macro-nutrient accuracy score on the y axis. The points appear to be randomly scattered with little-to-no observable relationship between the two variables.

A scatterplot depicting the relationship between nutritional knowledge scores and macro-nutrient accuracy scores.
ggsave("plot/macro_knowledge_score_plot.png" , width = 8, height = 6)
`geom_smooth()` using formula = 'y ~ x'
Warning: Removed 145 rows containing non-finite outside the scale range
(`stat_smooth()`).
Removed 145 rows containing missing values or values outside the scale range
(`geom_point()`).
# source: https://rstudio.github.io/cheatsheets/html/data-visualization.html#two-variables---both-continuous 
# explanation: created scatter plot as a way to visualize the relationship between the two variables before fitting to a linear model.

As shown in Figure 1, there is no correlation between declarative nutritional knowledge and macronutrient accuracy scores. Thus, these findings fail to reject the null hypothesis that declarative nutritional knowledge and macronutrient accuracy scores are not related.

1.3 Model

1.3.1 Fit to linear model to check for normality of residuals

## check for normal distribution of residuals
### fit to linear model
lm_primary_data <- lm(TOTAL_abs_diff ~ KNOW_total , data = primary_data)
### summarize linear model
summary(lm_primary_data)

Call:
lm(formula = TOTAL_abs_diff ~ KNOW_total, data = primary_data)

Residuals:
    Min      1Q  Median      3Q     Max 
-371.01 -184.01  -57.92  168.94  646.99 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  1130.38     252.27   4.481 5.85e-05 ***
KNOW_total    -41.91      36.50  -1.148    0.258    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 241.7 on 41 degrees of freedom
  (145 observations deleted due to missingness)
Multiple R-squared:  0.03115,   Adjusted R-squared:  0.007521 
F-statistic: 1.318 on 1 and 41 DF,  p-value: 0.2576
### plot linear model
plot(lm_primary_data)

## because residuals are normally distributed, run Pearson correlation test
# source: (2025) https://www.datacamp.com/tutorial/linear-regression-R 
# explanation: fit both variables to a linear model in order to check for normal distribution of residuals in order to run a pearson correlation. 

In order to run a Pearson Correlation test both variables tested must be normally distributed and sample size should be at least 30. Due to the sample size for this study being greater than 30 and the appearance of a normal distribution of residuals for both variables (as shown by the QQ plot above) the researchers deemed it appropriate to conduct a Pearson Correlation test for association.

1.3.2 Run Pearson correaltion

## run pearson correlation

cor.test(primary_data$TOTAL_abs_diff, primary_data$KNOW_total, method = "pearson", use = "complete.obs")

    Pearson's product-moment correlation

data:  primary_data$TOTAL_abs_diff and primary_data$KNOW_total
t = -1.1482, df = 41, p-value = 0.2576
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 -0.4528362  0.1307794
sample estimates:
       cor 
-0.1764971 
A Pearson correlation showed no statistically significant correlation between declarative nutritional knowledge and macro-nutrient accuracy scores (r = -0.18, p = .2576). This suggests that there is no relationship between declarative nutritional knowledge and practical macronutrient knowledge. 

2 Disucssion

The data collected in this study suggest that there is no correlation between declarative nutritional knowledge, as measured by an eight-item validated nutritional knowledge measure, and practical nutritional accuracy scores of dining hall foods. This study aimed to determine whether there was a link between Binghamton students’ declarative (factual) nutritional knowledge and their ability to accurately assess the macronutrient content of dining hall foods they eat daily. The researchers expected to find that there was a positive relationship between declarative nutritional knowledge and macronutrient accuracy; however, after running a Pearson correlation, no statistically significant relationship was found between the two variables. This lack of significance may be attributable to the limited scope of the sample, which was a small sample of Binghamton University students who were recruited through on-campus tabling. Additionally, a general lack of existing research on the relationship between declarative nutritional knowledge and the practical assessment of macronutrient content in food underscores the need for further research on this topic before a conclusion on the relationship between declarative and practical nutritional knowledge can be reached. Even though this study did not find a significant relationship between declarative nutritional knowledge and macronutrient assessment accuracy, multiple studies have shown associations between various nutritional knowledge interventions and dietary quality, suggesting that declarative nutritional knowledge may be correlated with increased awareness of dietary quality (Shahril et al., 2013). However, these findings have been inconsistent, especially when researching college students (Yahia et al., 2016). Because of these inconsistent research results, future researchers may benefit from increasing research efforts on the effect of nutritional knowledge and food choices, as well as the link between declarative nutritional knowledge and its link to awareness of macro-nutrients in food consumed daily.