Solution (source code)

= Solution

Write the <logistic regression> as
$$
\operatorname{logit}\{p(A,x)\}=\alpha+\beta A+\gamma^Tx,
$$
where $A=1$ denotes elective exposure and $x$ contains the measured background predictors. At fixed $x$, changing $A$ from zero to one changes the <log odds> by $\beta$, so the adjusted <odds ratio> is $e^\beta$. If $\widehat V$ is the estimated coefficient <covariance matrix>, then
$$
\boxed{\widehat{\mathrm{OR}}_{\rm adjusted}=e^{\widehat\beta},\qquad
\mathrm{CI}_{95\%}=\left[e^{\widehat\beta-1.96\sqrt{\widehat V_{\beta\beta}}},\ e^{\widehat\beta+1.96\sqrt{\widehat V_{\beta\beta}}}\right].}
$$
Use the clinic-cluster <sandwich covariance matrix> if that is how within-clinic dependence is allowed for. The interval is first calculated on the coefficient scale and then exponentiated; one does not add and subtract a standard error directly from the <odds ratio>. This is a large-sample <Wald confidence interval>; profile-likelihood limits are another option when the likelihood shape warrants them. If exposure interacts with background variables, there is no single common conditional <odds ratio>: its logarithm includes the corresponding interaction terms.