Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please use R! Thanks Consider the data set iris from the R library ggplot2. Here is the instructor's ggplot2 version packageVersion(ggplot2) ## [1] '3.1.0 You
Please use R! Thanks
Consider the data set iris from the R library ggplot2. Here is the instructor's ggplot2 version packageVersion("ggplot2") ## [1] '3.1.0 You can use help(iris) to obtain some help information on this data set, or you can do the following: library(ggplot2) data(iris) head (iris) 1.4 ## ## 1 ## 2 ## 3 ## 4 ## 5 ## 6 Sepal. Length Sepal.Width Petal.Length Petal.Width Species 5.1 3.5 0.2 setosa 4.9 3.0 1.4 0.2 setosa 4.7 3.2 1.3 0.2 setosa 4.6 3.1 1.5 0.2 setosa 5.0 3.6 1.4 0.2 setosa 5.4 1.7 0.4 setosa 3.9 From the iris data set, pick all observations for the subspecies setosa and versicolor. For each of the 2 subspecies, use set.seed (123) to randomly select 40 observations. Use these 80 observations as a training data set, and the rest 20 observations as a testing data set. Note that when there are only two subspecies setosa and versicolor, an observation either is setosa or not. (4.a) Build a logistic regression model using the train data set and apply the obtained model to the testing data set. Report classification results on the testing data set. For this task, classify an observation as versicolor if its associated predicted probability is greater than 0.5. (4.b) Build a linear discriminant analysis model using the train data set and apply the obtained model to the testing data set. Report classification results on the testing data set. (4.c) Build a quadratic discriminant analysis model using the train data set and apply the obtained model to the testing data set. Report classification results on the testing data set. (4.d) Comment on the classification results in (4.a) to (4.c). Consider the data set iris from the R library ggplot2. Here is the instructor's ggplot2 version packageVersion("ggplot2") ## [1] '3.1.0 You can use help(iris) to obtain some help information on this data set, or you can do the following: library(ggplot2) data(iris) head (iris) 1.4 ## ## 1 ## 2 ## 3 ## 4 ## 5 ## 6 Sepal. Length Sepal.Width Petal.Length Petal.Width Species 5.1 3.5 0.2 setosa 4.9 3.0 1.4 0.2 setosa 4.7 3.2 1.3 0.2 setosa 4.6 3.1 1.5 0.2 setosa 5.0 3.6 1.4 0.2 setosa 5.4 1.7 0.4 setosa 3.9 From the iris data set, pick all observations for the subspecies setosa and versicolor. For each of the 2 subspecies, use set.seed (123) to randomly select 40 observations. Use these 80 observations as a training data set, and the rest 20 observations as a testing data set. Note that when there are only two subspecies setosa and versicolor, an observation either is setosa or not. (4.a) Build a logistic regression model using the train data set and apply the obtained model to the testing data set. Report classification results on the testing data set. For this task, classify an observation as versicolor if its associated predicted probability is greater than 0.5. (4.b) Build a linear discriminant analysis model using the train data set and apply the obtained model to the testing data set. Report classification results on the testing data set. (4.c) Build a quadratic discriminant analysis model using the train data set and apply the obtained model to the testing data set. Report classification results on the testing data set. (4.d) Comment on the classification results in (4.a) to (4.c)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started