Worked examples are one of the easiest ways to learn statistical methods in Excel and one of the most practical ways to teach them. Instead of starting from abstract formulas alone, a workbook-based example lets you see the full workflow in one place:
- the raw data
- the analysis setup
- the live worksheet formulas
- the fitted output
- the interpretation
This tutorial shows how one Excel workbook can support both biomedical use cases and teaching use cases with BESH Stat NG.
The workbook is built around three real-world examples:
- a binomial GLM example for clinical risk modeling
- a multinomial logistic regression example for multiclass diagnosis
- an ordinal logistic regression example for ordered severity grading
Each example uses live BESH Stat NG UDFs so that the analysis logic stays visible directly in the worksheet.
Download the example workbook
The workbook contains these sheets:
- README — workbook overview and suggested reading order
- Worked_Examples — quick guide to the biomedical questions, UDFs, and teaching goals
- Template_Patterns — reusable workbook design ideas
- GLM_Data — binary clinical outcome dataset
- GLM_Template — formula-driven binomial GLM example
- MN_Data — multiclass dermatology dataset
- MN_Template — formula-driven multinomial logistic regression example
- ORD_Data — ordered heart-disease dataset
- ORD_Template — formula-driven ordinal logistic regression example
- Sources — dataset and documentation links
Why worked examples help biomedical and teaching users
A worked example is useful because it connects the statistical method to a real question.
For biomedical users, that means a worksheet can show how the model supports:
- diagnostic discrimination
- multiclass clinical labeling
- severity grading
- scenario-based prediction
For teachers and learners, a worked example is useful because the workflow is easier to follow when the workbook shows:
- the source variables
- the control block
- the formula text
- the fit handle
- the live result spills
This makes the workbook useful in two ways at the same time:
- as a practical analysis example
- as a teaching document that explains how the method works in Excel
How to use this workbook
A good way to read the workbook is:
- open Worked_Examples for a fast overview
- look at Template_Patterns to understand the common sheet structure
- GLM_Template
- MN_Template
- ORD_Template
- check Sources for documentation and dataset provenance
The workbook is organized so the same structure repeats:
- raw data stays on a data sheet
- the template sheet contains a control block
- a fit handle cell stores the model
- live worksheet formulas return summary, tests, classification, and prediction output
That repeated design makes the workbook easier to teach, easier to reuse, and easier to validate.
Worked example 1: binary GLM risk modeling
The first example shows a binomial GLM workflow for a binary clinical outcome.
Biomedical question
Which patient features raise the probability of a malignant diagnosis rather than a benign diagnosis?
Dataset
The workbook uses a breast cancer diagnostic dataset with a binary outcome:
- malignant
- benign
The predictors used in the worksheet are:
mean_radiusmean_texturemean_smoothnessworst_concave_points
Why this is a good teaching example
This example is a strong starting point because it introduces several important ideas in one sheet:
- binary-outcome modeling
- the fit-handle pattern
- summary output
- model tests
- classification output
- threshold review
- calibration output
- Brier score
- scenario-based prediction
Main sheet
Open:
- GLM_Data
- GLM_Template
Control block
The GLM template includes a visible control block for:
- predictor names
- family
- link
- formula text
- classification threshold
- alpha
- iteration limit
- tolerance
This is important because it keeps the model settings readable directly in the workbook.
Fit handle formula
=BESH.REGR.GLM_FIT(GLM_Data!$E$2:$E$570,GLM_Data!$A$2:$D$570,$B$5,$B$6,$B$7,,,TRUE,$B$8,"relative",,,$B$11,$B$12,$B$10)Summary formula
=BESH.REGR.GLM_SUMMARY($B$13,TRUE,$B$10)Threshold formula
=BESH.REGR.GLM_THRESH($B$13,$A$33:$A$41,TRUE)Scenario prediction formula
=BESH.REGR.GLM_PRED($B$13,$B$48:$E$51,,TRUE)What this example teaches
This sheet is especially useful when teaching how a clinical risk model moves from fitting to interpretation on:
- How predictors influence the fitted risk
- threshold changes classification performance
- a calibration and Brier score extend model evaluation
- to score new hypothetical profiles directly in the workbook
Teaching interpretation
This example works well as the first model in a classroom sequence because it is easier to explain than the multicategory models that come later. It introduces the workbook logic and the idea of a fit handle while keeping the outcome structure simple.
Worked example 2: multinomial outcome modeling for multiclass diagnosis
The second example moves from a binary outcome to a nominal multicategory outcome.
Biomedical question
How do clinical predictors separate several different diagnostic classes?
Dataset
The workbook uses a dermatology dataset with six outcome classes.
The predictors used in the template are:
ageerythemascalingitchingdef_borders
Why this is a good teaching example
This example is useful because it shows the difference between:
- a binary outcome
- a multiclass nominal outcome
The diagnosis categories are distinct, but they are not naturally ordered. That makes multinomial logistic regression the correct model family.
Main sheet
Open:
- MN_Data
- MN_Template
Fit handle formula
=BESH.REGR.MNLOGIT_FIT(MN_Data!$F$8:$F$365,MN_Data!$A$8:$E$365,$B$5,,,$B$7,TRUE,$B$6,"relative",$B$9,$B$10,$B$8)Summary formula
=BESH.REGR.MNLOGIT_SUMMARY($B$12,TRUE,$B$8)Classification formula
=BESH.REGR.MNLOGIT_CLASS($B$12,TRUE)Scenario prediction formula
=BESH.REGR.MNLOGIT_PRED($B$12,B48:F51,,TRUE)What this example teaches
This template is useful for showing:
- reference-category contrasts
- class-specific coefficient interpretation
- multiclass classification output
- scenario-based scoring for new profiles
Teaching interpretation
This is a good second worked example because it builds naturally on the binary GLM sheet. Once the learner understands the fit-handle pattern, this sheet shows how the same workbook structure can be extended to a multiclass problem.
Worked example 3: ordinal outcome modeling for severity grading
The third example uses an ordered clinical outcome.
Biomedical question
Which predictors shift a patient toward higher heart-disease severity grades?
Dataset
The workbook uses a heart-disease dataset with an ordered outcome coded from:
01234
The predictors used in the template are:
agesexcpthalacholdpeakexang
Why this is a good teaching example
This example is useful because it shows the difference between:
- a nominal multicategory outcome
- an ordered multicategory outcome
Here the categories represent a progression, so the ordering matters.
Main sheet
Open:
- ORD_Data
- ORD_Template
Visible formula text
The ordinal template keeps the model design visible in the worksheet with:
A + factor(B, ref=0) + factor(C, ref=1) + D + E + factor(F, ref=0)Fit handle formula
=BESH.REGR.ORDLOGIT_FIT(ORD_Data!$G$8:$G$310,ORD_Data!$A$8:$F$310,$B$5,,,$B$7,$B$6,"relative",$B$9,$B$10,$B$8)Summary formula
=BESH.REGR.ORDLOGIT_SUMMARY($B$12,TRUE,$B$8)Model tests formula
=BESH.REGR.ORDLOGIT_TESTS($B$12,TRUE)Classification formula
=BESH.REGR.ORDLOGIT_CLASS($B$12,TRUE)What this example teaches
This template is useful for showing:
- proportional-odds modeling
- ordered outcomes
- visible factor terms in worksheet formula text
- threshold / cutpoint interpretation
- the difference between ordinal and multinomial thinking
Teaching interpretation
This is a strong final example because it is conceptually richer than the first two. By the time the reader reaches this sheet, the repeated workbook structure makes it easier to focus on the modeling differences rather than the worksheet mechanics.
Suggested teaching flow
The workbook is designed to work well in this order:
1. Start with the binary GLM example
This introduces the fit-handle pattern and the idea of live result spills in the simplest setting.
2. Move to multinomial regression
This adds multiclass nominal outcomes and shows how the same worksheet design can handle a more complex classification problem.
3. Finish with ordinal regression
This introduces ordered outcomes and visible factor(...) terms in the worksheet logic.
That sequence makes the tutorial useful both for self-study and for classroom use.
How to reuse the workbook in a new study
This workbook is meant to be reusable.
In many cases, adapting it to a new study only requires:
- replacing the raw data
- updating the predictor names
- updating the formula text
- adjusting the reference category
- adjusting alpha, iteration limits, or tolerance
- editing the scenario rows where prediction is used
The sheet structure can usually stay the same.
That is one of the main strengths of formula-driven workbook examples.
Practical workbook rules
If you adapt the workbook, these rules help keep it stable and readable:
- keep raw data separate from outputs
- do not type inside spill ranges
- edit control-block cells instead of rewriting live formulas
- keep source URLs visible
- keep prediction scenarios separate from live result spills
These rules make the workbook easier to maintain and easier to teach from.
Compatibility note for older Excel versions
This workbook works best in modern versions of Excel that support dynamic arrays and spill ranges.
Older versions of Excel do not support spills. In those versions, users may need to enter the expected output as array formulas over a preselected output range instead of relying on automatic spill behavior.
In practice, that usually means:
- select the full output range first
- enter the formula
- confirm it as an array formula rather than a normal formula
Depending on the Excel version, that may require the traditional Ctrl+Shift+Enter workflow.
So the same BESH Stat NG logic can still be used in older Excel, but the workbook may require more manual array-formula entry.
Validation and source transparency
These worked examples are designed to be transparent and reusable.
The workbook preserves:
- the raw data layout
- the control settings
- the visible formula logic
- the source URLs
That makes it easier to use the workbook as:
- a teaching resource
- a reusable analysis template
- a validation-friendly example
For a broader overview of how BESH Stat NG results are checked, including reference datasets, automated tests, and comparison workflows, see the Validation page.
Summary
BESH Stat NG makes it possible to build worked biomedical examples in Excel that are also useful for teaching.
In this tutorial workbook:
- the GLM sheet shows binary clinical risk modeling
- the multinomial sheet shows multiclass diagnosis
- the ordinal sheet shows ordered severity grading
Together, these examples show how one workbook can support:
- biomedical interpretation
- classroom teaching
- reusable template design
- transparent worksheet-based analysis
Frequently asked questions
What is the purpose of a worked-examples workbook?
A worked-examples workbook shows a full analysis workflow in one place so that the data, settings, formulas, and outputs are visible together.
Why start with the GLM example?
The binary GLM example is the easiest starting point because it introduces the fit-handle pattern and live worksheet output in a simpler outcome setting.
What is the difference between the multinomial and ordinal examples?
The multinomial example is for nominal outcome categories with no natural order. The ordinal example is for ordered categories where the ranking matters.
Can this workbook be reused with a different dataset?
Yes. In many cases, the same workbook structure can be reused by replacing the raw data and updating the control-block settings.
Can older Excel versions use this workbook?
Yes, but older non-spill versions of Excel may require manual array-formula entry over preselected output ranges instead of automatic spills.