##Introduction
Food is an essential part of our lives. It varies from different ingredients and techniques all across the
world. Consuming the right foods can strengthen someone's energy, prevent diseases, and all around improve
the quality of someone's life. Each food item has a description of its nutrients and is different for every food.
Some are vital to our health, while others can be dentrimental. Analyzing the different nutrients and methods
of home cooked meals and meal plans can help us decide which method people should choose for their health and
overall diet
##Problem Statement
College meal plans are the most convenient option for most students due to the easy access and ability to grab something to eat without having to spend time preparing and cooking food. Although they are very accessible, there's concern on whether these meal plans are the most cost-effective and healthiest choice for students regarding what they eat. Many students are unaware of how cooking from home can be cheaper and also provide better nutrients compared to a meal plan. We want to solve this problem to show that despite money consumption potentially being higher for groceries, it may be worth it when it comes down to overall health.
##Objective & Goal
We plan on comparing the advantages of meal plans and home-cooked meals and focusing on the factors of pricing, accesibility, health factors, and all around nutrients provided from either a home-cooked meal or meal plan. We strive on finding which option between the two is better for consumers to spend their time and money on. We also want to look at the effects of home-cooked meals and meal plans, and see if there's a relationship between someone's overall health and look for correlation between what they consume and their health. Our goal is to consider and analyze why students prefer meal plans and see if they are informed of alternatives like a home-cooked meal and the benefits that come from home-cooked meals.
##Method & Variables
After grabbing all of our data, we used multiple linear regression to see which of our variables are significant and see if they have an impact on our dependent variable, which is the satisfaction scores students provide from consuming one of the options. Our independent variables are cost, calories, and preparation time.
##Description of variables
Data Description. Description of features below
Variable. | Definition
-------------- --------------------
1.Cost |- The amount that has to be spent or paid to obtain something.
2.Prep time - Time it takes to prepare food and the actions involved in preparing the food.
3.Calories - Unit of measurement that measures the amount of energy in beverages and food.
* Meal Prep cost is based on SJSU Starter Plan with average cost = total cost/# Of entries
* $1537.98/95 entries = $16.19 per meal
Assumptions:
Level of significance (α) = 0.05
Relationship between independent and dependent variables must be linear
Residuals from regression approximately normally distributed
No Multicollinearity
# install.packages("readxl")
# install.packages("dplyr")
# install.packages("Hmisc")
library(readxl) # import excel files into R Studio
## Warning: package 'readxl' was built under R version 4.4.2
library(dplyr) # allows to filter our data
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(Hmisc) # provides data analysis and visualization
## Warning: package 'Hmisc' was built under R version 4.4.2
##
## Attaching package: 'Hmisc'
## The following objects are masked from 'package:dplyr':
##
## src, summarize
## The following objects are masked from 'package:base':
##
## format.pval, units
data <- read_excel(file.choose("MealTypes.xlsx"))
data
## # A tibble: 50 × 5
## MealType Cost PrepTime Calories Satisfaction
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 HC 6 3 216. 7.5
## 2 HC 6 10 200 9
## 3 HC 8 8 350 10
## 4 HC 6 7.25 210 8.5
## 5 HC 9 7 300 10
## 6 HC 8 3.5 300 9
## 7 HC 5 5.75 185 7.77
## 8 HC 7 6 250 8.5
## 9 HC 8.5 5 200 9
## 10 HC 10 10 200 10
## # ℹ 40 more rows
summary(data)
## MealType Cost PrepTime Calories
## Length:50 Min. : 3.00 Min. : 0.00 Min. :110.0
## Class :character 1st Qu.: 7.00 1st Qu.: 0.00 1st Qu.:160.0
## Mode :character Median :13.10 Median : 1.50 Median :190.0
## Mean :11.45 Mean : 2.95 Mean :192.8
## 3rd Qu.:16.19 3rd Qu.: 5.00 3rd Qu.:210.0
## Max. :16.19 Max. :10.00 Max. :360.0
## Satisfaction
## Min. : 1.000
## 1st Qu.: 5.000
## Median : 8.000
## Mean : 6.913
## 3rd Qu.: 9.000
## Max. :10.000
hc_table <- data %>% filter(MealType == "HC") # Creates a table only with Home-Cooked Meals
print(hc_table)
## # A tibble: 25 × 5
## MealType Cost PrepTime Calories Satisfaction
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 HC 6 3 216. 7.5
## 2 HC 6 10 200 9
## 3 HC 8 8 350 10
## 4 HC 6 7.25 210 8.5
## 5 HC 9 7 300 10
## 6 HC 8 3.5 300 9
## 7 HC 5 5.75 185 7.77
## 8 HC 7 6 250 8.5
## 9 HC 8.5 5 200 9
## 10 HC 10 10 200 10
## # ℹ 15 more rows
summary(hc_table)
## MealType Cost PrepTime Calories
## Length:25 Min. : 3.0 Min. : 3.0 Min. :160.0
## Class :character 1st Qu.: 6.0 1st Qu.: 5.0 1st Qu.:190.0
## Mode :character Median : 7.0 Median : 5.0 Median :200.0
## Mean : 6.7 Mean : 5.9 Mean :218.2
## 3rd Qu.: 8.0 3rd Qu.: 7.0 3rd Qu.:220.0
## Max. :10.0 Max. :10.0 Max. :350.0
## Satisfaction
## Min. : 7.500
## 1st Qu.: 8.500
## Median : 9.000
## Mean : 8.887
## 3rd Qu.: 9.500
## Max. :10.000
# Interpretation
# Average Home-cooked meal typically is around $6.70, 6 minutes of cooking, and 218 calories with a satisfaction of 8.89/10
MP_table <- data %>% filter(MealType == "MP") # Creates a table only with Meal Prep data
print(MP_table)
## # A tibble: 25 × 5
## MealType Cost PrepTime Calories Satisfaction
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 MP 16.2 0 200 6
## 2 MP 16.2 0 180 5
## 3 MP 16.2 0 360 7
## 4 MP 16.2 0 210 7
## 5 MP 16.2 0 190 8
## 6 MP 16.2 0 160 2
## 7 MP 16.2 0 110 1
## 8 MP 16.2 0 140 7
## 9 MP 16.2 0 150 8
## 10 MP 16.2 0 160 9
## # ℹ 15 more rows
summary(MP_table)
## MealType Cost PrepTime Calories Satisfaction
## Length:25 Min. :16.19 Min. :0 Min. :110.0 Min. :1.00
## Class :character 1st Qu.:16.19 1st Qu.:0 1st Qu.:150.0 1st Qu.:3.00
## Mode :character Median :16.19 Median :0 Median :160.0 Median :5.00
## Mean :16.19 Mean :0 Mean :167.4 Mean :4.94
## 3rd Qu.:16.19 3rd Qu.:0 3rd Qu.:180.0 3rd Qu.:7.00
## Max. :16.19 Max. :0 Max. :360.0 Max. :9.00
# Interpretation
# Average Meal Prep typically is around $16.19, no prep time, and 167 calories with a satisfaction of 4.94/10
MP_df <- subset(MP_table, select = -c(MealType))
HC_df <- subset(hc_table, select = -c(MealType))
# Doesn't factor MealType column as its not a value
pairs(MP_df) # creates scatterplot matrix for Meal plans
pairs(HC_df) # creates scatterplot matrix for Home-cooked meals
# Flat line going horizontal = variable in y-axis is constant
# Flat line going vertical = variable in x-axis is constant
# Prep Time & Cost for MP is constant
cor(MP_df) # Correlation matrix of MP
## Warning in cor(MP_df): the standard deviation is zero
## Cost PrepTime Calories Satisfaction
## Cost 1 NA NA NA
## PrepTime NA 1 NA NA
## Calories NA NA 1.0000000 0.4186104
## Satisfaction NA NA 0.4186104 1.0000000
# Interpretation
# Prep Time and Cost not applicable due to variable being constant
# Calories and satisfaction show a moderate positive linear relationship
cor(HC_df) # Correlation matrix of HC
## Cost PrepTime Calories Satisfaction
## Cost 1.0000000 0.1196805 0.4460796 0.5705875
## PrepTime 0.1196805 1.0000000 0.1409615 0.4660266
## Calories 0.4460796 0.1409615 1.0000000 0.5650791
## Satisfaction 0.5705875 0.4660266 0.5650791 1.0000000
# Interpretation
# Satisfaction with each independent variable show a moderate positive linear relationship
# Prep Time shows a weak positive relationship with Cost and Calories
# Cost and Calories are moderately positive with each othe
Home-Cooked Meal
Dependent Variable: Satisfaction Score
Independent Variable: Cost, Prep Time, Calories
Equation for Satisfaction for HC: ŷ = B0+B1x1+B2x2+B3x3
ŷ = Satisfaction Score
x1 = Cost
x2 = Prep Time
x3 = Calories
hc_model <- lm(Satisfaction ~ Cost + PrepTime + Calories, data = HC_df)
summary(hc_model)
##
## Call:
## lm(formula = Satisfaction ~ Cost + PrepTime + Calories, data = HC_df)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.84369 -0.41381 0.03715 0.46791 1.05036
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.554987 0.651886 8.521 2.95e-08 ***
## Cost 0.160817 0.068469 2.349 0.0287 *
## PrepTime 0.142824 0.054754 2.608 0.0164 *
## Calories 0.006469 0.002955 2.189 0.0400 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.5638 on 21 degrees of freedom
## Multiple R-squared: 0.5816, Adjusted R-squared: 0.5218
## F-statistic: 9.728 on 3 and 21 DF, p-value: 0.0003167
# Estimated Regression Equation:ŷ = 5.55 + 0.16(cost) + 0.14(Prep Time) + 0.01(Calories)
# All three independent variables are significant(Cost, Prep time, Calories)
# Adjusted R square(0.52) is a moderate goodness of fit
# The model is significant as the p-value < 0.05
# b0 = 5.55: The average satisfaction score (7.73) someone will give on a home cooked meal without calories, preptime, and cost)
# b1 = 0.16: For each additional cost(in dollars), the satisfaction score is expected to increase by 0.16, holding other factors constant
# b2 = 0.14: For each additional minute needed to cook the meal, the satisfaction score is expected to increase by 0.14.
# b3 = 0.01: For each additional calorie in the meal, the satisfaction score is expected to increase by 0.01
Meal Plan
Dependent Variable: Satisfaction Score
Independent Variable: Cost, Prep Time, Calories
Equation for Satisfaction for MP: ŷ = B0+B1x1
ŷ = Satisfaction Score
x1 = Calories
mp_model <- lm(Satisfaction ~ Calories, data = MP_df)
summary(mp_model)
##
## Call:
## lm(formula = Satisfaction ~ Calories, data = MP_df)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.5976 -1.5976 0.1894 1.2218 4.2056
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.646289 1.549504 1.062 0.2991
## Calories 0.019676 0.008901 2.211 0.0373 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.127 on 23 degrees of freedom
## Multiple R-squared: 0.1752, Adjusted R-squared: 0.1394
## F-statistic: 4.887 on 1 and 23 DF, p-value: 0.03728
# Estimated Regression Equation: ŷ = 1.65 + 0.02(x1)
# Calories is significant but Cost and PrepTime is not applicable due to the variable being constant.
# Adjusted R-squared being 0.14 meaning weak goodness of fit.
# Model is significant because p-value < alpha (0.04 < 0.05)
# b0 = 1.65: The average satisfaction score (1.65) someone will give on a meal plan meal that has no calories, preptime, or cost)
# b1 = 0.02: For each additional calorie in the meal, the satisfaction score is expected to increase by 0.02
##Conclusions and Recommendations
We can conclude that based on our data, the satisfaction scores between home-cooked meals and meal plans based on our variables of cost, prep/wait time, and calories, that home-cooked meals had a higher satisfaction score and contained a moderate correlation with our independent variables.
We observed that cost, calories, and prep/wait time were statistically significant since the p-value was less than alpha for home-cooked meals and calories was the only significant variable for meal plans.
1: Try to not spend too much money and try to cook on a budget for home-cooked meals because inflation is super high in today's economy so eating something that's cheap but still provides good satsifaction is the best case.
2: Management can use this model to show how high satisfaction scores correlate with each individual based on the variables of calories, cost, and time.
3: When eating from a meal plan, make sure to research your food intake and see if the cost for a period of time is worth the satisfaction you are seeking from what you consume.