STAT 542 Homework 5: Problem 1 in the Chapter 8 Exercises (in Section 8.12 of the book). Problem 2 in the Chapter 8 Exercises (in Section 8.12 of the book). Problem 5 in the Chapter 8 Exercises (in Section 8.12 of the book). Problem 8 in the Chapter 8 Exercises (in Section 8.12 of the book). Problem 9 in the Chapter 8 Exercises (in Section 8.12 of the book). Problem 3 in the Chapter 14 Exercises (in Section 14.8 of the book). [NOTE: You will have to install and load the 'macleish' package. The data are in the 'whately_2015' data frame in the 'macleish' package.] [HINT: The basic line plot of the function of temperature against time should be simple since we did a plot like this in the Chapter 3 class example code.] [HINT: For the annotations about the equinoxes and the solstices: First, you should look up what were the dates and times of the vernal and autumnal equinoxes and the summer and winter solstices in 2015 and save these dates in a character objects. Then using the tools in the 'lubridate' package that we learned in Chapter 6 Part 2, you can convert that character object into a datetime object.] [HINT: You can use an approach similar to one of the baseball home runs plots in the Chapter 7 example code to mark and annotate the locations of the boundaries of the seasons.] [NOTE: For extra credit, you can try to put four headings toward the top of the plot with the words WINTER SPRING SUMMER FALL above the portions of the graph that correspond to those seasons.] Problem 6 in the Chapter 14 Exercises (in Section 14.8 of the book). For this problem, please specifically work with the 'HousePrices' data frame in the 'AER' package. As your x-variable in the plot, use 'lotsize' from this data frame, and as your y-variable, use 'price' from this data frame. Show the resulting plot. For your interpretation, please comment on everything you can learn from the plot about the bivariate relationship between lotsize and price, and ALSO comment on the nature of the marginal distribution of each variable alone. [NOTE: You will have to install and load the 'AER' package. The data are in the 'HousePrices' data frame in the 'AER' package. You will also have to install and load the 'ggExtra' package.] This is the code from the book (you'll have to alter this code to work with the 'HousePrices' data set): p <- ggplot(HELPrct, aes(x = age, y = cesd)) + geom_point() + theme_classic() + stat_smooth(method = "loess", formula = y ~ x, size = 2) ggExtra::ggMarginal(p, type = "histogram", binwidth = 3) Problem 7 in the Chapter 14 Exercises (in Section 14.8 of the book). For this problem, see the hint below, and [NOTE: You will have to install and load the 'palmerpenguins' package (and the 'shiny' package). The data are in the 'penguins' data frame in the 'palmerpenguins' package.] HINT: You can adapt and modify the Beatles Shiny example, except your ui.R file will need TWO checkboxGroupInput sections (for choosing the species and the sex) and no numericInput sections. To allow the user to specify the variables for the scatterplot: BEFORE the 'shinyUI' part, near the top of the ui.R file, to prevent categorical variables from being chosen for the scatterplot axes, put: vars <- setdiff(names(penguins), c("species", "island", "sex", "year")) Then AFTER the h3 line in the 'shinyUI' part that states the plot's title, include: sidebarPanel( selectInput('xcol', 'X Variable', vars), selectInput('ycol', 'Y Variable', vars, selected = vars[[2]]) ), In your server.R file, when specifying the aesthetics in the ggplot function, instead of using the usual 'aes', use: aes_string(x=input$xcol, y=input$ycol) NOTE about format: For this homework, please turn in FOUR files into Blackboard: The first file should be a Word document or pdf with the answers to the questions in the form of any graphs/plots requested, and any written answers or interpretations for those problems that call for writing. The second file should be a PLAIN TEXT file (.txt file) with the code that you used to create the plots, etc. for the problems. This is specifically for the Chapter 14, Problems 3 and 6 in HW 5 because the Chapter 8 problems do not require any coding. Any lines in this text file that are NOT code should start with # so that they will be treated as comments and not executed. The third and fourth files should be related to Chapter 14 Problem 7 and should be PLAIN TEXT files titled ui.R and server.R (NOTE: NOT ui.R.txt --- save it as ui.R choosing "All Files", or rename it, to prevent an automatic .txt suffix). Any lines in this text file that are NOT code should start with # so that they will be treated as comments and not executed.