Agenda
This lecture will practice running
- Multiple logistic regression: log odds, odds, and probabilities
- Comparing two groups with more than one different predictor
- Simple and multiple Cox regression: HR, CI, and p-value
- Testing a categorical predictor as a whole
Let’s follow the week 13 lecture. Run a few chunks when we reach that topic, then read the result together. The last section on train/test data and ROC is extra practice if we have time.
| Lecture slides | Practice |
|---|---|
| 12–31 | Obesity and breastfeeding calculations; fitting a model with SBP data |
| 34–41, 53–57 | Smoking example, PBC data, simple and multiple Cox regression |
| 49–59, 64–66 | HR confidence intervals, p-values, and the joint age-group test |
| 75–76, 80 | Optional practice: prediction on a test set and an ROC curve |
Before begin..
Open BTE3207_Advanced_Biostatistics.Rproj. Keep the SBP
CSV in the dataset folder, just as in our previous coding
classes.
The main practice uses base R and survival. Only the
optional ROC example uses pROC. If a package is missing,
run this once in the Console. We do not install
packages every time we Knit.
install.packages(c("knitr", "rmarkdown", "rmdformats", "survival", "pROC"))
Logistic regression: calculate the lecture examples
Step 1. Log odds, odds, and probability
Lecture slides 12–18.
Let’s start with the obesity equation in the lecture. These are the given coefficients, not a model we have fitted to the SBP dataset. For the female, HDL = 75 mg/dL, age-Q4 profile:
log_odds <- 0.87 + 0.78 * 1 - 0.044 * 75 + 0.47 * 1
odds <- exp(log_odds)
probability <- odds / (1 + odds)
c(log_odds = log_odds, odds = odds, probability = probability)
## log_odds odds probability
## -1.1800000 0.3072787 0.2350522
exp(x) means e to the power x. Here, log odds = -1.18,
odds are about 0.307, and the probability is about 0.235, or
23.5%. Odds and probability are different numbers. Do
not report 0.307 as the probability.
R also has a short way to do the last two steps:
plogis(log_odds)
## [1] 0.2350522
plogis(x) calculates exp(x)/(1 + exp(x)).
In this example, both methods give the same probability.
Step 2. Two groups differ in several predictors
Lecture slides 19–21.
Compare the female/HDL 75/age-Q4 group with the male/HDL 80/age-Q3 group. We use the age-quartile assignments stated in the lecture.
log_odds_1 <- 0.87 + 0.78 * 1 - 0.044 * 75 + 0.47
log_odds_2 <- 0.87 + 0.78 * 0 - 0.044 * 80 + 0.75
OR_1_vs_2 <- exp(log_odds_1 - log_odds_2)
OR_1_vs_2
## [1] 2.054433
The subtraction is -1.18 - (-1.90) = 0.72, so OR =
about 2.05. It compares these two whole profiles. It is not the
female-versus-male OR at the same HDL and age. For that comparison, we
would use exp(0.78).
Try it: which part cancels when we subtract the two log odds? The intercept cancels because both profiles use the same model.
Step 3. The Nepal breastfeeding example
Lecture slides 24–29.
Let’s use the other equation from the lecture:
log odds = 7.47 - 0.27*Female - 0.24*age_months.
nepal <- data.frame(Female = c(1, 0), age_months = c(22, 30))
nepal$log_odds <- 7.47 - 0.27 * nepal$Female - 0.24 * nepal$age_months
nepal$probability <- plogis(nepal$log_odds)
nepal
exp(nepal$log_odds[1] - nepal$log_odds[2])
## [1] 5.20698
data.frame() makes a small table. c(1, 0)
puts two values in a column; $ selects that column, and
[1] selects its first value.
For the 22-month-old female profile, plogis(1.92) is
0.872. Use 87.2%; the 0.82 shown on slide 26 is an
arithmetic typo. The OR comparing the first profile with the second is
about 5.21. It is an odds ratio, not a ratio of the two
probabilities.
These two rows are predictor profiles. They are not two new children observed in the Nepal study, and we cannot refit the study from them.
Now fit a logistic regression
Load the SBP dataset
Let’s use the same dataset as before. We will work with a reproducible sample of 1,000 rows so that the practice runs quickly.
dataset_sbp <- read.csv("dataset/sbp_dataset_korea_2013-2014.csv")
set.seed(1)
dataset_sbp_small <- dataset_sbp[sample(nrow(dataset_sbp), 1000), ]
head(dataset_sbp_small[, c("SEX", "FBS", "BMI")])
set.seed(1) makes the random selection reproducible. In
[rows, columns], an empty column position means keep all
columns. The CSV has 1,000,000 rows. The lecture screenshots may use a
different sample, so compare the interpretation as well as the
numbers.
Make the 0/1 variables
SEX is 1 = Male, 2 = Female. Let’s keep it and make
Female with 0 = Male and 1 = Female.
For consistency with our earlier coding example, obesity
means BMI > 25 here. Exactly 25 is coded 0. This is
our stated classroom outcome definition; changing > to
>= changes the outcome.
dataset_sbp_small$Female <- ifelse(dataset_sbp_small$SEX == 2, 1, 0)
dataset_sbp_small$obesity <- ifelse(dataset_sbp_small$BMI > 25, 1, 0)
table(dataset_sbp_small$SEX, dataset_sbp_small$Female)
##
## 0 1
## 1 517 0
## 2 0 483
table(Female = dataset_sbp_small$Female, obesity = dataset_sbp_small$obesity)
## obesity
## Female 0 1
## 0 312 205
## 1 360 123
ifelse(condition, yes, no) chooses between two values. A
zero here is a category, not missing data. FBS is fasting
blood sugar in mg/dL. We will not put BMI on the right side of a model
whose outcome was defined directly from BMI.
Simple logistic regression
glm_simple <- glm(obesity ~ Female, data = dataset_sbp_small,
family = binomial)
summary(glm_simple)
##
## Call:
## glm(formula = obesity ~ Female, family = binomial, data = dataset_sbp_small)
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.41999 0.08991 -4.671 2.99e-06 ***
## Female -0.65393 0.13781 -4.745 2.08e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1265.5 on 999 degrees of freedom
## Residual deviance: 1242.5 on 998 degrees of freedom
## AIC: 1246.5
##
## Number of Fisher Scoring iterations: 4
exp(coef(glm_simple)["Female"])
## Female
## 0.52
The formula is outcome ~ predictor, just as in
lm(). family = binomial with the default logit
link fits logistic regression. coef() extracts the
coefficients; the quoted name selects one of them.
In summary(), Estimate is on the log-odds
scale. Exponentiating the Female coefficient gives the odds
ratio for females compared with males. Check which category is 1 before
interpreting the direction.
Multiple logistic regression
glm_adjusted <- glm(obesity ~ Female + FBS, data = dataset_sbp_small,
family = binomial)
summary(glm_adjusted)
##
## Call:
## glm(formula = obesity ~ Female + FBS, family = binomial, data = dataset_sbp_small)
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.947542 0.279928 -3.385 0.000712 ***
## Female -0.614082 0.139378 -4.406 1.05e-05 ***
## FBS 0.005064 0.002544 1.991 0.046517 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1265.5 on 999 degrees of freedom
## Residual deviance: 1238.5 on 997 degrees of freedom
## AIC: 1244.5
##
## Number of Fisher Scoring iterations: 4
exp(coef(glm_adjusted))
## (Intercept) Female FBS
## 0.3876930 0.5411377 1.0050769
exp(confint.default(glm_adjusted))
## 2.5 % 97.5 %
## (Intercept) 0.2239819 0.6710623
## Female 0.4117836 0.7111259
## FBS 1.0000781 1.0101006
+ FBS adds FBS to the model. The Female coefficient now
compares females with males at the same FBS. Its
adjusted OR is about 0.54. This is an adjusted association, not proof of
a causal effect.
confint.default() gives approximate 95% Wald CIs on the
coefficient scale. exp() changes their endpoints to the
odds scale. The exponentiated intercept is baseline
odds at Female = 0 and FBS = 0; it is not an odds ratio. FBS = 0 is not
a useful patient profile.
Read the output: for each slope, find Estimate, its
standard error, and Pr(>|z|). The null is coefficient =
0, equivalently OR = 1. A slope CI containing 0 corresponds to an OR CI
containing 1.
For a continuous predictor, we need to specify the size of the change:
exp(coef(glm_adjusted)["FBS"]) # OR per 1 mg/dL higher FBS
## FBS
## 1.005077
exp(10 * coef(glm_adjusted)["FBS"]) # OR per 10 mg/dL higher FBS
## FBS
## 1.051945
The second result compares FBS values 10 mg/dL apart, holding Female fixed. We multiply the coefficient by 10 before exponentiating.
Predict probabilities for two profiles
The same calculation as slides 12–31, now using our fitted model.
profiles <- data.frame(Female = c(0, 1), FBS = c(90, 120))
profiles$log_odds <- predict(glm_adjusted, newdata = profiles, type = "link")
profiles$probability <- predict(glm_adjusted, newdata = profiles, type = "response")
profiles
exp(profiles$log_odds[2] - profiles$log_odds[1])
## [1] 0.6299213
newdata supplies the predictor values.
type = "link" returns log odds;
type = "response" returns probabilities between 0 and 1.
The final line compares profile 2 with profile 1. Both
Female and FBS change, so this OR differs from the Female coefficient’s
OR.
Draw the fitted probabilities
Let’s change FBS while holding Female fixed. We use familiar base R plotting functions here.
male <- data.frame(Female = 0, FBS = seq(80, 160, by = 1))
female <- data.frame(Female = 1, FBS = seq(80, 160, by = 1))
plot(male$FBS, predict(glm_adjusted, male, type = "response"),
type = "l", ylim = c(0, 1), col = "steelblue", lwd = 2,
xlab = "FBS (mg/dL)", ylab = "Predicted probability of BMI > 25")
lines(female$FBS, predict(glm_adjusted, female, type = "response"),
col = "tomato", lwd = 2)
legend("topleft", c("Male", "Female"),
col = c("steelblue", "tomato"), lty = 1, lwd = 2, bty = "n")
seq() makes a sequence. type = "l" draws a
line; lines() adds the second line to the existing graph.
ylim sets the probability scale. The curves are model
estimates. They are not observed proportions in every individual FBS
group.
Try it: predict the probability for a female with FBS = 100. Which argument gives a probability rather than log odds?
predict(glm_adjusted, newdata = data.frame(Female = 1, FBS = 100),
type = "response")
## 1
## 0.2582242
Cox regression: first, remember the event
Enter the smoking example by hand
Lecture slides 34–35.
Twelve subjects are followed until they quit smoking or their observation ends. Here, the event is quitting, not death.
library(survival)
smoking <- data.frame(
days = c(2, 3, 6, 8, 9, 10, 15, 16, 18, 24, 27, 30),
quit = c(1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0)
)
Surv(smoking$days, smoking$quit)
## [1] 2 3+ 6 8 9+ 10 15+ 16 18 24+ 27 30+
Surv(time, event) keeps follow-up time and event status
together. quit = 1 means the event happened; 0 means
censored. The + signs in the printed result mark censoring.
They are not addition signs.
km_smoking <- survfit(Surv(days, quit) ~ 1, data = smoking)
summary(km_smoking)
## Call: survfit(formula = Surv(days, quit) ~ 1, data = smoking)
##
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 2 12 1 0.917 0.0798 0.773 1.000
## 6 10 1 0.825 0.1128 0.631 1.000
## 8 9 1 0.733 0.1324 0.515 1.000
## 10 7 1 0.629 0.1493 0.395 1.000
## 16 5 1 0.503 0.1640 0.265 0.953
## 18 4 1 0.377 0.1643 0.161 0.886
## 27 2 1 0.189 0.1566 0.037 0.960
plot(km_smoking, xlab = "Days", ylab = "Probability of not yet quitting",
conf.int = FALSE, mark.time = TRUE, lwd = 2)
~ 1 gives one curve for everybody. Read
n.risk, n.event, and survival in
the output. At day 2, S = 11/12. The day-3 censoring does not lower S,
but that subject leaves the next risk set. Here, a higher event hazard
means quitting faster, so the meaning of an HR depends on what we call
the event.
The PBC trial
Load the data used in the lecture
Lecture slides 33, 36–37, 53–57.
The survival package already contains the Mayo Clinic
PBC data. Let’s select the 312 randomized participants and define
death as the event. No separate download is needed.
dataset_pbc <- subset(survival::pbc, !is.na(trt))
dataset_pbc$death <- ifelse(dataset_pbc$status == 2, 1, 0)
dataset_pbc$DPCA <- ifelse(dataset_pbc$trt == 1, 1, 0)
dataset_pbc$Female <- ifelse(dataset_pbc$sex == "f", 1, 0)
nrow(dataset_pbc)
## [1] 312
table(dataset_pbc$status, dataset_pbc$death)
##
## 0 1
## 0 168 0
## 1 19 0
## 2 0 125
subset() keeps the rows satisfying its condition.
is.na() checks missing values, and ! means
“not”. Missing trt identifies the participants who were not
randomized.
| Original column | Meaning for today’s analysis |
|---|---|
time |
Days from enrollment to the recorded endpoint |
status |
0 = censored, 1 = transplant, 2 = death |
trt |
1 = DPCA, 2 = placebo |
age |
Age in years |
bili |
Bilirubin in mg/dL |
sex |
m = male, f = female |
There are 125 deaths and 19 transplants in these 312 records. For
this death analysis, transplantation ends observation and is treated as
censoring. Do not turn status directly into a 0/1 death
variable. This estimates the death hazard while still under observation
without transplant; it does not give the probability of dying after
transplant.
Data: survival::pbc
documentation. The trial paper cited in class is Dickson et
al. (1985), N Engl
J Med 312:1011–1015. That paper reports the 227 participants with
advanced disease; today’s R dataset includes all 312 randomized
participants. We are reanalysing the package data, not copying a result
from the paper.
Start with the KM curves
km_pbc <- survfit(Surv(time, death) ~ DPCA, data = dataset_pbc)
plot(km_pbc, col = c("steelblue", "tomato"), lwd = 2,
conf.int = FALSE, xlab = "Days", ylab = "Estimated survival")
legend("bottomleft", c("Placebo (0)", "DPCA (1)"),
col = c("steelblue", "tomato"), lty = 1, lwd = 2, bty = "n")
This compares groups without adjusting for other predictors. KM handles censoring. To study bilirubin as a continuous predictor and adjust for several variables together, let’s fit a Cox model.
Simple Cox regression
cox_simple <- coxph(Surv(time, death) ~ DPCA, data = dataset_pbc)
summary(cox_simple)
## Call:
## coxph(formula = Surv(time, death) ~ DPCA, data = dataset_pbc)
##
## n= 312, number of events= 125
##
## coef exp(coef) se(coef) z Pr(>|z|)
## DPCA 0.05722 1.05889 0.17916 0.319 0.749
##
## exp(coef) exp(-coef) lower .95 upper .95
## DPCA 1.059 0.9444 0.7453 1.504
##
## Concordance= 0.499 (se = 0.025 )
## Likelihood ratio test= 0.1 on 1 df, p=0.7
## Wald test = 0.1 on 1 df, p=0.7
## Score (logrank) test = 0.1 on 1 df, p=0.7
The outcome now has two columns, time and event,
inside Surv(). The formula after ~ works as
before.
coefis the log hazard ratio.exp(coef)is the hazard ratio.se(coef)is the standard error on the log scale.lower .95andupper .95are the HR confidence limits.
DPCA versus placebo has HR about 1.06, 95% CI about 0.75–1.50, matching the lecture. The CI includes 1. We do not have evidence of a treatment difference at the 5% level; this does not prove equality.
Hazard is an instantaneous event rate among those still at risk. An HR of 1.06 does not mean a 6-percentage-point difference in the probability of death.
Multiple Cox regression
The lecture uses age quartiles. Let’s make four groups from age;
cut() converts the numeric ages into a factor using the
boundaries from quantile(). Q1 is the reference group.
age_breaks <- quantile(dataset_pbc$age, probs = c(0, 0.25, 0.5, 0.75, 1))
dataset_pbc$age_group <- cut(dataset_pbc$age, breaks = age_breaks,
include.lowest = TRUE,
labels = c("Q1", "Q2", "Q3", "Q4"))
age_breaks
## 0% 25% 50% 75% 100%
## 26.27789 42.23888 49.79466 56.71458 78.43943
table(dataset_pbc$age_group)
##
## Q1 Q2 Q3 Q4
## 78 78 78 78
The boundaries round to about 42, 50, and 57 years in the slides. We
keep the unrounded boundaries when assigning the groups.
include.lowest = TRUE keeps the youngest participant in
Q1.
cox_adjusted <- coxph(Surv(time, death) ~ DPCA + age_group + bili + Female,
data = dataset_pbc)
summary(cox_adjusted)
## Call:
## coxph(formula = Surv(time, death) ~ DPCA + age_group + bili +
## Female, data = dataset_pbc)
##
## n= 312, number of events= 125
##
## coef exp(coef) se(coef) z Pr(>|z|)
## DPCA 0.10632 1.11217 0.18667 0.570 0.56899
## age_groupQ2 -0.04381 0.95713 0.30816 -0.142 0.88695
## age_groupQ3 0.53158 1.70162 0.28614 1.858 0.06320 .
## age_groupQ4 0.86847 2.38325 0.28372 3.061 0.00221 **
## bili 0.14988 1.16170 0.01343 11.164 < 2e-16 ***
## Female -0.51935 0.59491 0.24192 -2.147 0.03181 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## DPCA 1.1122 0.8991 0.7714 1.6035
## age_groupQ2 0.9571 1.0448 0.5232 1.7510
## age_groupQ3 1.7016 0.5877 0.9712 2.9814
## age_groupQ4 2.3833 0.4196 1.3667 4.1560
## bili 1.1617 0.8608 1.1315 1.1927
## Female 0.5949 1.6809 0.3703 0.9558
##
## Concordance= 0.792 (se = 0.022 )
## Likelihood ratio test= 108.4 on 6 df, p=<2e-16
## Wald test = 154.1 on 6 df, p=<2e-16
## Score (logrank) test = 216.8 on 6 df, p=<2e-16
R makes three comparisons: Q2 versus Q1, Q3 versus Q1, and Q4 versus Q1. It does not treat group numbers as years of age.
Read the DPCA and bili rows first:
- Adjusted DPCA HR is about 1.11, holding age group, bilirubin, and sex fixed.
- Bilirubin HR is about 1.16 per 1 mg/dL higher bilirubin, holding the other predictors fixed.
Randomization makes systematic baseline confounding of treatment less likely. Adjustment can still account for prognostic characteristics. For nonrandomized predictors, an adjusted association alone does not establish causation.
Try it: what is the bilirubin HR for a 2 mg/dL difference?
exp(2 * coef(cox_adjusted)["bili"])
## bili
## 1.349544
Calculate a CI and p-value ourselves
Lecture slides 50–59.
Let’s reproduce the DPCA row. We calculate on the log scale first.
b <- coef(cox_adjusted)["DPCA"]
se <- summary(cox_adjusted)$coefficients["DPCA", "se(coef)"]
exp(b)
## DPCA
## 1.112174
exp(b + c(-1, 1) * 1.96 * se)
## [1] 0.7713949 1.6034992
z <- b / se
2 * pnorm(-abs(z))
## DPCA
## 0.5689855
c(-1, 1) gives the lower and upper endpoints in one
line. abs() removes the sign, and pnorm()
gives the normal cumulative probability. The last line is the two-sided
p-value for H0: log HR = 0, equivalently HR = 1.
Our fitted treatment coefficient is about 0.106, not exactly the rounded 0.10 on the slide. Also, the lecture uses approximately 2 SE; R uses 1.96 here. Small differences from the slide’s CI and p-value are expected.
For all coefficients at once:
exp(cbind(HR = coef(cox_adjusted), confint(cox_adjusted)))
## HR 2.5 % 97.5 %
## DPCA 1.1121741 0.7714001 1.6034885
## age_groupQ2 0.9571347 0.5231971 1.7509782
## age_groupQ3 1.7016208 0.9711837 2.9814272
## age_groupQ4 2.3832515 1.3666801 4.1559745
## bili 1.1616989 1.1315288 1.1926734
## Female 0.5949090 0.3702808 0.9558063
cbind() puts columns side by side. In this line all
entries are on the log scale before the outer exp() changes
them to HRs and their confidence limits. A Cox model has no ordinary
intercept coefficient in this table: its baseline hazard is a function
of time.
Does age group matter as a whole?
Lecture slides 64–66 and 79.
One age-group p-value is not a test of the whole age variable. We test H0: all three age-group coefficients are zero.
cox_without_age <- coxph(Surv(time, death) ~ DPCA + bili + Female,
data = dataset_pbc)
c(n_without_age = cox_without_age$n, n_with_age = cox_adjusted$n)
## n_without_age n_with_age
## 312 312
anova(cox_without_age, cox_adjusted, test = "Chisq")
Both models use the same 312 participants. The larger model contains everything in the smaller model plus the three age-group coefficients. This is a likelihood ratio test, with 3 degrees of freedom. The p-value is about 0.00061, so age group adds information after accounting for treatment, bilirubin, and sex.
Despite the function name anova(), this is not the
ordinary ANOVA F-test from last week. It compares the Cox models’ log
partial likelihoods. If predictors have missing values, first select the
same complete records for both models.
One check before interpreting the HRs
The proportional hazards assumption says that the HR for a fixed comparison stays constant over follow-up. The baseline hazard itself can change over time. Cox coefficients are estimated using partial likelihood without first specifying the baseline hazard.
The following is a short additional check of that assumption:
cox.zph(cox_adjusted)
## chisq df p
## DPCA 2.88e-02 1 0.8652
## age_group 2.69e+00 3 0.4419
## bili 7.94e+00 1 0.0048
## Female 1.95e-04 1 0.9888
## GLOBAL 1.12e+01 6 0.0836
cox.zph() tests for evidence that the effects change
over time. In this example, the bilirubin row has p about 0.005, so we
should question a constant bilirubin HR. A nonsignificant GLOBAL p-value
does not erase that signal. We can practise reading this lecture model
without treating it as a fully checked final analysis.
If time remains: train and test
Optional practice for slides 75–76 and 80.
Let’s return to the SBP data. Predicting rows used to fit the model does not tell us how well it predicts new observations. This time, fit the model on 70% and evaluate it on the other 30%.
set.seed(13)
train_rows <- sample(nrow(dataset_sbp_small), 700)
train_data <- dataset_sbp_small[train_rows, ]
test_data <- dataset_sbp_small[-train_rows, ]
glm_train <- glm(obesity ~ Female + FBS, data = train_data, family = binomial)
test_probability <- predict(glm_train, newdata = test_data, type = "response")
The minus sign in [-train_rows, ] means exclude those
rows. We refit using train_data; we do not reuse the model
fitted to all 1,000 observations.
library(pROC)
roc_test <- roc(response = test_data$obesity, predictor = test_probability,
levels = c(0, 1), direction = "<", quiet = TRUE)
plot(roc_test, legacy.axes = TRUE, col = "steelblue", lwd = 2,
main = "SBP example: test-set ROC")
auc(roc_test)
## Area under the curve: 0.6237
roc() compares sensitivity and specificity across
thresholds; auc() gives the area under the curve.
levels = c(0, 1) fixes the non-event and event labels.
direction = "<" states in advance that higher predicted
probability means more evidence for outcome 1.
An AUC near 0.5 means weak ranking; 1 means perfect ranking in this sample. AUC is not the percentage correctly classified, and it does not tell us whether the predicted probabilities are well calibrated. One small train/test split is practice, not a final validation study.
Before finish..
Can you explain these without looking at the code?
- Why do we use
exp(coef())for logistic and Cox regression? - Which
predict()option gives logistic probabilities? - Why does Cox regression need both follow-up time and event status?
- Does a 95% HR CI containing 1 prove that there is no association?
- Why does a four-level age variable require a joint test with 3 df?
For logistic regression, exp(coef) gives an OR for a
slope. For Cox regression, it gives an HR. The same exp()
operation does not make OR and HR the same quantity. Always name the
outcome, comparison, unit change, and variables held fixed.
References
- BTE3207, 2026 Fall, week 13 lecture: obesity and Nepal breastfeeding coefficient examples, smoking follow-up example, and PBC regression interpretation. The calculations here use the coefficients printed in class; no participant-level Nepal or obesity-study dataset is reconstructed.
- Therneau TM and Grambsch PM (2000). Modeling Survival Data:
Extending the Cox Model. Springer. Source listed in the
survival::pbcdocumentation. - Dickson ER et al. (1985). Trial of penicillamine in advanced primary biliary cirrhosis. N Engl J Med, 312:1011–1015. doi:10.1056/NEJM198504183121602.
- R documentation:
predict.glm,coxph,anova.coxph, andcox.zph.