---
title: "Your Informative Title Here"
subtitle: "Case Study 1" 
author:
  - name: "First Author"
  - name: "Second Author"  
date: 2025-10-03
format: 
  pdf:
    geometry: 
      - left=1in
      - right=1in
      - top=1in
      - bottom=1in
execute: 
  echo: true
  message: false
  warning: false
---

::: {.callout-note}

Your written short report should be the first thing your reader encounters in your case study document. While you may choose to label each of the required components/sections of the short report with its own header (see below for an example of creating a header in Quarto), you do not need to do so provided that all of the required information is included. Your report should be self-contained and written in such a way that **a quantitatively inclined friend** (who has taken or is taking SDS 291) could follow what you did without necessarily knowing anything about the U.S. presidential election of 2000.

:::
::: {.callout-tip}

As you write your report, you may wish to reference the [guide to typesetting regression lines in Quarto using LaTeX](homework/latex.qmd), the [Quarto help page for formatting documents using Markdown](https://quarto.org/docs/authoring/markdown-basics.html), and the [Quarto help page for customizing the output from executed code chunks](https://quarto.org/docs/computations/execution-options.html).

:::

```{r}
# Loading necessary packages
library(tidyverse)

# Loading the case study data
election <- Sleuth2::ex0825

# Creating a second dataset with Palm Beach County excluded
election_wo_pb <- election |> 
  filter(County != "Palm Beach")

# Loading another dataset (just as an example)
wine <- Sleuth2::ex0823
```

### An example section heading

```{r}
wine |> 
  ggplot(aes(x = Wine, y = Mortality)) +
  geom_point() +
  ggtitle("Association between wine consumption and mortality rates.")
```

When reporting the results of your regression analysis, I would like you to write out a mathematical description of the main/final population model for the mean. Here is an example of what that might look like:

> Let $mort_i$ denote the heart disease mortality rate in country $i$ (measured in deaths per 1,000 individuals) and $wine_i$ denote the consumption of wine (measured in liters per person per year). Our final linear regression model is $$E[mort_i | wine_i] = \beta_0 + \beta_1 \left( wine_i \right).$$

You do not need to write out the fitted regression line, but you should (at a minimum) provide a table summarizing the estimated coefficients of the model and their corresponding standard errors, like the one shown below. A print-out from the `summary()` command alone is not sufficient.

```{r}
# Fitting the regression line for mean mortality as a function of wine consumption
wine_lm <- lm(Mortality ~ Wine, data = wine)

# Representing the regression table as a dataframe (i.e., tidying the summary() output)
wine_lm_table <- wine_lm |>
  broom::tidy()

# Creating a nicely formatted table from the dataframe using the kable package
wine_lm_table |>
  knitr::kable(digits = c(NA, 3, 3, 2, 4))
```
