Logistic and Poisson Regression: A Case Study Using the Framingham Heart Study, Cheat Sheet of Statistics

Churn Rate Regression Analysis

Typology: Cheat Sheet

2022/2023

Uploaded on 12/11/2023

karan-nahar
karan-nahar 🇺🇸

4 documents

1 / 15

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Regression Analysis
Module 4: Logistic and Poisson Regression
Outline of Lessons
1. Logistic Regression
2. Poisson Regression
3. Classification Methods and Measurements
4. Case Study1: Logistic Regression
5. Case Study 2
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Logistic and Poisson Regression: A Case Study Using the Framingham Heart Study and more Cheat Sheet Statistics in PDF only on Docsity!

Regression Analysis

Module 4: Logistic and Poisson Regression

Outline of Lessons

1. Logistic Regression

2. Poisson Regression

3. Classification Methods and Measurements

4. Case Study1: Logistic Regression

5. Case Study 2

Nicoleta Serban

Gamze Tokol-Goldsman

Dave Goldsman

Regression Analysis

Module 4: Logistic and Poisson Regression

H. Milton Stewart School of Industrial and Systems Engineering

4.5 Case Study 2

Variables deep-dive

Variable Description Sex Male or female(Nominal) Age Age of the patient Current Smoker Whether or not the patient is a current smoker (Nominal) Cigs per day the number of cigarettes that the person smoked on average in one day BP Meds whether or not the patient was on blood pressure medication (Nominal) Prevalent Stroke whether or not the patient had previously had a stroke (Nominal) Diabetes whether or not the patient had diabetes (Nominal) Variable Description Tot Chol Total cholesterol level Sys BP Systolic blood pressure BMI Body Mass Index Heart Rate heart rate Glucose glucose level Prevalent Hyp whether or not the patient was hypertensive (Nominal) 10 - year CHD risk( Y Var ) 10 - year risk of coronary heart disease(CHD) (“1”, means “Yes”, “0” means “No”)

CHD vs Age

barplot(prop.table(age), axes=T, space=0.3, horiz=T, xlab="Proportion of No Heart Disease (blue) vs Heart Disease (Brown)", col=c("blue","brown"), main="Heart Disease by Age Group")

Younger adults are less likely to have

heart disease

Education Level vs CHD

barplot(prop.table(edu), axes=T, space=0.3, horiz=T, xlab="Proportion of No Heart Disease (blue) vs Heart Disease (Brown)", col=c("blue","brown"), main="Heart Disease by Education Level")

Those with 0-11 years of education (1) have the

highest rates of heart disease as compared to High

school diploma/GED (2), Some College, Vocational

School (3) and College degree or more (4)

Current Smoking vs CHD

barplot(prop.table(smoker), axes=T, space=0.3, horiz=T, xlab="Proportion of No Heart Disease (blue) vs Heart Disease (Brown)", col=c("blue","brown"), main="Heart Disease by Smoker")

Smokers have only slightly higher rates of

heart disease than non-smokers

  • #GOF test using deviance residuals
  • deviance_test <- c(deviance(lr),
  • 1 - pchisq(deviance(lr),df.residual(lr)))
  • # GOF test using Pearson residuals
  • pearres <- residuals(lr, type = "pearson")
  • pearson_tvalue <- sum(pearres^2)
  • pearson_test <- c(pearson_tvalue,
  • 1 - pchisq(pearson_tvalue, df.residual(lr)))

Logistic Regression: GOF

Deviance Test for GOF: Chi-squared statistic: 2549. P-value: 1 Pearson Test for GOF: Chi-squared statistic: 3357.441 P-value: 0.

As the p-value is large, we

accept the null hypothesis,

hence the logistic model is a

good fit the data.

Cross-Validation Set-up

R function for computing classification accuracy measures R function for outputting accuracy measures given a training model R function for computing classification accuracy measures

Naïve Bayes: Classification Accuracy

Cross Validation: K=5 folds model <- caret::train(TenYearCHD ~ ., data = data2, method = "naive_bayes", trControl = myControl, metric = "Accuracy") average_metrics <- colMeans(model$resample[, c("Accuracy.Accuracy", "Precision.Pos Pred Value", "Recall.Sensitivity", "F1.Pos Pred Value", "AUC")], na.rm = TRUE) print(average_metrics) Results Measure Accuracy 0. Sensitivity 0. Precision 0. F- Measure

AUC ROC 0.

Other ML Methods

Cross Validation: K=5 folds model <- caret::train(TenYearCHD ~ ., data = data2, method = “ ", trControl = myControl, metric = "Accuracy") average_metrics <- colMeans(model$resample[, c("Accuracy.Accuracy", "Precision.Pos Pred Value", "Recall.Sensitivity", "F1.Pos Pred Value", "AUC")], na.rm = TRUE) print(average_metrics) Classification Method:

  • Random Forest Method=“rf”
  • Gradient Bosting Method= “xgbTree”
  • Support Vector Machine Method = “svmRadial”
  • Decision Tree Method=“rpart”