subject
Mathematics, 14.09.2019 04:30 hdjehd

4. classification models: logistic regression 4.1 create a new data set named auto2 that is identical to the auto{islr} data set (i. e., auto2=data. frame( then attach the auto2 data set – i. e., attach(auto2) 4.2 compute the median value of the miles per gallon values and store the results in an object named med. mpg. display this median. 4.3 create a new dummy variable in the data set named mpg01 to classify "high mileage" vehicles. this dummy variable will be = 1 if the mpg value is greater than the median and 0 otherwise. 4.4 set the seed to 1 (or any value you choose) to get replicable results. then draw a random sample of index numbers into a vector called train containing 80% of the row numbers in auto2. this vector will contain a random sample of 80% of the nrow(auto2) row numbers, which you will use to index the training sub-sample. note: your resulst will probably deviate slightly from mine because of the random sampling. 4.5 fit a logistic model on the training sub-sample, to predict the likelihood that a vehicle has high gas mileage (per the mpg01 variable) using cylinders, displacement, horsepower, weight, year and origin as predictors. store the results in an object named fit. logit. display the summary results. 4.6 briefly interpret the results, focusing on significant coefficients, deviance and aic. 4.7 as you know, the coefficients of this logit model represent the variable effects on the log-odds of having a high mileage car. but this is hard to interpret. to make this easier to interpret, create 3 vectors: log. odds containing the coefficients from fit. logit; odds containing the odds of these coefficients; and prob containing the probabilities that the coefficients represent. then use the cbind() function to diaplay all 3 vectors together. 4.8 now let’s do some cross-validation. use the predict() function with the attribute type="response" (which gives probabilities) to make predictions on the test data (tip: [-train,]) and save the results in an object named pred. probs. then create a vector named pred. hi. mpg containing a 1 if the probability of the vehicle being high mileage is greater than 50% and 0 otherwise (tip: use this function ifelse(pred. probs> 0.5, 1, 0)) 4.9 display a confusion matrix with these test predictions using the table() function (tip: use table(pred. hi. mpg, auto2$mpg01[-train])) 4.10 review the confusion matrix and then calculate (by hand, not with r code) the error rate, sensitivity and specificity (note: i will provide the r code to do this with the solution). 5. classification models: linear discriminant analysis (lda) 5.1 fit the same model from 4 above, but using the lda method, using again the training sub-sample. first load the {mass} library, then use the lda() function to fit the lda model and store the results in an object named lda. fit. 5.2 plot the lda. fit object. also display the lda. fit object (tip: just type lda. fit, without the summary function)

ansver
Answers: 2

Another question on Mathematics

question
Mathematics, 21.06.2019 17:00
Which graph corresponds to the function f(x) = x2 + 4x – 1?
Answers: 1
question
Mathematics, 21.06.2019 20:00
Combine like terms to make a simpler expression 3z+z
Answers: 2
question
Mathematics, 21.06.2019 22:00
I’m confused on how to work the pie charts
Answers: 2
question
Mathematics, 22.06.2019 00:00
Which is a logical conclusion based on the given information? a. figure abcd is a rhombus by the definition of a rhombus. b. segment ac is congruent to segment dc by cpctc. c. angle acb is congruent to angle adc by the angle-side-angle theorem. d. triangle acd is congruent to triangle cab by the hypotenuse-leg theorem.
Answers: 1
You know the right answer?
4. classification models: logistic regression 4.1 create a new data set named auto2 that is identic...
Questions
question
Mathematics, 12.12.2020 16:50
question
Mathematics, 12.12.2020 16:50
question
Mathematics, 12.12.2020 16:50
Questions on the website: 13722361