Memuat
Memuat
Logistic Regression with fitglm for Biomedical Engineering
0 views
Model the heart disease status as a function of the total cholesterol and the blood pressure using fitglm logistic regression and assess the model fit. fitglm with a binomial distribution builds logistic regression to model the probability of a binary outcome. It suits two-class classification interpreted through odds ratios, such as pass/fail or failure/no failure.

Model the heart disease status as a function of the total cholesterol and the blood pressure using fitglm logistic regression and assess the model fit.
| Role | Variable | Unit |
|---|---|---|
| Main | Heart disease status | 0/1 |
| Supporting 1 | Total cholesterol | mg/dL |
| Supporting 2 | Blood pressure | mmHg |
Logistic regression predicts Heart disease status with accuracy 0.883 and AUC 0.958 (sensitivity 0.901, specificity 0.863); each one-unit rise in Total cholesterol multiplies the odds by 17.88.
Computed from illustrative synthetic data, not from a real study.
fitglm with a binomial distribution builds logistic regression to model the probability of a binary outcome. It suits two-class classification interpreted through odds ratios, such as pass/fail or failure/no failure.
Report coefficients, odds ratios with confidence intervals, test AUC, and confusion matrix. Choose the classification threshold with a clear reason, not automatically 0.5.
A short starting script with this project's variable names. The delivered version is adapted to your data and fully commented.
rng(3);
n = 400;
total_cholesterol = randn(n, 1);
blood_pressure = randn(n, 1);
logit = 1.5*total_cholesterol - 1.0*blood_pressure + 0.2;
heart_disease_status = double(rand(n, 1) < 1 ./ (1 + exp(-logit)));
tbl = table(total_cholesterol, blood_pressure, heart_disease_status, 'VariableNames', {'total_cholesterol', 'blood_pressure', 'heart_disease_status'});
cv = cvpartition(heart_disease_status, 'HoldOut', 0.25);
trn = tbl(training(cv), :); tst = tbl(test(cv), :);
mdl = fitglm(trn, 'heart_disease_status ~ total_cholesterol + blood_pressure', 'Distribution', 'binomial');
disp(mdl);
ci = exp(coefCI(mdl));
fprintf('Odds ratios (est, lower, upper):\n');
disp([exp(mdl.Coefficients.Estimate), ci]);
prob = predict(mdl, tst);
pred = prob > 0.5;
cm = confusionmat(tst.heart_disease_status, double(pred));
disp(cm);
[fpr, tpr, ~, auc] = perfcurve(tst.heart_disease_status, prob, 1);
fprintf('Accuracy = %.3f, AUC = %.3f\n', mean(pred == tst.heart_disease_status), auc);
figure; plot(fpr, tpr, 'LineWidth', 1.5); hold on; plot([0 1], [0 1], 'k--');
xlabel('False positive rate'); ylabel('True positive rate'); title(sprintf('ROC (AUC = %.3f)', auc));Choose how much help you need. Each higher package includes everything in the lower ones. Prices exclude 11% VAT.
Package 1
US$25
excl. 11% VAT
Duration: 5 working days
Output: MATLAB files + result figures
Deliverables
Package 2 · most chosen
US$75
excl. 11% VAT
Duration: 9 working days
Output: Code + analysis + interpretation notes
Includes all of Package 1, plus
Package 3
US$163
excl. 11% VAT
Duration: 14-17 working days
Output: Code + analysis + guidance until ready to present
Includes all of Packages 1 & 2, plus
Yes. Logistic Regression with fitglm is commonly used at this level in Biomedical Engineering. We adapt the analysis to your research question, your own data and your supervisor's requirements.
No. The sheet is computed from illustrative synthetic data so you can see the kind of output MATLAB gives. For your order we run the same method on your own data.
That is the point of the packages. Every script is commented, and Package 3 includes two coaching sessions plus practice questions so you can explain the method and the results at your seminar and defence.
Each project has three packages: Package 1 (code and explanation) US$25, Package 2 (your data analysis and interpretation) US$75 and Package 3 (full guidance) US$163, excluding 11% VAT. Larger datasets, extra methods or tight deadlines adjust the quote after a short consultation.
The result sheet uses illustrative synthetic data. MATLAB is a trademark of The MathWorks, Inc.
Back to MATLAB portfolio