You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

Logistic回归:SPSS输出OR与手动计算差异及编码类型影响咨询

Understanding Odds Ratios in Logistic Regression with Deviation Coding (-1,1)

Hey there! No worries at all about your stats background—we all start somewhere, and these encoding/OR quirks are super common to get tripped up on. Let’s break down your questions step by step.

Why does coding type affect Odds Ratios (OR)?

Odds Ratios are inherently tied to how you code your predictor variables, because they measure the multiplicative change in odds of the dependent variable when the predictor changes by 1 unit. Here’s the key difference with deviation coding vs. more common dummy coding:

  • Dummy coding (0,1): Sets one category as the reference (e.g., 0 = Article Type A, 1 = Article Type B). The OR for the predictor directly compares the odds of the non-reference category to the reference category.
  • Deviation coding (-1,1): Compares each category to the average of all categories (not a single reference group). The main effect OR here doesn’t measure group-to-group comparison—it measures how much the odds of one category differ from the overall average odds of all categories.

This shift in the "reference point" (single group vs. overall average) is why the OR values change when you switch coding schemes.

Why do SPSS’s OR outputs differ from your manual calculations?

The most likely culprit is a mismatch between how you’re manually calculating ORs and how SPSS interprets deviation coding coefficients. Let’s break this down using your model:
Your logistic regression formula is:

logit(P(Help)) = β₀ + β₁(Article Type) + β₂(Order) + β₃(Article Type × Order)

With deviation coding, each predictor takes values -1 and 1. Here’s where the confusion happens:

  1. SPSS calculates OR as e^β: The OR SPSS outputs corresponds to a 1-unit increase in the predictor. But in deviation coding, moving from one category to another is a 2-unit change (from -1 to 1), not 1.
  2. Your manual calculation is probably measuring group-to-group odds: For example, if you’re comparing Article Type B (1) vs. Article Type A (-1), the logit difference between these two groups is:
    [β₀ + β₁(1) + ...] - [β₀ + β₁(-1) + ...] = 2β₁
    
    So the correct group-to-group OR is e^(2β₁), not e^β₁. This is the gap between SPSS’s output and your manual calculation.

For example: If SPSS outputs β₁ = 0.3466, its OR is e^0.3466 ≈ 1.415 (this is the OR for moving from the average to Category B). But the OR for Category B vs. Category A is e^(2×0.3466) ≈ 2.003, which should match your manual group-to-group odds calculation.

The same logic applies to the interaction term: SPSS’s OR for the interaction is e^β₃, which reflects the interaction effect relative to the overall average, not a direct group comparison.

Quick Tips to Align Results

  • If you want ORs that directly compare categories (e.g., Type B vs. Type A), switch to dummy coding in SPSS—this will make the output match the group-to-group ORs you’re calculating manually.
  • If you need to stick with deviation coding to interpret effects relative to the overall average:
    • Use SPSS’s reported OR for "category vs. average" interpretations.
    • Calculate group-to-group ORs by doubling the coefficient and exponentiating it (e^(2β)).

Hope this clears up the confusion! Feel free to test this with your actual coefficient values to see if it lines up.

内容的提问来源于stack exchange,提问作者Vanessa

火山引擎 最新活动