--- title: "Assignment: interactions in linear models" output: html_document --- # Exercise 1 Read the following fragments from the "Applied multiple regression" book which you can find on the course webpage. We will be interested in Chapter 7 ("Interactions Among Continuous Variables"). Students who are interested (that is a majority) should read the whole chapter, but if some of you cannot manage 50 pages, read the following sections: - 7.1 Introduction (p. 255 - 260) - 7.2 Centering Predictors And The Interpretation Of Regression Coefficients In Equations Containing Interactions (p. 261 - 267) - 7.3 Simple Regression Equations And Simple Slopes (p. 267 - 272) - 7.4.1 Standard Error of Simple Slopes, 7.4.3 Test of Significance of Simple Slopes (p. 272-273) - 7.7 Patterns of First-Order and Interactive Effects (p. 285 - 286, only first subsection) # Exercise 2 In our analysis of relationships between years of service, years since PhD, and salary we have noticed that $R^2$ of the model with interaction is much larger than $R^2$ of the model without one. Is this difference statistically significant? Check it using the method for nested models. ```{r, echo = F} # Your code here ``` # Exercise 3 Load the `carData` library which contains `Ginzberg` dataset. This dataset concerns patients treated for depression. In the `depression` column are scores of the Beck Depression Inventory (https://en.wikipedia.org/wiki/Beck_Depression_Inventory). In the `fatalism` column are scores on the fatalism scale (I guess this one: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2924582/). In the `simplicity` column is a score measuring a subject's need to see the world in black and white. Fit a model with interaction with depression as a dependent variable ```{r} # Your code here ``` Then answer the following questions: 1. What is the pattern of interaction here? Describe it and illustrate it using plots from the `interactions` library (or some other graphical representation). ```{r} # Your code here ``` 2. Is the model with interaction better fitted to the data compared to the model without it? Compare their $R^2$ statistics. ```{r} # Your code here ```