0% found this document useful (0 votes)
25 views7 pages

LR CVD

The document summarizes the results of running a logistic regression model on a cardiovascular disease dataset to predict patient outcomes. It reports that 2 rows had missing values and were excluded. The model achieved an accuracy of 74% and sensitivity of 62.5%. Thresholds of 0.1, 0.2, 0.3 and 0.4 were tested, showing accuracy, sensitivity and specificity tradeoffs. The logistic regression coefficients and their significance values are also provided.

Uploaded by

Avijit Chaudhuri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views7 pages

LR CVD

The document summarizes the results of running a logistic regression model on a cardiovascular disease dataset to predict patient outcomes. It reports that 2 rows had missing values and were excluded. The model achieved an accuracy of 74% and sensitivity of 62.5%. Thresholds of 0.1, 0.2, 0.3 and 0.4 were tested, showing accuracy, sensitivity and specificity tradeoffs. The logistic regression coefficients and their significance values are also provided.

Uploaded by

Avijit Chaudhuri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

In [4]: runfile('C:/Users/TECB-M114/.spyder-py3/CVD_LR_FINAL.

py', wdir='C:/Users/TECB-
M114/.spyder-py3')
Total number of rows with missing values is 2
since it is only 1 percent of the entire dataset the rows with missing values are excluded.

1
2
Optimization terminated successfully.
Current function value: 0.405550
Iterations 7
CI 95%(2.5%) CI 95%(97.5%) Odds Ratio pvalue
const 0.000567 0.025715 0.003817 0.000
cp 1.179412 2.941215 1.862500 0.008
restecg 1.016679 2.403018 1.563041 0.042
ca 1.532832 4.402983 2.597890 0.000
thal 1.277471 1.983525 1.591822 0.000
C:\Users\TECB-M114\Anaconda3\lib\site-packages\sklearn\linear_model\logistic.py:432:
FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to
silence this warning.
FutureWarning)
The acuuracy of the model = TP+TN/(TP+TN+FP+FN) = 0.7419354838709677
The Missclassification = 1-Accuracy = 0.25806451612903225
Sensitivity or True Positive Rate = TP/(TP+FN) = 0.625
Specificity or True Negative Rate = TN/(TN+FP) = 0.8666666666666667
Positive Predictive value = TP/(TP+FP) = 0.8333333333333334
Negative predictive Value = TN/(TN+FN) = 0.6842105263157895
Positive Likelihood Ratio = Sensitivity/(1-Specificity) = 4.687500000000001
Negative likelihood Ratio = (1-Sensitivity)/Specificity = 0.43269230769230765
With 0.1 threshold the Confusion Matrix is
[[ 6 9]
[ 4 12]]
with 18 correct predictions and 4 Type II errors( False Negatives)

Sensitivity: 0.75 Specificity: 0.4

With 0.2 threshold the Confusion Matrix is


[[ 9 6]
[ 5 11]]
with 20 correct predictions and 5 Type II errors( False Negatives)

Sensitivity: 0.6875 Specificity: 0.6

With 0.3 threshold the Confusion Matrix is


[[12 3]
[ 5 11]]
with 23 correct predictions and 5 Type II errors( False Negatives)

Sensitivity: 0.6875 Specificity: 0.8

3
With 0.4 threshold the Confusion Matrix is
[[13 2]
[ 6 10]]
with 23 correct predictions and 6 Type II errors( False Negatives)

Sensitivity: 0.625 Specificity: 0.8666666666666667

Optimization terminated successfully.


Current function value: 0.405550
Iterations 7
Optimization terminated successfully.
Current function value: 0.406183
Iterations 7
Optimization terminated successfully.
Current function value: 0.406961
Iterations 7
Optimization terminated successfully.
Current function value: 0.407785
Iterations 7
Optimization terminated successfully.
Current function value: 0.411029
Iterations 7
Optimization terminated successfully.
Current function value: 0.416724
Iterations 7
Optimization terminated successfully.
Current function value: 0.423973
Iterations 7
Optimization terminated successfully.
Current function value: 0.430489
Iterations 6
Optimization terminated successfully.
Current function value: 0.437148
Iterations 6
Optimization terminated successfully.
Current function value: 0.447212
Iterations 6
Results: Logit
=================================================================
Model: Logit Pseudo R-squared: 0.346
Dependent Variable: Outcome AIC: 146.8468
Date: 2019-10-17 02:01 BIC: 161.9990
No. Observations: 153 Log-Likelihood: -68.423
Df Model: 4 LL-Null: -104.61
Df Residuals: 148 LLR p-value: 7.1866e-15
Converged: 1.0000 Scale: 1.0000
No. Iterations: 6.0000
-------------------------------------------------------------------
Coef. Std.Err. z P>|z| [0.025 0.975]
-------------------------------------------------------------------
const -5.5683 0.9733 -5.7212 0.0000 -7.4758 -3.6607
cp 0.6219 0.2331 2.6678 0.0076 0.1650 1.0788
restecg 0.4466 0.2194 2.0353 0.0418 0.0165 0.8767
ca 0.9547 0.2692 3.5467 0.0004 0.4271 1.4823
thal 0.4649 0.1122 4.1416 0.0000 0.2449 0.6849
=================================================================

4
5
6
In [5]:

You might also like