**You may discuss homework problems with other students, but you have to prepare the written assignments yourself. **

**Please combine all your answers, the computer code and the figures into one file, and submit a copy in your dropbox on canvas.**

**Due date: February 17, 2017.**

A researcher in a scientific foundation wished to evaluate the relation between intermediate and senior level annuals salaries of bachelor’s and master’s level mathematicians (`Y`

, in thousand dollars) and an index of work quality (`X1`

), number of years of experience (`X2`

), and an index of publication success (`X3`

). The data for a sample of 24 bachelor’s and master’s level mathematicians can be found at http://www.stanford.edu/class/stats191/data/math-salaries.table.

Obtain the scatter plot matrix and the correlation matrix of the table. Summarize the results.

Fit a linear regression model for salary based on

`X1, X2, X3`

. Report the fitted regression function.Test the overall goodness of fit for the regression model at level $\alpha = 0.05$. Specify the null and alternative hypotheses, as well as the test used.

Give Bonferroni corrected simultaneous 95 % confidence intervals for $\beta_1, \beta_2, \beta_3$.

What is the $R^2$ of the model? How is the $R^2$ interpreted? What is the adjusted $R^2$?

The researcher wishes to find confidence interval estimates at certain levels of the

`X`

variables found in http://stats191.stanford.edu/data/salary_levels.table. Construct Bonferonni corrected simultaneous 90% confidence intervals at each of the columns of the above table.

The dataset `state.x77`

in R contains the following statistics (among others) related to the 50 states
of the United States of America:

`Population`

: population estimate (1975)`Income`

: per capita income (1974)`Illiteracy`

: illiteracy (1970, percent of population)`HS.Grad`

: percent high school graduates (1970)

In [ ]:

```
state.data = data.frame(state.x77)
```

We are interested in the relation between Income and other 3 variables.

1. Produce a 4 by 4 scatter plot of the variables above.

2. Fit a multiple linear regression model to the data with Income as the dependent variable, and Population, Illiteracy, HS.Grad as the independent variables. Comment on the significance of the variables in the model using the result of summary.

3. Produce standard diagnostic plots of the multiple regression fit in part 2.

4. Plot dffits of the observations and find observations which have high influence, using critical value 0.5.

5. Plot Cook's distance of the observations and find observations which have high influence, using critical value 0.1. Compare with the result of part 4.

6. Find states with outlying predictors by looking at the leverage values. Use critical value 0.3.

7. Find outliers, if any, in the response. Remove them from the data and refit a multiple linear regression model and compare the result with the previous fit.

8. As a summary, find all the influential states using `influence.measures`

function.

The dataset `iris`

in `R`

gives the measurements in centimeters of the
variables sepal length and width and petal length and width, respectively, for
50 flowers from each of 3 species of iris.

In [ ]:

```
data(iris)
```

Fit a multiple linear regression model to the data with sepal length as the dependent variable and sepal width, petal length and petal width as the independent variables.

Test the reduced model of $H_0: \beta_{\tt sepal width}=\beta_{\tt petal length} = 0$ with an F-test at level $\alpha=0.05$

Test $H_0: \beta_{\tt sepal width} = \beta_{\tt petal length}$ at level $\alpha=0.05$

Test $H_0: \beta_{\tt sepal width} < \beta_{\tt petal length}$ at level $\alpha=0.05$.

We revisit Tomasetti's and Vogelstein's study on cancer incidence across tissues from Assignment 2. The second part of their paper deals with the existence of two clusters in the dataset: According to the authors, D-tumours (D for deterministic) can be attributed to some degree to environmental and genetic factors, while the risk of R-tumours (R for replicative) is affected mainly by random mutations occuring during replication of stem cells.

The dataset also includes a column

`Cluster`

according to the classification of that tumour as Deterministic or Replicative. Fit a linear model as in Assignment 2, but with a different slope for D- and R-tumours.Draw a scatterplot, as well as the two regression lines.

Conduct a F-test to compare the regression model above to the regression model which does not account for this classification. What is the p-value?

Given that in the study the two clusters were assigned based on the dataset (i.e. based on

`Lscd`

and`Risk`

), do you think the logic behind the p-value from part 3 is OK?

(Remark: The authors did not actually conduct the F-test from part 1; they only argued that the two "clusters" are meaningful.)

A research laboratory was developing a new compound for the relief of severe cases of hay fever. In an experiment with 36 volunteers, the amounts of the two active ingredients (factors `A`

and `B`

) in the compound were varied at three levels each. Randomization was used in assigning four volunteers to each of the nine treatments. The data can be found at http://stats191.stanford.edu/data/hayfever.table.

Fit the two-way ANOVA model, including interactions. What is the estimated mean when Factor

`A`

is 2 and Factor`B`

is 1?Using

`R`

’s standard regression plots, plot the`qqplot`

of the residuals. Is there any serious violation of normality?This question asks you to graphically summarize the data. Create a plot with Factor

`A`

on the x-axis, and, using 3 different plotting symbols, the mean for each level of Factor`B`

above each level of Factor`A`

(see kidney data example). Does there appear to be any interactions?Test for an interaction at level $\alpha = 0.01$.

Test for main effects of Factors A and B at level $\alpha = 0.01$.