帮助我了解逻辑回归中的调整后的优势比


20

我一直很难理解一篇论文中逻辑回归的用法。此处可用的论文使用逻辑回归来预测白内障手术期间发生并发症的可能性。

令我感到困惑的是,该论文提出了一个将比值比1分配给基线的模型,描述如下:

对于所有风险指标而言,其风险状况均属于参考组的患者(即,表1中所有风险指标均已调整为OR = 1.00)可被视为具有“基准风险状况”,而逻辑回归模型表明其具有“基准预测概率” PCR或VL或两者均= 0.736%。

因此,以0.00的比值比表示0.00736的概率。基于从概率到比值比的转换:,它不能等于1: 。o=p1p0.00741=0.0073610.00736

它变得更加混乱。代表多个协变量的复合比值比具有不同于基线的值,用于计算预测风险。

...表1的复合OR为1.28 X 1.58 X 2.99 X 2.46 X 1.45 X 1.60 = 34.5,从图1的图中可以看出,该OR与预测的PCR或VL或两者的预测概率相对应大约20%

得出示例中给出的值的唯一方法是将基线概率乘以这样的复合赔率: 。0.2025=(34.50 × 0.00736)1 + (34.50 × 0.00736)

那么这是怎么回事?将比值比1分配给非0.5的基线概率有什么逻辑?我上面提出的更新公式提供了本文中示例的正确概率,但这并不是我期望的比值比的直接乘积。之后怎么样了?


8
您可能对术语有一个简单的困惑:是几率,而不是几率。比值比是一个这样的表达方式除以另一个表达方式。p/(1p)
ub

Answers:


35

赔率是表达机会的一种方式。 赔率就是:一个赔率除以另一个。 这意味着优势比是您将一个优势乘以另一个而得到的。让我们看看它们在这种常见情况下如何工作。

在赔率和概率之间转换

二进制响应Y的几率是发生(用编码1Pr(Y=1)发生的机会与没有(用编码0发生的机会的比率Pr(Y=0)

Odds(Y)=Pr(Y=1)Pr(Y=0)=Pr(Y=1)1Pr(Y=1).

右边的等价表达式表明,足以对建立模型以找到赔率。相反,请注意,我们可以解决Pr(Y=1)

Pr(Y=1)=Odds(Y)1+Odds(Y)=111+Odds(Y).

逻辑回归

逻辑回归将Y的几率对数建模为解释变量的线性函数。最通常,书写这些变量为X 1... X p,并包括在所述线性函数的可能的常数项,我们可以命名的系数(其是要被从数据中估计)为β 1... β pβ 0。正式生成模型Yx1,,xpβ1,,βpβ0

log(Odds(Y))=β0+β1x1++βpxp.

The odds themselves can be recovered by undoing the logarithm:

Odds(Y)=exp(β0+β1x1++βpxp).

Using categorical variables

Categorical variables, such as age group, gender, presence of Glaucoma, etc., are incorporated by means of "dummy coding." To show that how the variable is coded does not matter, I will provide a simple example of one small group; its generalization to multiple groups should be obvious. In this study one variable is "pupil size," with three categories, "Large", "Medium", and "Small". (The study treats these as purely categorical, apparently paying no attention to their inherent order.) Intuitively, each category has its own odds, say αL for "Large", αM for "Medium", and αS for "Small". This means that, all other things equal,

Odds(Y)=exp(αL+β0+β1x1++βpxp)

for anybody in the "Large" category,

Odds(Y)=exp(αM+β0+β1x1++βpxp)

for anybody in the "Medium" category, and

Odds(Y)=exp(αS+β0+β1x1++βpxp)

for those in the "Small" category.

Creating identifiable coefficients

I have colored the first two coefficients to highlight them, because I want you to notice that they allow a simple change to occur: we could pick any number γ and, by adding it to β0 and subtracting it from each of αL, αM, and αS, we would not change any predicted odds. This is because of the obvious equivalences of the form

αL+β0=(αLγ)+(γ+β0),

etc. Although this presents no problems for the model--it still predicts exactly the same things--it shows that the parameters are not in themselves interpretable. What stays the same when we do this addition-subtraction maneuver are the differences between the coefficients. Conventionally, to address this lack of identifiability, people (and by default, software) choose one of the categories in each variable as the "base" or "reference" and simply stipulate that its coefficient will be zero. This removes the ambiguity.

The paper lists reference categories first; "Large" in this case. Thus, αL is subtracted from each of αL,αM, and αS, and added to β0 to compensate.

The log odds for a hypothetical individual falling into all the base categories therefore equals β0 plus a bunch of terms associated with all other "covariates"--the non-categorical variables:

Odds(Base category)=exp(β0+β1X1++βpXp).

No terms associated with any categorical variables appear here. (I have slightly changed the notation at this point: the betas βi now are the coefficients only of the covariates, while the full model includes the alphas αj for the various categories.)

Comparing odds

Let us compare odds. Suppose a hypothetical individual is a

male patient aged 80–89 with a white cataract, no fundal view, and a small pupil being operated on by a specialist registrar, ...

Associated with this patient (let's call him Charlie) are estimated coefficients for each category: α80-89 for his age group, αmale for being male, and so on. Wherever his attribute is the base for its category, the coefficient is zero by convention, as we have seen. Because this is a linear model, the coefficients add. Thus, to the base log odds given above, the log odds for this patient are obtained by adding in

α80-89+αmale+αno Glaucoma++αspecialist registrar.

This is precisely the amount by which the log odds of this patient vary from the base. To convert from log odds, undo the logarithm and recall that this turns addition into multiplication. Therefore, the base odds must be multiplied by

exp(α80-89)exp(αmale)exp(αno Glaucoma)exp(αspecialist registrar).

These are the numbers given in the table under "Adjusted OR" (adjusted odds ratio). (It is called "adjusted" because covariates x1,,xp were included in the model. They play no role in any of our calculations, as you will see. It is called a "ratio" because it is precisely the amount by which the base odds must be multiplied to produce the patient's predicted odds: see the first paragraph of this post.) In order in the table, they are exp(α80-89)=1.58, exp(αmale)=1.28, exp(αno Glaucoma)=1.00, and so on. According to the article, their product works out to 34.5. Therefore

Odds(Charlie)=34.5×Odds(Base).

(Notice that the base categories all have odds ratios of 1.00=exp(0), because including 1 in the product leaves it unchanged. That's how you can spot the base categories in the table.)

Restating the results as probabilities

Finally, let us convert this result to probabilities. We were told the baseline predicted probability is 0.736%=0.00736. Therefore, using the formulas relating odds and probabilities derived at the outset, we may compute

Odds(Base)=0.0073610.00736=0.00741.

Consequently Charlie's odds are

Odds(Charlie)=34.5×0.00741=0.256.

Finally, converting this back to probabilities gives

Pr(Y(Charlie)=1)=111+0.256=0.204.

3
whuber: getting in front of my computer after a very tiring previous day and finding this extraordinary response from you is simply brilliant. You have helped me a lot in a very tight situation. Many thanks. (somehow @ whuber won't show up...)
mahonya
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.