邏輯迴歸
此{{#if:|{{#ifeq:none|left|章節|條目或其章節}}}}{{#if:|具有{{{reason}}}的問題,}}需要精通或熟悉{{#if:|[[]]{{#if:|、[[]]{{#if:|、[[]]}}}}|相關主題}}的編者參與及協助編輯。 (2016年9月17日) |
[[Category:自2016年9月{{#if:|需要專家關注的頁面|{{#if:2016-09-17T10:19:57+00:00|需要專業人士關注的頁面|}}}}|㏰]][[Category:自2016年9月{{#if:|需要專家關注的頁面|}}|㏰]][[Category:自2016年9月{{#if:|需要專家關注的頁面|}}|㏰]]{{#ifeq:none|left|}}{{#if:
{{#ifeq: | true | dontcat }}{{#ifeq: | no | dontcat }}{{#switch: ¬ | yes | ¬ = | #default = dontcat }}{{#switch: | no = {{#switch: {{#if: | {{#if:{{#titleparts:|0|3}} | subsubpage | {{#if:{{#titleparts:|0|2}} | subpage | basepage }} }} | {{#if:{{#titleparts:邏輯斯諦迴歸|0|3}} | subsubpage | {{#if:{{#titleparts:邏輯斯諦迴歸|0|2}} | subpage | basepage }} }} }}
| basepage =
| subpage = dontcat
| subsubpage = dontcat
}}
| only = {{#switch: {{#if: | {{#if:{{#titleparts:|0|3}} | subsubpage | {{#if:{{#titleparts:|0|2}} | subpage | basepage }} }} | {{#if:{{#titleparts:邏輯斯諦迴歸|0|3}} | subsubpage | {{#if:{{#titleparts:邏輯斯諦迴歸|0|2}} | subpage | basepage }} }} }}
| basepage = dontcat
| subpage = | subsubpage = }}
}}
| |
{{#switch: {{#ifeq: | false | | {{#ifeq: | yes | | {{#ifeq: | yes | | {{#if:x
|
{{#if:{{#titleparts:{{#if:| | 邏輯斯諦迴歸 }}|0|2}} | | }}
}}
}} }} }} | hide = | #default = {{#ifeq: h0#384!5nea+w9 | {{#if:|{{#ifexist:Category:需要{{{1}}}专家关注的页面|[[Category:需要{{{1}}}专家关注的页面]]{{#if:|{{#ifexist:Category:需要{{{2}}}专家关注的页面|[[Category:需要{{{2}}}专家关注的页面]]{{#if:|{{#ifexist:Category:需要{{{3}}}专家关注的页面|[[Category:需要{{{3}}}专家关注的页面]]|}}}}|}}}}|}}|}} | {{#switch: {{#if: | {{{demospace}}} | {{#ifeq:| | main | {{#ifeq:|talk | talk | }} }} }}
| main = {{#switch:{{#ifexpr:({{#if:{{#expr:abs(−1)−1}}|{{#expr:abs(−1)−1}}|1}}=0) or (27=0)|
|{{#if:{{#if:|{{#if:{{#expr:abs(-1)-1}}|{{#if:|{{#ifexpr:((-+1)<>{{#expr:abs(-1)-1}}) and (*<>0)|Error using {{[[{{#switch: |#default = Str mid | = {{#ifeq: | | Template:Str mid | Str mid }}
}}|Str mid]]{{#if:||{{{arg}}}}}}}: indexes i= and j= do not match requested substring length {{ safesubst:#if:1|{{#expr:abs(-1)-1}}}}}}|}}}}}}|Template:Error
|邏輯斯諦迴歸}}}}{{safesubst:#switch: no |no |n |false |f |否 |0 = | = |¬ = |yes |y |true |t |是 |1 = _IN:_i2=_sublen3={{#expr:abs(-1)-1}}_j4=u_min=Template:Min_CORE:slen:27_i={{#if:}||{{#ifexpr:({{#if:{{#expr:abs(-1)-1}}|1|0}} and {{#if:|1|0}})|{{#expr:Template:Min-{{#expr:abs(-1)-1}}+{{#ifexpr:{{#expr:abs(-1)-1}}<0|-1|1}}}}|1}}}}_j=Template:Min_inv={{#ifexpr:{{#ifeq:{{#expr:abs(−1)−1}}||0|{{#expr:abs(−1)−1}}}}<0|yes|no}}_tchk={{#if:{{#if:|{{#if:{{#expr:abs(-1)-1}}|{{#if:|{{#ifexpr:((-+1)<>{{#expr:abs(-1)-1}}) and (*<>0)|Error using {{[[{{#switch: |#default = Str mid | = {{#ifeq: | | Template:Str mid | Str mid }}
}}|Str mid]]{{#if:||{{{arg}}}}}}}: indexes i= and j= do not match requested substring length {{ safesubst:#if:1|{{#expr:abs(-1)-1}}}}}}|}}}}}}|TCHK|-}}_blankexpr:{{#expr:({{#if:{{#expr:abs(−1)−1}}|{{#expr:abs(−1)−1}}|1}}=0) or (27=0)}}
|#default = _IN:_i2=_sublen3={{#expr:abs(-1)-1}}_j4=u_min=Template:Min_CORE:slen:27_i={{#if:}||{{#ifexpr:({{#if:{{#expr:abs(-1)-1}}|1|0}} and {{#if:|1|0}})|{{#expr:Template:Min-{{#expr:abs(-1)-1}}+{{#ifexpr:{{#expr:abs(-1)-1}}<0|-1|1}}}}|1}}}}_j=Template:Min_inv={{#ifexpr:{{#ifeq:{{#expr:abs(−1)−1}}||0|{{#expr:abs(−1)−1}}}}<0|yes|no}}_tchk={{#if:{{#if:|{{#if:{{#expr:abs(-1)-1}}|{{#if:|{{#ifexpr:((-+1)<>{{#expr:abs(-1)-1}}) and (*<>0)|Error using {{[[{{#switch: |#default = Str mid | = {{#ifeq: | | Template:Str mid | Str mid }}
}}|Str mid]]{{#if:||{{{arg}}}}}}}: indexes i= and j= do not match requested substring length {{ safesubst:#if:1|{{#expr:abs(-1)-1}}}}}}|}}}}}}|TCHK|-}}_blankexpr:{{#expr:({{#if:{{#expr:abs(−1)−1}}|{{#expr:abs(−1)−1}}|1}}=0) or (27=0)}} }}| MOS = | LTA = | NT = | NC = | #default = }} | talk = | user = | wikipedia = | image = | mediawiki = | template = | help = | category = | portal = | wikiproject = | other | #default = }}
| {{#iferror: {{#expr: 1 + {{#switch: {{#if: | {{{demospace}}} | {{#ifeq:| | main | {{#ifeq:|talk | talk | }} }} }}
| main = {{#switch:{{#ifexpr:({{#if:{{#expr:abs(−1)−1}}|{{#expr:abs(−1)−1}}|1}}=0) or (27=0)|
|{{#if:{{#if:|{{#if:{{#expr:abs(-1)-1}}|{{#if:|{{#ifexpr:((-+1)<>{{#expr:abs(-1)-1}}) and (*<>0)|Error using {{[[{{#switch: |#default = Str mid | = {{#ifeq: | | Template:Str mid | Str mid }}
}}|Str mid]]{{#if:||{{{arg}}}}}}}: indexes i= and j= do not match requested substring length {{ safesubst:#if:1|{{#expr:abs(-1)-1}}}}}}|}}}}}}|Template:Error
|邏輯斯諦迴歸}}}}{{safesubst:#switch: no |no |n |false |f |否 |0 = | = |¬ = |yes |y |true |t |是 |1 = _IN:_i2=_sublen3={{#expr:abs(-1)-1}}_j4=u_min=Template:Min_CORE:slen:27_i={{#if:}||{{#ifexpr:({{#if:{{#expr:abs(-1)-1}}|1|0}} and {{#if:|1|0}})|{{#expr:Template:Min-{{#expr:abs(-1)-1}}+{{#ifexpr:{{#expr:abs(-1)-1}}<0|-1|1}}}}|1}}}}_j=Template:Min_inv={{#ifexpr:{{#ifeq:{{#expr:abs(−1)−1}}||0|{{#expr:abs(−1)−1}}}}<0|yes|no}}_tchk={{#if:{{#if:|{{#if:{{#expr:abs(-1)-1}}|{{#if:|{{#ifexpr:((-+1)<>{{#expr:abs(-1)-1}}) and (*<>0)|Error using {{[[{{#switch: |#default = Str mid | = {{#ifeq: | | Template:Str mid | Str mid }}
}}|Str mid]]{{#if:||{{{arg}}}}}}}: indexes i= and j= do not match requested substring length {{ safesubst:#if:1|{{#expr:abs(-1)-1}}}}}}|}}}}}}|TCHK|-}}_blankexpr:{{#expr:({{#if:{{#expr:abs(−1)−1}}|{{#expr:abs(−1)−1}}|1}}=0) or (27=0)}}
|#default = _IN:_i2=_sublen3={{#expr:abs(-1)-1}}_j4=u_min=Template:Min_CORE:slen:27_i={{#if:}||{{#ifexpr:({{#if:{{#expr:abs(-1)-1}}|1|0}} and {{#if:|1|0}})|{{#expr:Template:Min-{{#expr:abs(-1)-1}}+{{#ifexpr:{{#expr:abs(-1)-1}}<0|-1|1}}}}|1}}}}_j=Template:Min_inv={{#ifexpr:{{#ifeq:{{#expr:abs(−1)−1}}||0|{{#expr:abs(−1)−1}}}}<0|yes|no}}_tchk={{#if:{{#if:|{{#if:{{#expr:abs(-1)-1}}|{{#if:|{{#ifexpr:((-+1)<>{{#expr:abs(-1)-1}}) and (*<>0)|Error using {{[[{{#switch: |#default = Str mid | = {{#ifeq: | | Template:Str mid | Str mid }}
}}|Str mid]]{{#if:||{{{arg}}}}}}}: indexes i= and j= do not match requested substring length {{ safesubst:#if:1|{{#expr:abs(-1)-1}}}}}}|}}}}}}|TCHK|-}}_blankexpr:{{#expr:({{#if:{{#expr:abs(−1)−1}}|{{#expr:abs(−1)−1}}|1}}=0) or (27=0)}} }}| MOS = | LTA = | NT = | NC = | #default = {{#if:|{{#ifexist:Category:需要{{{1}}}專家關注的頁面|[[Category:需要{{{1}}}專家關注的頁面]]{{#if:|{{#ifexist:Category:需要{{{2}}}專家關注的頁面|[[Category:需要{{{2}}}專家關注的頁面]]{{#if:|{{#ifexist:Category:需要{{{3}}}專家關注的頁面|[[Category:需要{{{3}}}專家關注的頁面]]|}}}}|}}}}|}}|}}}} | talk = | user = | wikipedia = | image = | mediawiki = | template = | help = | category = | portal = | wikiproject = | other | #default = }} }} | {{#switch:
{{#if: | {{{demospace}}} | {{#ifeq:| | main | {{#ifeq:|talk | talk | }} }} }}
| main = {{#switch:{{#ifexpr:({{#if:{{#expr:abs(−1)−1}}|{{#expr:abs(−1)−1}}|1}}=0) or (27=0)|
|{{#if:{{#if:|{{#if:{{#expr:abs(-1)-1}}|{{#if:|{{#ifexpr:((-+1)<>{{#expr:abs(-1)-1}}) and (*<>0)|Error using {{[[{{#switch: |#default = Str mid | = {{#ifeq: | | Template:Str mid | Str mid }}
}}|Str mid]]{{#if:||{{{arg}}}}}}}: indexes i= and j= do not match requested substring length {{ safesubst:#if:1|{{#expr:abs(-1)-1}}}}}}|}}}}}}|Template:Error
|邏輯斯諦迴歸}}}}{{safesubst:#switch: no |no |n |false |f |否 |0 = | = |¬ = |yes |y |true |t |是 |1 = _IN:_i2=_sublen3={{#expr:abs(-1)-1}}_j4=u_min=Template:Min_CORE:slen:27_i={{#if:}||{{#ifexpr:({{#if:{{#expr:abs(-1)-1}}|1|0}} and {{#if:|1|0}})|{{#expr:Template:Min-{{#expr:abs(-1)-1}}+{{#ifexpr:{{#expr:abs(-1)-1}}<0|-1|1}}}}|1}}}}_j=Template:Min_inv={{#ifexpr:{{#ifeq:{{#expr:abs(−1)−1}}||0|{{#expr:abs(−1)−1}}}}<0|yes|no}}_tchk={{#if:{{#if:|{{#if:{{#expr:abs(-1)-1}}|{{#if:|{{#ifexpr:((-+1)<>{{#expr:abs(-1)-1}}) and (*<>0)|Error using {{[[{{#switch: |#default = Str mid | = {{#ifeq: | | Template:Str mid | Str mid }}
}}|Str mid]]{{#if:||{{{arg}}}}}}}: indexes i= and j= do not match requested substring length {{ safesubst:#if:1|{{#expr:abs(-1)-1}}}}}}|}}}}}}|TCHK|-}}_blankexpr:{{#expr:({{#if:{{#expr:abs(−1)−1}}|{{#expr:abs(−1)−1}}|1}}=0) or (27=0)}}
|#default = _IN:_i2=_sublen3={{#expr:abs(-1)-1}}_j4=u_min=Template:Min_CORE:slen:27_i={{#if:}||{{#ifexpr:({{#if:{{#expr:abs(-1)-1}}|1|0}} and {{#if:|1|0}})|{{#expr:Template:Min-{{#expr:abs(-1)-1}}+{{#ifexpr:{{#expr:abs(-1)-1}}<0|-1|1}}}}|1}}}}_j=Template:Min_inv={{#ifexpr:{{#ifeq:{{#expr:abs(−1)−1}}||0|{{#expr:abs(−1)−1}}}}<0|yes|no}}_tchk={{#if:{{#if:|{{#if:{{#expr:abs(-1)-1}}|{{#if:|{{#ifexpr:((-+1)<>{{#expr:abs(-1)-1}}) and (*<>0)|Error using {{[[{{#switch: |#default = Str mid | = {{#ifeq: | | Template:Str mid | Str mid }}
}}|Str mid]]{{#if:||{{{arg}}}}}}}: indexes i= and j= do not match requested substring length {{ safesubst:#if:1|{{#expr:abs(-1)-1}}}}}}|}}}}}}|TCHK|-}}_blankexpr:{{#expr:({{#if:{{#expr:abs(−1)−1}}|{{#expr:abs(−1)−1}}|1}}=0) or (27=0)}} }}| MOS = | LTA = | NT = | NC = | #default = {{#if:|{{#ifexist:Category:需要{{{1}}}專家關注的頁面|[[Category:需要{{{1}}}專家關注的頁面]]{{#if:|{{#ifexist:Category:需要{{{2}}}專家關注的頁面|[[Category:需要{{{2}}}專家關注的頁面]]{{#if:|{{#ifexist:Category:需要{{{3}}}專家關注的頁面|[[Category:需要{{{3}}}專家關注的頁面]]|}}}}|}}}}|}}|}}}} | talk = | user = | wikipedia = | image = | mediawiki = | template = | help = | category = | portal = | wikiproject = | other | #default = }} | }}
}} }}
}}
邏輯迴歸(英語:Logistic regression,又譯作邏輯斯迴歸、羅吉斯迴歸、邏輯斯諦迴歸、對數機率迴歸),在統計學中是一種對數機率模型(英語:Logit model,又譯作邏輯模型、評定模型、分類評定模型),是離散選擇法模型之一,屬於多變量分析範疇,是社會學、生物統計學、臨床、數量心理學、計量經濟學、市場營銷等統計實證分析的常用方法。
通過使事件的對數發生率(log-odd)成為一個或多個自變數的線性組合,對事件發生的機率進行建模。形式上,在二元邏輯迴歸中,有一個二元應變數,由指示變量編碼,其中兩個值標記為「0」和「1」,而自變數每個都可以是二元變量(兩個類,由指示變量)或連續變量(任何實值)。標記為「1」的值的相應機率可以在0和1之間變化;將對數發生率轉換為機率的函數就是邏輯斯諦函數,因此得名。對數發生率單位稱為logit,來自logistic unit。<ref>Hosmer, David W.; Lemeshow, Stanley. Applied logistic regression. Wiley series in probability and statistics 2. ed., [Nachdr.] New York: Wiley. 200. ISBN 978-0-471-35632-5. 缺少或|title=
為空 (幫助)</ref>
二元變量在統計學中廣泛用於對某一類別或事件發生機率的建模,例如團隊獲勝機率、患者健康機率等,而其中,邏輯模型則自大約 1970年以來最常用的二元迴歸模型。<ref>Cramer, J.S. The Origins of Logistic Regression. SSRN Electronic Journal. 2003. ISSN 1556-5068. doi:10.2139/ssrn.360300 (English).</ref>當存在兩個以上可能值(例如圖像是否是貓、狗、獅子等)時,二元變量可以推廣為分類變量,並且二元邏輯迴歸推廣為多項邏輯迴歸。如果多個類別是有序的,則可以使用序數邏輯迴歸。邏輯迴歸模型本身只是簡單地根據輸入對輸出機率進行建模,並不執行統計分類。<ref>Walker, Strother H.; Duncan, David B. Estimation of the Probability of an Event as a Function of Several Independent Variables. Biometrika. 1967-06, 54 (1/2). doi:10.2307/2333860.</ref>
例子[編輯 | 編輯原始碼]
以一個例子說明邏輯迴歸如何解決實際問題:
一個小組20名學生,各自花費0~6小時準備考試,他們不同的學習時數如何影響通過考試的機率?
問題中的應變數是考試「通過」或者「掛科」,這是用邏輯迴歸的原因,雖然分別用「1」和「0」表示,但這兩個數字不代表基數。如果問題發生變化,用0-100的成績(基數)代替通過、掛科,則可以使用迴歸分析。
下表顯示每個學生花費在學習上的小時數,以及他們通過(1)或掛科(0)。
小時(xk) | 0.50 | 0.75 | 1.00 | 1.25 | 1.50 | 1.75 | 1.75 | 2.00 | 2.25 | 2.50 | 2.75 | 3.00 | 3.25 | 3.50 | 4.00 | 4.25 | 4.50 | 4.75 | 5.00 | 5.50 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
通過(yk) | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 |
對學習時間(xk)和測試結果(yk = 1 表示通過,0 表示掛科)組成的數據進行擬合。數據點由下標k索引,該下標從1到20。x變量稱為「自變數」,y變量稱為「分類變量」,由「通過」或「失敗」兩個類別組成,分別對應於分類值1和0。
模型[編輯 | 編輯原始碼]
統計學系列條目 |
迴歸分析 |
---|
File:Linear regression.svg |
模型 |
估計 |
背景 |
邏輯函數形式為:
- <math>p(x)=\frac{1}{1+e^{-(x-\mu)/s}}</math>
其中μ是位置參數(曲線的中點,其中<math>p(\mu)=1/2</math>),s是尺度參數。該式可重寫為:
- <math>p(x)=\frac{1}{1+e^{-(\beta_0+\beta_1 x)}}</math>
<math>\beta_0 = -\mu/s</math>稱為截距,是直線<math>y = \beta_0+\beta_1 x</math>的y截距。<math>\beta_1= 1/s</math>是反比例參數或速率參數,是作為"x"函數的對數發生率的"y"截距和斜率。反之,<math>\mu=-\beta_0/\beta_1</math>,並且<math>s=1/\beta_1</math>。
邏輯分布公式[編輯 | 編輯原始碼]
- <math> P(Y=1 | X=x) = \frac{ e^{x'\beta} }{1+ e^{x'\beta}}.</math>
其中參數<math>\beta</math>常用最大概似估計。
IIA假設[編輯 | 編輯原始碼]
全名為Independent and irrelevant alternatives假設,也稱作IIA效應,指Logit模型中的各個可選項是獨立的。
IIA假設示例[編輯 | 編輯原始碼]
市場上有A,B,C三個商品相互競爭,分別占有市場份額:60%,30%和10%,三者比例為:6:3:1
一個新產品D引入市場,有能力占有20%的市場——
如果滿足IIA假設,各個產品獨立作用,互不關聯:新產品D占有20%的市場份額,剩下的80%在A、B、C之間按照6:3:1的比例瓜分,分別占有48%,24%和8%。
如果不滿足IIA假設,比如新產品D跟產品B相似度高,則新產品D的CP值高而奪去產品B的部分市場(總份額的20%),則產品B剩餘10%,而產品A和C的市場份額保持60%和10%不變。
滿足IIA假設的優點[編輯 | 編輯原始碼]
IIA假設的檢定[編輯 | 編輯原始碼]
Hausman檢定[編輯 | 編輯原始碼]
一般化模型的檢定[編輯 | 編輯原始碼]
IIA問題的解決方法[編輯 | 編輯原始碼]
機器學習與資料探勘 |
---|
File:Multi-Layer Neural Network-Vector-Blank.svg |
多項式Probit模型[編輯 | 編輯原始碼]
一般化極值模型[編輯 | 編輯原始碼]
可以將可選項間的相關性建模
巢式Logit模型[編輯 | 編輯原始碼]
巢式(Nested)表示可選項被分作不同的組,組與組之間不相關,組內的可選項相關,相關程度用1-λg來表示(1-λg越大,相關程度越高)
對偶組合Logit模型[編輯 | 編輯原始碼]
一般化分簇Logit模型[編輯 | 編輯原始碼]
混合Logit模型[編輯 | 編輯原始碼]
應用[編輯 | 編輯原始碼]
配體結合分析[編輯 | 編輯原始碼]
配體結合分析的典型校準曲線是S形的,下邊界(漸近線)靠近背景信號(非特異性結合),而上漸近線靠近最大的飽和響應。 四參數邏輯模型通常是擬合這種形狀校準曲線的首選,可以準確描述測量信號值與分析物濃度之間的S形關係。當不對稱性明顯時會添加第五個參數,但可能會導致擬合算法變得不穩定。<ref>Findlay, John W. A.; Dillard, Robert F. Appropriate calibration curve fitting in ligand binding assays. The AAPS Journal. 2007-06, 9 (2). ISSN 1550-7416. doi:10.1208/aapsj0902029.</ref>
二類評定模型(Binary Logit Model)[編輯 | 編輯原始碼]
- 僅有兩個可選項:V1n,V2n
變量類型 | 統計量 | 組別比較 | 迴歸模型 |
---|---|---|---|
numerical | mean | t-test/ANOVA | 線性迴歸 |
categorical | percentage | Chi-square test | 邏輯迴歸 |
persontime | KM estimates (survival curves) |
Log-rank test | 比例風險迴歸 |
參考書目[編輯 | 編輯原始碼]
| references-column-width | references-column-count references-column-count-{{#if:1|{{{1}}}}} }} | {{#if: | references-column-width }} }}" style="{{#if: | {{#iferror: {{#ifexpr: 1 > 1 }} | -moz-column-width: {{#if:1|{{{1}}}}}; -webkit-column-width: {{#if:1|{{{1}}}}}; column-width: {{#if:1|{{{1}}}}}; | -moz-column-count: {{#if:1|{{{1}}}}}; -webkit-column-count: {{#if:1|{{{1}}}}}; column-count: {{#if:1|{{{1}}}}}; }} | {{#if: | -moz-column-width: {{{colwidth}}}; -webkit-column-width: {{{colwidth}}}; column-width: {{{colwidth}}}; }} }}">{{#if:|
- }}{{#if:
|
- Agresti, Alan: Categorical Data Analysis. New York: Wiley, 1990.
- Amemiya, T., 1985, Advanced Econometrics,Harvard University Press.
- Hosmer, D. W. and S. Lemeshow: Applied logistic regression. New York; Chichester, Wiley, 2000.
參見[編輯 | 編輯原始碼]
外部連結[編輯 | 編輯原始碼]
- UFLDL:Logistic迴歸 {{#if:||(}}頁面存檔備份,存於網際網路檔案館{{#if:||)}}
- 南佛羅里達大學Logistic迴歸課程
- 線上計算Logistic迴歸 {{#if:||(}}頁面存檔備份,存於網際網路檔案館{{#if:||)}}
|