```{=html}

<style type="text/css">

/* Cascading Style Sheets (CSS) is a stylesheet language used to describe the presentation of a document written in HTML or XML. it is a simple mechanism for adding style (e.g., fonts, colors, spacing) to Web documents. */

h1.title {  /* Title - font specifications of the report title */
  font-size: 24px;
  color: DarkRed;
  text-align: center;
  font-family: "Gill Sans", sans-serif;
}
h4.author { /* Header 4 - font specifications for authors  */
  font-size: 20px;
  font-family: system-ui;
  color: DarkRed;
  text-align: center;
}
h4.date { /* Header 4 - font specifications for the date  */
  font-size: 18px;
  font-family: system-ui;
  color: DarkBlue;
  text-align: center;
}
h1 { /* Header 1 - font specifications for level 1 section title  */
    font-size: 22px;
    font-family: system-ui;
    color: navy;
    text-align: left;
}
h2 { /* Header 2 - font specifications for level 2 section title */
    font-size: 20px;
    font-family: "Times New Roman", Times, serif;
    color: navy;
    text-align: left;
}

h3 { /* Header 3 - font specifications of level 3 section title  */
    font-size: 18px;
    font-family: "Times New Roman", Times, serif;
    color: navy;
    text-align: left;
}

h4 { /* Header 4 - font specifications of level 4 section title  */
    font-size: 18px;
    font-family: "Times New Roman", Times, serif;
    color: darkred;
    text-align: left;
}

body { background-color:white; }

.highlightme { background-color:yellow; }

p { background-color:white; }

</style>
```
```{r setup, include=FALSE}
# Detect, install and load packages if needed.
if (!require("knitr")) {
   install.packages("knitr")
   library(knitr)
}
if (!require("MASS")) {
   install.packages("MASS")
   library(MASS)
}
if (!require("nleqslv")) {
   install.packages("nleqslv")
   library(nleqslv)
}
#
# specifications of outputs of code in code chunks
knitr::opts_chunk$set(echo = TRUE,      # include code chunk in the output file
                      warnings = FALSE,  # sometimes, you code may produce warning messages,
                                         # you can choose to include the warning messages in
                                         # the output file. 
                      messages = FALSE,  #
                      results = TRUE     # you can also decide whether to include the output
                                         # in the output file.
                      )   
```


\

# Introduction

This week's assignment has two components. 

* Finding a data set for **project #1** that is due on <font color = "red"><b> Sunday, 10/1/2023.</b> </font> The detailed requirements of the data will be described in the next section.

* Fitting a simple linear regression (SLR) by selecting a numerical explanatory variable from the data set using the least square approach and then constructing 95% bootstrap confidence intervals for the regression coefficients. 

# Data Requirements and Sources

The selected data set will be used for multiple linear regression analysis and bootstrap analysis as well. In order to implement the commonly used regression techniques, the desired data must meet some requirements. You also have the flexibility to choose a data set that you are interested in so you can easily formulate the analytic questions and tell a better story from the analytic results. 

##  Data set requirements

The desired data set must have 

  + the response variable **must** be continuous random variables.
  + at least two categorical explanatory variables.
  + at least one of the categorical variables has more than two categories.
  + at least two numerical explanatory variables.
  + at least 15 observations are required for estimating each regression coefficient. For example, if your final linear model has 11 variables (including dummy variables), you need $12 \times 15 = 180$ observations. 
    
## Data Sources

The following websites contain many links to sites that have different types of data sets (some of the links may not be active).

* 10 open data sets for linear regression <https://lionbridge.ai/datasets/10-open-datasets-for-linear-regression/>

* UFL Larry Winner's Teaching Data Sets <http://users.stat.ufl.edu/~winner/datasets.html>

* The suggested data repository for this class <http://stat321.s3.amazonaws.com/w00-datasets.html>

* Datasets for Teaching (Univ. Sheffield, UK) <https://www.sheffield.ac.uk/mash/statistics/datasets>

* Data.World <https://data.world/datasets/regression>

## Post Your Selected Data on D2L

Before you start searching your data set, check the D2L discussion board and make sure you will not select the data set your classmates have already chosen for their project. After you identify your data set, please post your data set name and the link to that data set. 


    
# This Week's Data Analysis 

<center><font color = "blue"><b> Due: Sunday, 9/17/2023</b></font></center>

Please prepare an RMarkdown document to include the following two parts. Please start your work earlier to

## Description of the Data Set

Write an essay to describe the data set. The following information is expected to be included in this description.

* How the data was collected? 
* List of all variables: names and their variable types.
* What are your practical and analytic questions
* Does the data set have enough information to answer the questions

## Simple Linear Regression

Make a pair-wise scatter plot of all variables in your selected data set and choose an explanatory variable that is linearly correlated to the response variable.

* Make a pairwise scatter plot and comment on the relationship between the response and explanatory variables.
  + If there is a non-linear pattern, can you perform a transformation of one of the variables so that the transformed variable and the other original variable have a linear pattern?
  + If you have a choice to transform either the response variable or the explanatory variable, what is your choice and why?

* Fit an ordinary least square regression (SLR) to capture the linear relationship between the two variables. If you transformed one of the variables to achieve the linear relationship, then use the transformed variable in the model. and then perform the model diagnostics. Comment on the residual plots and point out the violations to the model assumptions. 

* Using the bootstrap algorithm on the **previous final linear regression model** to estimate the bootstrap confidence intervals of regression coefficients (using $95\%$ confidence level).

* compare the p-values and bootstrap confidence intervals of corresponding regression coefficients of the final linear regression model, make a recommendation on which inferential result to be reported, and justify.
