In: Computer Science
Examine classification using logistic regression. In R console, type mtcars. The dataset mtcars is a generic dataset in R. This dataset comprises of fuel consumption and 10 aspects of automobile design and performance for 32 automobiles. Using only the variables am (0 = automatic, 1 = manual) and mpg, your task is to fit a logistic regression model. Complete the following steps using R.
We first load and perform the task with the following
codeFrom the above graph we see
that the data is not continuous and is distributed on the
extremities of both the axis. Such problems cannot be accurately
resolved or worked with a traditional linear regression approach as
linear regression best deals with continuous forms of data. However
we can solve this using a logistic regression approach which allows
us to categorize variables based on their tags and are very useful
when we need to categorize them as in this case of manual vs
automatic
The logistic regression model
can be viewed in the above segment of code with it's complete
summary.
When tested with a value of mpg=16,we obtain that the probability that it has a manual transmission is very low and the cut off being as a value of 0.5 predicts that it is automatic in nature.
Note:This might not be the optimal combination of attributes which lead to an accurate prediction of the value seen and better predictions can be obtained through more efficient decisions of better correlated attributes