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:30
8000 + 8800 + 8000 + 8 million + 80 trillion + another a katrillion equals
Answers: 1
question
Mathematics, 21.06.2019 20:20
How do the number line graphs of the solutions sets of -23 > x and x-23 differ?
Answers: 1
question
Mathematics, 22.06.2019 03:30
Georgia needs to buy flea treatment for her dog. pet store 1 is offering the flea treatment for 40 percent off plus an additional 25 percent off their regular price of $33. pet store 2 is offering the same flea treatment for 55 percent off plus an additional 5 percent off their regular price of $34. which location is offering the better price and how much cheaper is it? the flea treatment is $0.31 cheaper at pet store 2. the flea treatment is $1.05 cheaper at pet store 2. the flea treatment is $2.05 cheaper at pet store 1. the flea treatment is $2.36 cheaper at pet store 1.
Answers: 2
question
Mathematics, 22.06.2019 03:30
Find the simplified product: 2sqrt 5x^3(-3sqrt10x^2) a: -30sqrt2x^5 b: -30x^2sqrt2x c: -12x^2sqrt5x d: -6sqrt50x^5
Answers: 2
You know the right answer?
4. classification models: logistic regression 4.1 create a new data set named auto2 that is identic...
Questions
Questions on the website: 13722359