Contents
ISYE 6501 HW5
Question 8.1 2
Question 8.2 2
Discussion of the data and disclaimer about my results 2
Start of code for Question 8.2 4
Investigating scaling the data 5
Investigating the unscaled data
...
Contents
ISYE 6501 HW5
Question 8.1 2
Question 8.2 2
Discussion of the data and disclaimer about my results 2
Start of code for Question 8.2 4
Investigating scaling the data 5
Investigating the unscaled data 15
Looking at regression on unscaled data 23
Evaluation of scaled vs. unscaled data 23
Determining which predictors to use in my regression model using p values 24
Choosing predictors based on Coefficient estimates from scaled data 24
predictions based on different models 25
Predictions from model based on p values 25
Predictions based on coefficients 25
Comparing to model using all of the quantitative predictors 26
Comparing plots of the three regression models 26
Analysis of plots 32
Using cross validation to compare each of the models 33
Findings based on cross validation: 40
Comparing AIC values for each model 40
Comparing BIC values for each model 41
Comparing corrected AIC corrected 41
Deciding which model to choose 41
Question 8.1
Describe a situation or problem from your job, everyday life, current events, etc., for which a linear regression model would be appropriate. List some (up to 5) predictors that you might use.
In my job as a secondary school teacher, we often have to determine whether or not a student is suitable for pursuing a certain subject at a more advanced level in secondary school. For example, as a math teacher, I would be concerned with whether of not the
students who chose the subject “Additional Mathematics” are likely to do well in the subject, because of limited spaces in the class, and also for the sake of ensuring that students do subjects that they are well suited to. We can use historical data in the form of students’ math scores in “lower school”, students percentage absenteeism, students’ punctuality record, students’ overall average in all subjects, and students’ participation in mathematics competitions as predictors in a regression model for their performance in “Additional Mathematics” at the end of fifth form.
Question 8.2
Using crime data from http://www.statsci.org/data/general/uscrime.txt (file uscrime.txt, description at http://www.statsci.org/data/general/uscrime.html ), use regression (a useful R function is lm or glm) to predict the observed crime rate in a city with the following data:
M = 14.0 So = 0 Ed = 10.0 Po1 = 12.0 Po2 = 15.5 LF = 0.640 M.F = 94.0 Pop = 150 NW = 1.1
U1 = 0.120 U2 = 3.6 Wealth = 3200 Ineq = 20.1 Prob = 0.04 Time = 39.0
Show your model (factors used and their coefficients), the software output, and the quality of fit. *
Note that because there are only 47 data points and 15 predictors, you’ll probably notice
some overfitting. We’ll see ways of dealing with this sort of problem later in the course.
Discussion of the data and disclaimer about my results
I went to the recommended website, http://www.statsci.org/data/general/uscrime.html to look at the descriptions of the data, this is what the website said:
“Criminologists are interested in the effect of punishment regimes on crime rates. This has been studied using aggregate data on 47 states of the USA for 1960. The data set contains the following columns:
Variable Description
...............................................................................continued.................................................................................................
[Show More]