# Check the attachments Please read the instructions and questions carefully in ” Assignment_3_ 2024.pdf” file and use “Auto.csv” to

Check the attachments

Please read the instructions and questions carefully in ” Assignment_3_ 2024.pdf” file and use “Auto.csv” to finish the assignment. You should submit both 1) an R code ; 2) A PDF report with answers through the link “Submit Assignment 3 Here”.

## Guidelines:

· Use R only for the part 2 in this assignment

· Submit both R code and Report on findings

· Work is to be done individually for this assignment

1. Suppose we collect data for a group of students in a statistics class with variables X1 =hours studied, X2

=undergrad GPA, and Y = receive an A. We fit a logistic regression and produce estimated coefficient,

𝛽̂0 = −7, 𝛽̂1 = 0.06, 𝛽̂2 = 1. (You do not need R code to solve this question).

(1) Estimate the probability that a student who studies for 50 hours and has an undergrad GPA of 3.5 gets

an A in the class. (Hint: For logistic regression, 𝑝(𝑥) = 𝑒𝛽0+𝛽1𝑋1+𝛽2𝑋2

)

1+𝑒𝛽0+𝛽1𝑋1+𝛽2𝑋2

(2) How many hours would a student with GPA 3.4 need to study to have a 50% chance of getting an A

1

in the class? (Hint: We can use the equation log (
𝑝(𝑥) ) = 𝛽

+ 𝛽 𝑋

+ 𝛽 𝑋 ))

1−𝑝(𝑥)

0 1 1 2 2

2. The following questions (3) to (8) should be answered using the
Weekly data set, which is part of the
ISLR package. This data is similar in nature to the Smarket data from this chapter’s lab, except that it contains 1089 weekly returns for 21 years, from the beginning of 1990 to the end of 2010.

(3) Use require(ISLR) and library (ISLR) to load the ISLR package.

a) Use summary( ) function to produce some numerical summaries of the
Weekly data.

b) Use pairs ( ) function to produce a scatterplot matrix of the variables of the data.

c) Do you see the relationship between
Year and
Volume? What is the pairwise correlation value between
Year and
Volume?

d) Is the relationship positive or negative?

(4) Use the full dataset to perform a logistic regression with
Direction as the dependent variable and
Lag1, Lag2, Lag3, Lag4 and
Volume as independent variables (i.e. predictors). Use the summary() function to print the results. Do any of the predictors appear to be statistically significant? If so, which ones? Take a screenshot of your outputs and then answer the questions.

(5) Based on 4)’s results, compute the confusion matrix and overall faction of correct predictions (Hint: refer the code from Chapter 4 lab session on the textbook; we use 0.5 as the predicted probability cut-off for the classifier). What is the precision rate? What is the recall rate? Take a screenshot of your output and then answer the questions.

(6) Now fit the logistic regression model using a training data period from
1990 to 2009 with
Lag 2 as the only predictor. Compute the confusion matrix and the overall fraction of correct predictions for the held out data (i.e. test data) (the data from
2010). In addition, please calculate the precision rate and recall rate. (Hint: refer the code from Chapter 4 lab session on the textbook; we use 0.5 as the predicted probability cut-off for the classifier). Take a screenshot of your output and then answer the questions.

(7) Repeat (6) using KNN with K=1. Compute the confusion matrix and the overall fraction of correct predictions for the held-out data. In addition, please calculate the precision rate and recall rate. (Hint: refer the code from Chapter 4 lab session on the textbook; If you encounter some errors such as “dims of ‘test’ and ‘train’ differ”, try to use knn(data.frame(train.X), …) ). (Use set.seed(1))

(8) Repeat (6) using KNN with K=10. Compute the confusion matrix and the overall fraction of correct predictions for the held-out data. In addition, please calculate the precision rate and recall rate.

3. The quantity
𝑝(𝑋) is called the
odds. Please answer the following questions (You do not need R code

1−𝑝(𝑋)

to solve this question):

(9) On average, what fraction of people with an odds of 0.35 of defaulting on their credit card payment will in fact default?

(10) Suppose that an individual has a 15% chance of defaulting on her credit card payment. What are the odds that she will default?

4. The logistic regression model that results from predicting the probability of default from student status can be seen in the following table. We create a dummy variable that takes on a value of 1 for students and 0 for non-students. Please answer the following questions (You do not need R code for these questions).

(11) How to explain the coefficient before Student[Yes]?

(12) If it is a non-student, what are the estimated odds? Is the probability of default less than the probability of not default?

What to submit:

1. R code.

a.

b.

c.

d.

2. Report.

a.

b.

c.

d.

e.

Should include all the code to accomplish the tasks.

Clear and concise comments to indicate what part of the assignment each code chunk pertains to.

Filename should be in the format of: LastnameFirstname_A3.R

Take screenshots of your outputs in R Studio and answer all the questions. Submit in PDF format.

Includes appropriate plots. Make sure the plots are properly labeled.

The assignment will be graded on the correctness of the answers, comprehensiveness of the analysis, clarity of results’ presentation and neatness of the report.

## image1.jpeg

Order a Similar Paper and get 15% Discount on your First Order

## Related Questions

### Guidelines for the Mental Health Paper:             Your third paper which is also your final

Guidelines for the Mental Health Paper:             Your third paper which is also your final exam will be on a Mental Health disorder such as Anxiety, Schizophrenia, Bi-Polar Disorder, Personality Disorder, or PTSD. (NOTE: These are not the only disorders.  Please do some research and locate others that might interest

### Concept Map TemplatePrimary Diagnosis: ___________________________________________________________1. Describe the pathophysiology of the

Concept Map Template Primary Diagnosis: ___________________________________________________________ 1. Describe the pathophysiology of the primary diagnosis in your own words. What are the patient’s risk factors for this diagnosis? Pathophysiology of Primary Diagnosis Causes Risk Factors (genetic/ethnic/physical) 2. What are the patient’s signs and symptoms for this diagnosis? How does the diagnosis

### Lab – Configure IPv6 Addresses on Network Devices Lab – Configure IPv6 Addresses on Network Devices TopologyAddressing

Lab – Configure IPv6 Addresses on Network Devices Lab – Configure IPv6 Addresses on Network Devices Topology Addressing Table Device Interface IPv6 Address Prefix Length Default Gateway R1 G0/0/0 2001:db8:acad:a::1 64 N/A R1 G0/0/1 2001:db8:acad:1::1 64 N/A S1 VLAN 1 2001:db8:acad:1::b 64 N/A PC-A NIC 2001:db8:acad:1::3 64 fe80::1 PC-B NIC

### pick one of the disorders and write on that disorder. the assignment should address information on the following areas:Describe the origins or history

pick one of the disorders and write on that disorder. the assignment should address information on the following areas: Describe the origins or history of the mental disorders. Describe the psychological theory or theories that relate to the mental disorders especially in the areas of diagnosis and treatment. Describe the

### CASE STUDY ANALYSISAn understanding of the musculoskeletal systems is a critically important component of disease and disorder diagnosis and

CASE STUDY ANALYSIS An understanding of the musculoskeletal systems is a critically important component of disease and disorder diagnosis and treatment. This importance is magnified by the impact that that this system may have on another. A variety of factors and circumstances affecting the emergence and severity of issues in

### Instructions posted as pdf WRITTEN REPORT INSTRUCTIONS:Written Report:  must

Instructions posted as pdf WRITTEN REPORT INSTRUCTIONS: Written Report:  must complete an individual written report summarizing their findings of approximately 700-850 words. · This report should include: · An introduction to the region and period of theatre you chose. · Overview of the mandatory aspects listed above. · Optional aspects

### Treatments for mental disorder vary depending on the theory behind the mental disorder, research of various therapies, and the efficacy (success) of the

Treatments for mental disorder vary depending on the theory behind the mental disorder, research of various therapies, and the efficacy (success) of the treatments against the disorder. The biological approach to mental disorders is often associated with the medical model, which includes the use of medications to treat and/or manage

### Discuss the implications that servant leadership,      entrepreneurship, ethics, and free market principles have had on the      industry you have

Discuss the implications that servant leadership,      entrepreneurship, ethics, and free market principles have had on the      industry you have identified. Assuming your future career will be carried out in      this industry, include a discussion of how to integrate these principles      into your vision for your career once you

### please see attachedNRNP/PRAC 6635 Comprehensive Psychiatric Evaluation TemplateWeek (enter week #): (Enter

please see attached NRNP/PRAC 6635 Comprehensive Psychiatric Evaluation Template Week (enter week #): (Enter assignment title) Student Name College of Nursing-PMHNP, Walden University NRNP 6635: Psychopathology and Diagnostic Reasoning Faculty Name Assignment Due Date Subjective: CC (chief complaint): HPI: Past Psychiatric History: · General Statement: · Caregivers (if applicable): ·

### see attachedReproduced with permission of the copyright owner. Further reproduction prohibited without permission.Reproduced with permission

see attached Reproduced with permission of the copyright owner. Further reproduction prohibited without permission. Reproduced with permission of the copyright owner. Further reproduction prohibited without permission. Reproduced with permission of the copyright owner. Further reproduction prohibited without permission. Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.

### Patient Teaching Infographic Assignment Purpose The purpose of this assignment is for students to explore the over-the-counter options to manage

Patient Teaching Infographic Assignment Purpose The purpose of this assignment is for students to explore the over-the-counter options to manage constipation. Course Outcomes This assignment enables the student to meet the following course outcomes: · CO 1: Identify the most commonly prescribed agents in the major drug classes. (POs 1,

### This assignment is very straightforward. Read all of the articles in the “Articles” module. Then pick any three (except for the one about what’s on the

This assignment is very straightforward. Read all of the articles in the “Articles” module. Then pick any three (except for the one about what’s on the ballot in Texas this year) and summarize the main points, write a few paragraphs on how they relate to what the textbook says about

### This assignment is very straightforward. Read all of the articles in the “Articles” module. Then pick any three (except for the one about what’s on the

This assignment is very straightforward. Read all of the articles in the “Articles” module. Then pick any three (except for the one about what’s on the ballot in Texas this year) and summarize the main points, write a few paragraphs on how they relate to what the textbook says about

### requirement are  the below file5. Browse the following articles to get a sense of the significance of Octavia Butler for the writers sharing their

requirement are  the below file 5. Browse the following articles to get a sense of the significance of Octavia Butler for the writers sharing their encounters with her work: She Writes Her Way to Hope, by Jesmyn Ward “The Visions of Octavia ButlerLinks to an external site.” by Lynell George

### Paper instructions:The constant change in the health care delivery system requires nurses to be flexible in their roles. Flexibility is the key

Paper instructions: The constant change in the health care delivery system requires nurses to be flexible in their roles. Flexibility is the key to success during periods of change. Professional nurses need to open themselves up to various ideas to arrive at a perspective of health care that enhances nursing

### Use the attached Excel Spreadsheet template to complete a regression analysis tracking Regular Gas Prices (the dependent variable) as affected by Crude Oil

Use the attached Excel Spreadsheet template to complete a regression analysis tracking Regular Gas Prices (the dependent variable) as affected by Crude Oil prices (the independent variable). Instructions for the three Tasks are included in the attached file. Use the naming convention SmityQ6FinalExam

### Guidelines for Essay 3-Film Analysis  In this essay, you will analyze the film Mississippi Burning directed by Alan Parker using one of the analysis

Guidelines for Essay 3-Film Analysis  In this essay, you will analyze the film Mississippi Burning directed by Alan Parker using one of the analysis approaches given to you in this document. Elements: Analysis: In the essay you should combine analyzing a film with support derived from research. You will write a film

### See AttachedThis file is too large to display.View in new window

See Attached This file is too large to display.View in new window