FI 4090
Assignment 3: Logistic Regression
(Individual Submission)
Due Date: Week 10 (Monday, 11/04/2019) by 9:00 am
Note: Quiz 3B in iCollege will be based on this Assignment. Please have your R program available in running condition when you take the quiz. You will need solutions of your program to take the quiz. Quiz 3B is not under lock down browser.
Part 1 (100 points)
Analyze the data in the CreditCard dataset in AER package. (Note that you have to install AER package and any other additional package that are required by AER)
The following variables are included in the dataset:
1. card: was the application for a card accepted? (Binary: 1/0) Response Variable
2. reports: Number of major derogatory reports
3. income: Yearly income (in USD 10,000)
4. Age: Age in years plus 12ths of a year
5. Owner: Does the individual own his/her home?
6. dependents: number of dependents
7. months: Months living at current address
8. share: ratio of monthly credit card expenditure to yearly income
9. selfemp: Is the individual self-employed?
10. majorcards: number of major credit cards held
11. active: number of active credit accounts
12. expenditure: average monthly credit card expenditure
Use variables 2 to 8 to determine which of the predictors influence the probability that an application is accepted. Online Quiz 3B will be based on your analysis below:
- Provide summary stat of the predictors. (5 points)
- There are some values of variable age under one year. Consider data with age>18 for your analysis for the rest of the questions. (5 points)
- Plot of income vs. reports (Number of major derogatory reports): mark individuals with card application accepted as blue, and not accepted as red. (5 points)
The online Quiz will be based on your interpretation of the plot.
- Boxplots of income as a function of card acceptance status. Boxplots of reports as a function of card acceptance status (mark card application accepted as blue, and not accepted as red). (Display two boxplots in same page). (10 points)
- Construct the histogram for the predictors. (5 points)
Note that share is highly right-skewed, so log(share) will be used in the analysis. reports is also extremely right skewed (most values of reports are 0 or 1, but the maximum value is 14. To reduce the skewness, log(reports+1) will be used for your analysis. Highly skewed predictors have high leverage points and are less likely to be linearly related to the response.
- Use variables 2 to 8 to determine which of the predictors influence the probability that an application is accepted. Use the summary function to print the results. (10 points)
Online Quiz will be based on the following and related concepts:
- Do any of the predictors appear to be statistically significant? If so, which ones? Explain how each of the significant predictors influences the response variable.
- To predict whether the application will be accepted or not, convert the predicted probabilities into class labels yes with the following condition: probs >.5=”yes”. Compute the confusion matrix and overall fraction of correct predictions. (30 points)
Online Quiz will be based on the following and related questions:
- Explain what the confusion matrix is telling you about the types of mistakes made by logistic regression (false positive, false negative, overall correct predictions).
- Now fit the logistic regression model using a training data for observations 1 to 1000. Compute the confusion matrix and the overall fraction of correct predictions for the test data (that is, the data for observations 1001 to end of data.) (30 points)
Online Quiz will be based on the following and related questions:
- Explain what the confusion matrix is telling you about the types of mistakes made by logistic regression (false positive, false negative, overall correct predictions).
Useful hints:
- Run the glm() logistic regression on the training data.
- Use test data in the predict() function to predict the card acceptance probability on the test observations on the basis of the predicted model.
- To predict whether a card will be accepted (yes/no), convert the predicted probabilities into class labels “yes” or “no” on the test data.
- Compute the accuracy of the model on the test observations based on predicted (yes/no) and actual (yes/no) of card acceptance.
Deliverables:
- Submit R scripts electronically in iCollege in the corresponding Assignment tab. (individual submission)
- Please submit one R program (one file) containing all the parts of the assignment (mark/comment so that each part is separated clearly in the program). R code should provide comments on each sections of the assignment the code is intended for.
- The assignment submission grade will be based on whether you have completed each part of the analysis and whether your R code run through all the parts of analysis. Your grade will be based not only on the correctness of the program but also how efficiently the program executes the tasks.
- Note that you do not have to write your response to the above questions related to the interpretation of the model results in the R code. If you do write the responses in the R program – it will not be part of your grade.
- The quiz 3B will have questions that will test your conceptual understanding of the output/results of the model and the data. Make sure you understand the relevant concepts of the analysis in each part before you take the online quiz.
Do not submit a separate word document explaining your results