Parametric hazard analysis for time-to-event data.
HAZARD is a statistical computing package developed at Cleveland Clinic for fitting flexible, multi-phase parametric hazard models to survival data. It implements the Conservation of Events theorem (Turner et al.) to produce models with early, constant, and late hazard phases — commonly applied to cardiac surgery outcomes and other clinical research.
Originally developed at the University of Alabama Birmingham. Currently developed and maintained at The Cleveland Clinic Foundation.
HAZARD fits three-phase parametric hazard models of the form:
h(t | X) = μ₁(X) · SG₁(t) [early phase]
+ μ₂(X) [constant phase]
+ μ₃(X) · SG₃(t) [late phase]
where each scale factor μⱼ(X) = exp(intercept_j + βⱼᵀ X) and the shaping functions SG₁, SG₃ are flexible parametric forms supporting a wide range of hazard shapes.
Key capabilities:
- Multi-phase hazard modeling (early, constant, late phases)
- Right censoring, interval censoring, and repeating events
- Time-varying covariates and weighted events
- Automatic stepwise covariate selection (forward, backward, stepwise)
- Conservation of Events theorem for numerically stable parameter estimation
- Covariance and correlation matrix estimation
- SAS integration via XPORT format and
PROC HAZARD/PROC HAZPREDsyntax
Tested SAS versions: v8.x through v9.3.2
| Requirement | Purpose |
|---|---|
| SAS (v8 or later) | Data preparation and result post-processing |
| GCC or compatible C compiler | Building from source |
| Flex / GNU Bison | Lexer and parser generation (build only) |
| GNU Make | Build automation |
| Autoconf / Automake | Configure script generation (build only) |
SAS is required at runtime for data I/O. The C executables handle all numerical computation.
# 1. Clone or download the source
git clone https://github.com/ehrlinger/hazard
cd hazard
# 2. Configure (default installs to /usr/local/hazard)
./configure
# To specify a custom install directory:
./configure --prefix=/path/to/install
# 3. Compile
make
# 4. Install
make installIf you are building on a platform not previously tested, please report your experience to [email protected] with the platform details.
Install the full Cygwin distribution, then build as above. The recommended install prefix under Cygwin is c:\hazard:
./configure --prefix=//c/hazard
make
make installUnix/Linux/macOS:
cd $HOME # or your preferred install parent
gzip -d < /path/to/hazard.PLATFORM.tar.gz | tar -xvf -This creates a hazard/ directory with the standard layout.
Windows:
Extract the .zip distribution with your preferred archive tool to a root directory such as C:\. The distribution must be extracted to a root-level directory due to path length constraints.
HAZARD requires four environment variables pointing to its installation directories.
Add to your shell startup file (.profile, .bash_profile, .zshrc, or .cshrc):
# bash / zsh / sh / ksh
export HAZARD=/usr/local/hazard # or $HOME/hazard
export HAZAPPS=$HAZARD/bin
export HZEXAMPLES=$HAZARD/examples
export MACROS=$HAZARD/macros# csh / tcsh
setenv HAZARD /usr/local/hazard
setenv HAZAPPS $HAZARD/bin
setenv HZEXAMPLES $HAZARD/examples
setenv MACROS $HAZARD/macrosSet the following User or System environment variables via Control Panel → System → Advanced → Environment Variables:
| Variable | Recommended Value | Description |
|---|---|---|
TMPDIR |
%TEMP% |
Temporary file storage |
HAZARD |
C:\hazard |
Root installation directory |
HAZAPPS |
%HAZARD%\bin |
Executables |
HZEXAMPLES |
%HAZARD%\examples |
Example SAS programs and data |
MACROS |
%HAZARD%\macros |
SAS helper macros |
A system restart may be required for the variables to take effect.
Add the HAZAPPS directory to the sasautos path in your SAS configuration file (sasv8.cfg or equivalent).
Unix (~/sasv8.cfg):
-sasautos ( '!SASROOT8/sasautos' '!HAZAPPS' )
Windows (sasv9.cfg):
-SET SASAUTOS (
"!sasroot\core\sasmacro"
"!sasext0\graph\sasmacro"
"!sasext0\stat\sasmacro"
"!HAZAPPS"
)
/* Allow external commands to close automatically */
-noxwaitThe -noxwait option prevents SAS from leaving a DOS window open after each external call.
Run one of the included example programs to verify your installation:
/* From SAS, with HZEXAMPLES on your path */
%include '!HZEXAMPLES/hm.death.AVC.sas';This fits a three-phase hazard model to the AVC (atrioventricular canal) surgical outcomes dataset (310 observations, 70 events). Expected output:
Log likelihood = -181.109
Events conserved = 70.000
Convergence attained after 6 iterations, 9 function evaluations
See the examples/ directory for additional programs demonstrating different model configurations.
hazard/
├── src/ C source code
│ ├── common/ Global data structures and shared utilities
│ ├── llike/ Log-likelihood engine (setlik.c, setcoe.c, setobj.c)
│ ├── optim/ BFGS/quasi-Newton optimizer
│ ├── model/ Early and late phase shaping functions
│ ├── vars/ Stepwise variable selection
│ ├── vcov/ Variance-covariance estimation (Cholesky)
│ ├── stat/ Statistical distributions
│ ├── utils/ Error handling and I/O utilities
│ ├── hazard/ PROC HAZARD executable
│ └── hazpred/ PROC HAZPRED executable
├── docs/ Documentation
│ ├── hazard.pdf PROC HAZARD user guide
│ ├── hazpred.pdf PROC HAZPRED user guide
│ ├── overview.pdf Parametric hazard analysis overview
│ ├── CODEBASE_ANALYSIS.md Architectural overview (internal)
│ ├── MODERNIZATION_GUIDE.md C modernization roadmap (internal)
│ └── R_MIGRATION_GUIDE.md R migration roadmap (internal)
├── examples/ Example SAS programs and datasets
│ ├── hm.death.AVC.sas Three-phase model: AV-canal repair mortality
│ ├── hp.death.AVC.sas Hazard prediction example
│ └── data/ Example XPORT datasets
├── macros/ SAS helper macros
└── tests/ Reference test outputs
The following vignettes provide detailed guides and examples:
- Downloads
- Analysis Examples
- Installation
- Introduction to Hazard Function Technology
- SAS Utility Macros
- User Guides
| Vignette | Description |
|---|---|
| Introduction | What is hazard function analysis; multi-phase model overview |
| Downloads | Binary distributions and source code |
| Installation | Build, install, and configure for Unix/Windows/SAS |
| Examples | Annotated walkthrough of all included example programs |
| SAS Utility Macros | Reference for all helper macros |
| User Guides | Full procedure reference documents |
| Document | Formats |
|---|---|
| Overview of Procedures | HTML · PDF |
| The HAZARD Procedure | HTML · PDF |
| The HAZPRED Procedure | HTML · PDF |
| Document | Description |
|---|---|
docs/CODEBASE_ANALYSIS.md |
Architectural overview for contributors |
docs/MODERNIZATION_GUIDE.md |
C modernization roadmap |
docs/R_MIGRATION_GUIDE.md |
R migration roadmap |
If you use HAZARD in published research, please cite:
Blackstone EH, Naftel DC, Turner ME Jr. The decomposition of time-varying hazard into phases, each incorporating a separate stream of concomitant information. J Am Stat Assoc. 1986;81(395):615–624.
Turner ME Jr, Restrepo C, McCarville C, Hauck WW. The continuity correction for the logistic disease risk model. Stat Med. 1992.
HAZARD is free software distributed under the GNU General Public License v2. See COPYING for the full license text.
Copyright © 2000 The Cleveland Clinic Foundation.
| General inquiries | [email protected] |
| Clinical/statistical questions | Dr. Eugene H. Blackstone — [email protected] |
| Bug reports | [email protected] |
| Phone | 216.444.6712 |
Contributions and platform compatibility reports are welcome. If you successfully build HAZARD on a new platform, please write to let us know.