Question: ***Need R markdown code for 1,2,3 &4 We have a sample of males in a heart-disease high-risk region of the Western Cape, South Africa. The

***Need R markdown code for 1,2,3 &4

We have a sample of males in a heart-disease high-risk region of the Western Cape, South Africa. The variables are described as follows.

sbpsystolic blood pressure

tobaccocumulative tobacco (kg)

ldllow density lipoprotein cholesterol

adipositybody adiposity index

famhistfamily history of heart disease (Present, Absent)

typeatype-A behavior

obesitybody mass index

alcoholcurrent alcohol consumption

ageage at onset

chdresponse, coronary heart disease

To read into R:

SAheart <- read.table("http://www-stat.stanford.edu/~tibs/ElemStatLearn/datasets/SAheart.data", sep = ",", head = TRUE, row.names = 1) 
  1. Fit a logistic regression withchdbeing the response and the other variables being predictors. Report the significant predictors at the 5% significance level.
  2. Construct a 95% confidence interval for the coefficient ofsbp.
  3. Run both backward elimination and forward addition using BIC as the criterion. Do you have the same model from the two selection processes?
  4. Compute the LOOCV score for the model fitted in (a) and the model chosen by backward elimination in (c). Use 0.5 as the cutoff value when turning predicted probabilities into predicted responses. Which model has better performance according to the LOOCV score? (Reminder: in case you want to use functioncv.glm(), you need to specify thecostargument incv.glm(). Otherwise,cv.glm()uses mean squared error by default and it would be incorrect because we are dealing with binary response.)

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 Mathematics Questions!