Task 1
Please import the “admit.csv†into Rstudio.In this dataset,we know the GRE score,the GPA,and the rankof400 applicants for a graduate program. We also know if each of the candidates is admitted. In the admit column, 1 stands for “admittedâ€,and 0 stands for “rejectedâ€.Please answer the following questions and include thecodes.
1. import the dataset and call it \"mydata\".Then check the structure of the data
2. convert the data type of the admit and the rank column fromint to factors
3. randomly select 80%of the dataset as training set and the rest as the testingset
4. train a decision tree model, using admit as the category, andgre,gpa,and rank as predictors. Then plot the tree
5. Please answer the question: if a candidate has a GPA of 3.7, andrank of 4, does this candidate have a higher chance tobe admitted or to be rejected? Please note that when you only have two categories, the darkerproportion stands for the proportion for 1 in the end node of thetree plot
6. Please calculate the accuracy of your decision treemodel