發表文章

目前顯示的是 8月, 2022的文章

什麼是 logistic regression?

圖片
Logistic regression ,中文翻譯為 邏輯式迴歸 ,是線性迴歸的一種延伸型式,當應變數 (dependent variable) Y 為類別變數 (categorical variable) 時,可以用 logistic regression 來估計 Y 發生的機率。當 Y 的類別只有二種時,例如:Yes/No,成功/不成功,買/不買,投票/不投票,稱做 binary logistic regression ( 二元邏輯式迴歸 )。 當 Y 是二元類別變數時,它發生的機率 p 會界於 0 和 1 之間。 此時,可以用 p 的 logit transformation, 定義為 logit( p ) = ln [ p /(1 − p )] 也就是 p 的勝算 (odds),再取自然對數。這樣,用 logit( p ) 當做迴歸分析中的應變數,它的值就可以從 −∞ 到 +∞。 Logistic regression model 可以寫成: logit(p) = α + β 1 x 1 + . . . + β k x k 那麼, Y 發生的機率 p 可表示成: 補充: 1. Logistic regression 也可以稱為 logit model ( 羅吉特機率模型 )。而 binary logistic regression 也可以稱為 binary logit model ( 二分羅吉特機率模型 )。 2. logit 的命名:logit 視為上述計算中的一個 log istic un it 。 3. Standard logistic function 是  y = e x / (1 + e x )  而 logit function 則是 standard logistic function 的反函數,即 x = ln [ y / (1 − y )] 參考資料: https://www.ibm.com/topics/logistic-regression https://stats.oarc.ucla.edu/r/dae/logit-regression/ https://en.wikipedia.org/wiki/Logistic_regression https://en.wikipedia.org/wik