Question
Load Pima Indians Diabetes Data from mlbench library through the following process: library(mlbench) data(PimaIndiansDiabetes) head(PimaIndiansDiabetes) a. Fit a logistic regression model using the variable diabetes
Load Pima Indians Diabetes Data from mlbench library through the following process: library(mlbench) data(PimaIndiansDiabetes)
head(PimaIndiansDiabetes)
a. Fit a logistic regression model using the variable diabetes as the response and the other variables as the predictors. (Hint: in the formula part of the function call, you use the following statement: diabetes~pregnant+glucose+pressure+triceps+insulin+mass+pedigree+age) Summarize the model fitting results and report which variables are statistically significant.
b. What is the odds ratio for diabetes=pos between age=30 and age=40 given that all the other predictor variables are fixed at the same level?
c. Predict the probability for diabetes=pos (positive) for a new observation with the following values for the response variables: pregnant=3 glucose= 137 pressure=50 triceps=21 insulin=0 mass=23 pedigree=0.677 age=52 Hint: Create x.new object and use the following function to get the probability: predict(glm.fit,x.new,type='response')
d. Create a plot for the ROC curve. What can you say about the model performance?
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