Mathematics
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)

answer
Answers: 2

Other questions on the subject: Mathematics

image
Mathematics, 21.06.2019 18:00, jenniferkane408
Look at arnold's attempt to solve the equation for b: 3b = 12 b = 3 · 12 b = 36 describe the mistake that arnold made.
Answers: 2
image
Mathematics, 22.06.2019 02:00, dontcareanyonemo
Emmanuel added 888 links per minute to his chain mail. allesia started 202020 minutes after emmanuel and added 131313 links per minute to her chain mail. how long had emmanuel worked when allesia caught up to him, and how many links had he added?
Answers: 1
image
Mathematics, 22.06.2019 03:00, lucypackham9
(: the two box-and- whisker plots below show the scores on a math exam for two classes. what 2 things do the interquartile range tell you about the two classes?
Answers: 2
image
Mathematics, 22.06.2019 03:20, 21stcenturycyber
The height of a box can be found by dividing its volume by the area of its base, bottom. what is the height of a box that has a volume of 26.35 cubic centimeter and a base area of 4 1/4 square centimeter?
Answers: 1
Do you know the correct answer?
4. classification models: logistic regression 4.1 create a new data set named auto2 that is identic...

Questions in other subjects:

Konu
Chemistry, 28.09.2019 09:30
Konu
Mathematics, 28.09.2019 09:30
Konu
Mathematics, 28.09.2019 09:30