```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```


First, we need to load in our data.
```{r}
quack_responses_clean <- 
```



```{r}
# View average heights by lab


# Filter only LCD and Gopnik lab members


# Check how many people per lab


# Run the t-test


# Optional: plot the comparison


```
When you want to compare means across more than two groups, a t-test isn't enough — that's where ANOVA (Analysis of Variance) comes in.

ANOVA checks if there is any significant difference in means across the groups. It doesn't tell you which groups differ — just whether at least one group is different. You can follow up with post-hoc tests if needed.
```{r}
# Check how many labs are in the dataset


# Fit ANOVA model


# Plot the means with boxplots


```

```{r}
# Plot the relationship


# Correlation test


```

```{r}
# Convert CollegeYear to factor and set order


# Run the regression


# Visualize the results


```


```{r}
# Recode LastQuestion to binary


# Run logistic regression


# Predict probabilities


# Plot


```
Sampling:
Statistical estimates, like the mean height in a sample, are just one version of what you could have gotten if you had collected a different sample. To understand how estimates vary across repeated samples, we can simulate repeated sampling.

```{r}
# Set up an empty vector to store means


# Repeat sampling 1000 times

# Plot the sampling distribution


```

When we collect one sample, we often want to know how uncertain our estimate is. One way to do this is using bootstrapping, which is a non-parametric method that resamples your data many times to build a distribution of your statistic (e.g., the mean).

Bootstrapping is especially helpful when:

The sample size is small.

We don’t want to assume normality.

We want to estimate confidence intervals for stats that don’t have exact formulas (e.g., the median).


```{r}
library(boot)

# Define a function to compute the statistic of interest
boot_mean <- function(data, indices) {
  d <- data[indices, ]
  return(mean(d$height_clean, na.rm = TRUE))
}

# Run the bootstrap
boot_results <- boot(data = quack_responses_clean, 
                     statistic = boot_mean, 
                     R = 1000)

# Print results
print(boot_results)

# Bootstrap confidence intervals
boot.ci(boot_results, type = "perc")


# Plot histogram of bootstrap sample means
hist(boot_results$t,
     breaks = 30,
     col = "tomato",
     main = "Bootstrap Distribution of the Mean",
     xlab = "Mean Height (inches)")

```

