Introduction

This report analyzes a 12-week diet study with 50 participants, comparing four diet types (Keto, Low-Carb, Standard, Control) and the effect of Ozempic on weight loss, HOMA-IR, and fasting insulin. The dataset was cleaned using Google BigQuery and analyzed in R.

Data Loading

data <- read_csv("low_insulin_diet_bigquery_cleaned.csv")
## Rows: 200 Columns: 9
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): diet_type, gender
## dbl (6): participant_id, week, weight_kg, homa_ir, fasting_insulin, age
## lgl (1): ozempic_use
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
head(data)
## # A tibble: 6 × 9
##   participant_id diet_type  week weight_kg homa_ir fasting_insulin ozempic_use
##            <dbl> <chr>     <dbl>     <dbl>   <dbl>           <dbl> <lgl>      
## 1              4 Control       4      98.5    4.58             4.9 FALSE      
## 2              4 Control       0      99      4.6              5   FALSE      
## 3              4 Control       8      98      4.56             4.8 FALSE      
## 4              4 Control      12      97.5    4.54             4.7 FALSE      
## 5              8 Control      12      74.5    3.54             6.7 FALSE      
## 6              8 Control       8      75      3.56             6.8 FALSE      
## # ℹ 2 more variables: age <dbl>, gender <chr>

Weight Loss Analysis

weight_change <- data %>%
  group_by(participant_id, diet_type, ozempic_use) %>%
  summarise(
    weight_start = weight_kg[week == 0],
    weight_end = weight_kg[week == 12],
    weight_loss = weight_start - weight_end
  ) %>%
  ungroup()
## `summarise()` has grouped output by 'participant_id', 'diet_type'. You can
## override using the `.groups` argument.
weight_summary <- weight_change %>%
  group_by(diet_type, ozempic_use) %>%
  summarise(
    avg_weight_loss = mean(weight_loss, na.rm = TRUE),
    sd_weight_loss = sd(weight_loss, na.rm = TRUE),
    n = n()
  ) %>%
  ungroup()
## `summarise()` has grouped output by 'diet_type'. You can override using the
## `.groups` argument.
weight_summary
## # A tibble: 8 × 5
##   diet_type ozempic_use avg_weight_loss sd_weight_loss     n
##   <chr>     <lgl>                 <dbl>          <dbl> <int>
## 1 Control   FALSE                 0.636           2.86    11
## 2 Control   TRUE                  2.25           NA        1
## 3 Keto      FALSE                 3.1             4.43    10
## 4 Keto      TRUE                  6.75            0        3
## 5 Low-Carb  FALSE                 3.60            0        7
## 6 Low-Carb  TRUE                  6.43            3.49     6
## 7 Standard  FALSE                 0.342           3.47     9
## 8 Standard  TRUE                  2.25            0        3

Weight Loss Visualization

ggplot(weight_summary, aes(x = diet_type, y = avg_weight_loss, fill = ozempic_use)) +
  geom_bar(stat = "identity", position = "dodge") +
  labs(title = "Average Weight Loss by Diet Type and Ozempic Use",
       x = "Diet Type",
       y = "Average Weight Loss (kg)") +
  theme_minimal()

HOMA-IR and Fasting Insulin Analysis

homa_ir_change <- data %>%
  group_by(participant_id, diet_type, ozempic_use) %>%
  summarise(
    homa_ir_start = homa_ir[week == 0],
    homa_ir_end = homa_ir[week == 12],
    homa_ir_change = homa_ir_start - homa_ir_end
  ) %>%
  ungroup()
## `summarise()` has grouped output by 'participant_id', 'diet_type'. You can
## override using the `.groups` argument.
homa_ir_summary <- homa_ir_change %>%
  group_by(diet_type, ozempic_use) %>%
  summarise(
    avg_homa_ir_change = mean(homa_ir_change, na.rm = TRUE),
    sd_homa_ir_change = sd(homa_ir_change, na.rm = TRUE),
    n = n()
  ) %>%
  ungroup()
## `summarise()` has grouped output by 'diet_type'. You can override using the
## `.groups` argument.
homa_ir_summary
## # A tibble: 8 × 5
##   diet_type ozempic_use avg_homa_ir_change sd_homa_ir_change     n
##   <chr>     <lgl>                    <dbl>             <dbl> <int>
## 1 Control   FALSE                 -0.00909          2.29e- 1    11
## 2 Control   TRUE                   0.0600          NA            1
## 3 Keto      FALSE                  0.52             2.21e- 1    10
## 4 Keto      TRUE                   0.45             1.30e-16     3
## 5 Low-Carb  FALSE                  0.36             1.76e-16     7
## 6 Low-Carb  TRUE                   0.34             4.90e- 2     6
## 7 Standard  FALSE                  0.0600           0            9
## 8 Standard  TRUE                   0.0600           2.56e-16     3

Conclusion

Keto and Low-Carb diets resulted in greater weight loss and reductions in HOMA-IR and fasting insulin compared to Standard and Control diets. Ozempic use enhanced these effects, particularly for Keto participants. Additional visualizations are available on Tableau Public: https://public.tableau.com/app/profile/alexander.gallagher/viz/LowInsulinDietStudyVisualizations/DietStudyVisualizations.