---
### DON'T CHANGE ANYTHING BETWEEN THE DASHES (---), EXCEPT YOUR NAME ###
title: "Practice Assessment Solution"
author: "Joshua Wells"
format: 
  html:
    embed-resources: true 
code-overflow: wrap
date-modified: "`r Sys.Date()`"
---


```{r}
#| warning: false
# load your libraries
library(ggplot2)
```

## Read In Your Data

```{r}
anorexia <- read.delim('https://raw.githubusercontent.com/IowaBiostat/data-sets/main/anorexia/anorexia.txt')

treat_only <- subset(anorexia, Treat != "Control")
```

## Visualization

```{r}
#| layout-ncol: 2
#| fig-height: 3
#| fig-width: 4
ggplot(treat_only, aes(x = Prewt)) +
  geom_histogram(bins = 15)

ggplot(treat_only, aes(x = Postwt))+
  geom_histogram(bins = 15)
```


## Numerical Summary

```{r}
mean(treat_only$Prewt)
mean(treat_only$Postwt)
```


## Conduct a test

```{r}
pre <- treat_only$Prewt
post <- treat_only$Postwt
t.test(post, pre, paired = TRUE)
```


## Conclusion/Interpretation
<!-- Type your interpretation in the space below this line -->
There is strong evidence that anorexic patients who received any treatment have higher post-treatment weight on average. Plausible values for the true effect size (weight gain) given by the confidence interval are between 2.4 and 6.8 pounds. 



<!-- Remember to Render your document, that your name appears at the top, and that all your work and output are correctly displaying. Then, submit the finished product to ICON for grading. Good work! -->
