Model

MODEL DEFINITION

The Bernoulli regression model is defined as:

\[ P(Y = 1 \mid X) = \frac{1}{1 + e^{-(\beta_0 + \beta_1 X_1 + \beta_2 X_2 + \cdots + \beta_n X_n)}} \]

Where: - \(P(Y = 1 \mid X)\) is the probability of a heart attack (binary outcome) given predictors \(X\). - \(\text{logit}^{-1}\) is the logistic function that converts a linear combination of predictors into a probability.


 Family: bernoulli 
  Links: mu = logit 
Formula: output ~ age + chol + cp + thalachh + sex 
   Data: heart (Number of observations: 303) 
  Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
         total post-warmup draws = 4000

Regression Coefficients:
          Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
Intercept    -1.30      1.86    -4.97     2.23 1.00     4423     3170
age          -0.04      0.02    -0.08    -0.00 1.00     4316     3085
chol         -0.01      0.00    -0.01    -0.00 1.00     4716     3414
cp            0.91      0.16     0.60     1.22 1.00     4681     3072
thalachh      0.04      0.01     0.02     0.06 1.00     4184     2110
sex          -1.98      0.37    -2.73    -1.27 1.00     4280     2969

Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
and Tail_ESS are effective sample size measures, and Rhat is the potential
scale reduction factor on split chains (at convergence, Rhat = 1).

Key Points

  • Bayesian Inference: Combines prior knowledge with data to estimate parameter distributions.
  • Logistic Regression: Predicts the probability of a heart attack using the logit link function.
  • Parameters: Coefficients ((_i)) show the change in log odds of heart attack for each unit increase in predictors.
  • Model Diagnostics: Assesses convergence (Rhat) and effective sample sizes to ensure the reliability of the estimates.
The model suggests that several factors, including age, sex, chest pain type, blood pressure, cholesterol, and other medical indicators, are significantly associated with the risk of a heart attack.
Characteristic exp(Beta) 95% CI1
Age 1.00 0.95, 1.04
Sex 0.15 0.06, 0.37
Chest Pain Type 2.57 1.76, 3.78
Blood Pressure 0.98 0.96, 1.00
Cholesterol 1.0 0.99, 1.00
Fasting Blood Sugar 1.05 0.38, 3.19
Resting ECG 1.66 0.82, 3.40
Maximum Heart Rate 1.03 1.00, 1.05
Exercise Induced Angina 0.35 0.15, 0.79
Depression Induced by Exercise 0.55 0.36, 0.85
Slope of ST Segment 1.84 0.90, 3.69
Number of Major Vessels 0.43 0.29, 0.64
Thalassemia 0.38 0.21, 0.67
1 CI = Credible Interval

The table shows the odds, ratios, and significance of each predictor influencing heart attack risk.

For example, each year increase in age raises the odds of a heart attack by 5%, highlighting age as a significant risk factor.