#Libraries
Using a little bit of algebra, show that \(p(x)= \frac{e^{\beta_0 +\beta_1x_1}}{1+e^{\beta_0+\beta_1x_1}}\) is equivalent to \(\frac{p(X)}{1-p(X)} = e^{\beta_0+\beta_1x_1}\). In other words, the logistic function representation and logit representation for the logistic regression model are equivalent. Note, if you can’t see these equations, use your mouse to hover over them and they should pop up.
Suppose we collect data for a group of students in a statistics class with variables X1 =hours studied, X2 =undergrad GPA, and Y = receive an A. We fit a logistic regression and produce estimated coefficient, β0 = −6, β1 = 0.05, β2 = 1. (a) Estimate the probability that a student who studies for 40 hours and has an undergrad GPA of 3.5 gets an A in the class. (b) How many hours would the student in part (a) need to study to have a 50% chance of getting an A in the class?
Create a binary variable, mpg01, that contains a 1 if mpg contains a value above its median, and a 0 if mpg contains a value below its median. You can compute the median using the median() function.
Explore the data graphically in order to investigate the association between mpg01 and the other features. Which of the other features seem most likely to be useful in predicting mpg01? Scatterplots and boxplots may be useful tools to answer this question. Describe your findings.
Split the data into a training set and a test set.
Perform LDA on the training data in order to predict mpg01 using the variables that seemed most associated with mpg01 in (b). What is the test error of the model obtained?
Perform QDA on the training data in order to predict mpg01 using the variables that seemed most associated with mpg01 in (b). What is the test error of the model obtained?
Perform logistic regression on the training data in order to predict mpg01 using the variables that seemed most associated with mpg01 in (b). What is the test error of the model obtained?
We now review k-fold cross-validation.
Explain how k-fold cross-validation is implemented.
What are the advantages and disadvantages of k-fold cross-validation relative to:
From the data in Miscellaneous Datasets , obtain the data on “Fibre Diameters and Breaking Strenghs for Nextel 610 Fibres.” (please note that there is a typo on the website. It should be Strength and not Strengh). According to the description available there, the expectation is that the log of breaking strength of the fibre should be negatively and linearly related to diameter. (Note log here means natural log if not specified.)
Produce a scatter plot of breaking strength against diameter.
Produce a scatter plot of the log of breaking strength against diameter.
Produce a scatter plot of the log of breaking strength against the log of diameter.
Regress breaking strength on diameter.
Regress the log of breaking strength on diameter.
Regress the log of breaking strength on the log of diameter.
From the data in Miscellaneous Datasets , obtain the data on “Variables associated with Permeability and Porosity of Rocks”
Fit a multiple regression model to predict porosity. Please provide a clean model with only significant variables. Interpret your model results and diagnostics.
Fit a multiple regression model to predict log(permeability). Please provide a clean model with only significant variables. Interpret your model results and diagnostics.