
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, include = TRUE,
fig.align="center",warnings = FALSE,fig.width = 5,fig.height=3)
```

For the problems in which calculations are needed, please include your \texttt{R} code with your answers, otherwise you will not be given full credit.  Please upload your assignment by Friday, March 24 in a pdf/html/word file to Sakai.

1. For each of the following studies/experiments, determine what the degrees of freedom for the model and error would be for performing an F test for statistic significance.  Also, for each categorical variable, what would R create as the baseline value?

(a).  We wish to determine if the average GPA of Loyola students is different between the four different grades (freshman, sophomore, junior, senior).  We sample a total of 50 students in each grade, i.e. 200 total students, record their GPA, and perform an F test for differences in the mean GPA between the grades.

(b).  In an experiment, 50 randomly selected overweight adults in the same geographic area are randomly assigned either a weight loss drug or a placebo (coded as placebo or weightlossdrug).  After 6 weeks, we record the amount of weight each adult lost and perform and F test for a difference in the average weight loss between the adults who received the drug and those who received the placebo.

(c).  The United States is divided into 5 unique regions: northeast, southeast, midwest, southwest, and west.  We randomly sample 1000 households in each region (5000 total households), and wish to perform an F test to determine if the average household income is different between the 5 regions.

(d).  In a school experiment, students apply three different types of fertilizer to 12 total potted plants (coded as FertA, FertB, FertC).  After 1 week, the students measure the growth of the plant and determine if there is a difference between the mean plant growth between the three different types of fertilizer.

2. Consider the dataset \texttt{ToothGrowth} available in base \texttt{R}, a dataset based on a study on the length of odontoblasts (cells repsonsible for tooth growth) in 60 guinea pigs.  Each guinea pig received either 0.5, 1, or 2 mg/day of Vitamin C by either orange juice (OJ) or absorbic acid (VC).   The dataset contains the following three variables:

- \texttt{len}: The numeric length of the tooth

- \texttt{supp}: The Vitamin C supplement type (either VC or OJ)

- \texttt{dose}: The dosage in mg/day

Use this dataset to answer the following questions:

a.  Fit a linear model for length of the teeth by dosage of the amount of Vitamin C the guinea pigs are receiving.   Perform a formal hypothesis test to determine if there is a linear relationship between Vitamin C dosage and tooth length.  Assume $\alpha = 0.05$.

```{r}
```

b. Now, suppose the experimentors wish to know if adding the Vitamin C supplement to our linear model significantly improves of the predictive ability of tooth length.

(i).  Provide least squares regression lines from this linear model for each of the two Vitamin C supplement types.

```{r}
```

(ii). What is the baseline value for supplement type that \texttt{R} creates?

(iii).  Interpret the value of the parameter associated with the indicator variable added to our model in the context of the problem. (Hint: Think of what the interpretation of the intercepts for the linear models in (i) are.)

(iv).  Perform an formal F test to determine if adding Vitamin C supplement to our linear model significantly improves of the predictive ability of tooth length.  Make sure it is clear which parameter in the model you are testing for.  Assume $\alpha = 0.05$.

```{r}
```

c.  Now, suppose we believe that the linear relationship between dosage and tooth length is different for the two different supplement types.  In other words, we wish to add an interaction term for dosage and supplement type to our model.

(i).  Provide least squares regression lines from this linear model for each of the two Vitamin C supplement types.

```{r}
```

(ii).  Interpret the value of the parameter associated with the interaction term in our model in the context of the problem.

(iii).  Perform an formal F test to determine if the linear relationship between dosage and tooth length is different between the two different supplement types.  Assume $\alpha = 0.05$.

```{r}
```

