Question: I need the correct R code for the Logistic Regression Model. Thank you! Scenario You are a data analyst researching risk factors for heart disease

I need the correct R code for the Logistic Regression Model. Thank you!
Scenario
You are a data analyst researching risk factors for heart disease at a university hospital. You have access to a large set of historical data that you can use to analyze patterns between different health indicators (e.g.fasting blood sugar, maximum heart rate, etc.)and the presence of heart disease. You have been asked to create different logistic regression models that predict whether or not a person is at risk for heart disease. A model like this could eventually be used to evaluate medical records and look for risks that might not be obvious to human doctors. You have also been asked to create a classification random forest model to predict the risk of heart disease and a regression random forest model to predict the maximum heart rate achieved.
There are several variables in this data set, but you will be working with the following important variables:
Variable |What does it represent?
age: The persons age in years
sex: The persons sex (1=male, 0=female)
cp: The type of chest pain experienced (0=no pain, 1=typical angina, 2=atypical angina, 3=non-anginal pain)
trestbps: The person's resting blood pressure
chol: The person's cholesterol measurement in mg/dl
fbs: The person's fasting blood sugar is greater than 120mg/dl (1=true,0=false)
restecg: Resting electrocardiographic measurement (0=normal, 1=having ST-T wave abnormality, 2=showing probable or definite left ventricular hypertrophy by Estes' criteria)
thalach: The person's maximum heart rate achieved
exang: Exercise-induced angina (1=yes, 0=no)
oldpeak: ST depression induced by exercise relative to rest ('ST'relates to positions on the ECG plot)
slope: The slope of the peak exercise ST segment (1=upsloping, 2=flat, 3=downsloping)
ca: The number of major vessels (0-3)
target: Heart disease (0=no,1=yes)
Model #1-First Logistic Regression Model
Report the results of the regression model. Address the following questions in your analysis. Round all numbers to four decimal places.
Write the general form and the prediction equation of the logistic multiple regression model for heart disease (target)using variables age (age),resting blood pressure (trestbps),exercised induced angina (exang),and maximum heart rate achieved (thalach).Note: Use the equation editor to write the regression equation.
Now write the prediction model equation in terms of the natural log of odds to express the beta terms in linear form.
Note: Use the equation editor to write the regression equation.
What do the following terms, from the general form of the model above, mean in terms of an individual having a heart disease?:
pi pi /1-pi
Create this logistic regression model. Write the prediction model equation (in terms of the natural log of odds)using outputs obtained from your R script. Round all figures to four decimal places.
Interpret the estimated coefficient of the maximum heart rate achieved variable.
Model #1-First Logistic Regression Model
You have been asked to create a logistic regression model for heart disease (target)using the variables age (age),resting blood pressure (trestbps),exercised induced angina (exang)and maximum heart rate achieved (thalach).
 I need the correct R code for the Logistic Regression Model.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!