Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ロジスティック回帰 Part 2 - 係数、オッズ比、平均限界効果

Kan Nishida
September 26, 2019

ロジスティック回帰 Part 2 - 係数、オッズ比、平均限界効果

Kan Nishida

September 26, 2019
Tweet

More Decks by Kan Nishida

Other Decks in Science

Transcript

  1. 3 εϐʔΧʔ ੢ా צҰ࿠ CEO EXPLORATORY ུྺ 2016೥ɺσʔλαΠΤϯεͷຽओԽͷͨΊɺExploratory, Inc Λ

    ্ཱͪ͛Δɻ Exploratory, Inc.ͰCEOΛ຿ΊΔ͔ͨΘΒɺσʔλαΠΤϯεɾ ϒʔτΩϟϯϓɾτϨʔχϯάͳͲΛ௨ͯ͠γϦίϯόϨʔͰ ߦΘΕ͍ͯΔ࠷ઌ୺ͷσʔλαΠΤϯεͷීٴͱڭҭʹऔΓ૊ Ήɻ ถΦϥΫϧຊࣾͰɺ16೥ʹΘͨΓσʔλαΠΤϯεͷ։ൃνʔ ϜΛ཰͍ɺػցֶशɺϏοάɾσʔλɺϏδωεɾΠϯςϦδΣ ϯεɺσʔλϕʔεʹؔ͢Δ਺ଟ͘ͷ੡඼ΛੈʹૹΓग़ͨ͠ɻ @KanAugust
  2. ୈ1ͷ೾ ୈ̎ͷ೾ ୈ̏ͷ೾ ϓϥΠϕʔτ(ߴ͍/ݹ͍) Φʔϓϯɾιʔε(ແྉ/࠷ઌ୺) UI & ϓϩάϥϛϯά ϓϩάϥϛϯά 2016

    2000 1976 ϚωλΠθʔγϣϯ ίϞσΟςΟԽ ຽओԽ ౷ܭֶऀ σʔλαΠΤϯςΟετ Exploratory ΞϧΰϦζϜ Ϣʔβʔɾ ମݧ πʔϧ Φʔϓϯɾιʔε(ແྉ/࠷ઌ୺) UI & ࣗಈԽ ϏδωεɾϢʔβʔ ςʔϚ σʔλαΠΤϯεͷຽओԽ
  3. 18 Father_Age = a * Mother_Age + b ܎਺ʢ܏͖ʣ ੾ย

    ܎਺ͱ੾ยΛௐઅ͢Δ͜ͱͰ࣮σʔλͱ Ϛον͢ΔΑ͏ͳ௚ઢ͕ඳ͚Δɻ
  4. 28 ෕਌͕35Ҏ্ͷ֬཰ = logistic(a * Mother_Age + b) ܎਺ʢ܏͖ʣ ੾ย

    ܎਺ͱ੾ยΛௐઅ͢Δ͜ͱͰ࣮σʔλͱ Ϛον͢ΔΑ͏ͳۂઢ͕ඳ͚Δɻ
  5. 37 ෕਌͕35Ҏ্ͷ֬཰ = logistic(a * Mother_Age + b) ܎਺ʢ܏͖ʣ ੾ย

    ܎਺ͱ੾ยΛௐઅ͢Δ͜ͱͰ࣮σʔλͱ Ϛον͢ΔΑ͏ͳۂઢ͕ඳ͚Δɻ
  6. P(Father > 35) = Logistic(0.29 * Mother_Age - 10.12) Pr(Father

    > 35) = Logit (0.29 * Mother_Age - 10.12) -1
  7. Logit( P(Father > 35) ) = 0.29 * Mother_Age -

    10.12 P(Father > 35) = Logistic(0.29 * Mother_Age - 10.12) P(Father > 35) = (0.29 * Mother_Age - 10.12) Logit -1
  8. ϩδοτؔ਺͸֬཰ΛϩάɾΦοζม׵͢Δ Logit( P(y) ) = Log(Odds(y)) Logit( P(Father > 35)

    ) = 0.29 * Mother_Age - 10.12 Log(Odds(Father > 35)) = 0.29 * Mother_Age - 10.12
  9. Log(Odds((Father > 35))) = 0.29 * 20 - 10.12 =

    -4.32 ฼਌͕20 Log(Odds(Father > 35)) = 0.29 * Mother_Age - 10.12
  10. Log(Odds((Father > 35))) = 0.29 * 20 - 10.12 =

    -4.32 ฼਌͕21 Log(Odds((Father > 35))) = 0.29 * 21 - 10.12 = -4.03 ฼਌͕20 Log(Odds(Father > 35)) = 0.29 * Mother_Age - 10.12
  11. Log(Odds((Father > 35))) = 0.29 * 20 - 10.12 =

    -4.32 ฼਌͕21 Log(Odds((Father > 35))) = 0.29 * 21 - 10.12 = -4.03 ฼਌͕20 Log(Odds(Father > 35)) = 0.29 * Mother_Age - 10.12 0.29 ࠩ ฼਌ͷ೥ྸ͕1ࡀ্͕Δͱɺ෕਌͕35ࡀҎ্Ͱ͋Δ ϩάɾΦοζ͕0.29্͕Δɻ
  12. 65 ෕਌͕35Ҏ্ͷ֬཰ = logistic(a * Mother_Age + b) ܎਺ʢ܏͖ʣ ੾ย

    ܎਺ͱ੾ยΛௐઅ͢Δ͜ͱͰ࣮σʔλͱ Ϛον͢ΔΑ͏ͳۂઢ͕ඳ͚Δɻ
  13. 74 50% 50% 100% 0% mother_age(฼਌ͷ೥ྸ) 34 When Mother is

    34, what is the odds of Father being older than 35?
  14. 77 1 50% 50% 66.7/33.3 2 33.3% 66.7% 34 35

    Φοζ mother_age(฼਌ͷ೥ྸ) 100% 0%
  15. 78 1 50% 50% 80/20 2 33.3% 66.7% 34 35

    20% 80% 36 4 Φοζ mother_age(฼਌ͷ೥ྸ) 100% 0%
  16. 79 1 50% 50% 88.9/11.1 33.3% 66.7% 34 35 20%

    80% 36 11.1% 88.9% 37 2 4 8 Φοζ mother_age(฼਌ͷ೥ྸ) 100% 0%
  17. 81 TRUE FALSE 1 50% 50% 33.3% 66.7% 20% 80%

    11.1% 88.9% 2 4 8 Φοζ 2x Φοζൺ mother_age(฼਌ͷ೥ྸ) 34 35 36 37
  18. 82 TRUE FALSE 1 50% 50% 33.3% 66.7% 20% 80%

    11.1% 88.9% 2 4 8 Φοζ 2x Φοζൺ mother_age(฼਌ͷ೥ྸ)͕ 1্͕Δͱŋŋŋ TRUEͱͳΔΦοζ͕2ഒʹͳΔɻ mother_age(฼਌ͷ೥ྸ) 34 35 36 37
  19. 83 TRUE FALSE 1 50% 50% 33.3% 66.7% 20% 80%

    11.1% 88.9% 2 4 8 Φοζ 2x Φοζൺ mother_age(฼਌ͷ೥ྸ) 34 35 36 37 Logistic Curve guarantee that this Odds Ratio is constant.
  20. தࠃਓ നਓ TRUE 296 39,221 FALSE 3,839 311,954 39,221 (TRUE)

    / (39,221+311,954) (Total) = 0.112 (11.2%) നਓͷ฼਌ͷ࣌ʹTRUEʹͳΔ֬཰͸ʁ
  21. தࠃਓ നਓ TRUE 296 39,221 FALSE 3,839 311,954 TRUEͷ֬཰: 296

    / (296+3,839) = 0.072 FALSEͷ֬཰: 1 - 0.072 = 0.928 Φοζ: 0.072 / 0.928 = 0.077 தࠃਓͷ฼਌ͷ࣌ʹTRUEʹͳΔΦοζ͸ʁ
  22. தࠃਓ നਓ TRUE 296 39,221 FALSE 3,839 311,954 TRUEͷ֬཰: 39,221

    / (39,221 + 311,954) = 0.112 FALSEͷ֬཰: 1 - 0.112 = 0.888 Φοζ: 0.112 / 0.888 = 0.126 നਓͷ฼਌ͷ࣌ʹTRUEʹͳΔΦοζ͸ʁ
  23. தࠃਓ നਓ TRUE 296 39,221 FALSE 3,839 311,954 0.126 0.077

    നਓʹൺ΂ͯதࠃਓ͕TRUEʹͳΔΦοζ͸ʁ Φοζ
  24. தࠃਓ നਓ TRUE 296 39,221 FALSE 3,839 311,954 0.126 0.077

    നਓʹൺ΂ͯதࠃਓ͕TRUEʹͳΔΦοζ͸ʁ 0.077 / 0.126 = 0.611 Φοζ Φοζൺ
  25. தࠃਓ നਓ TRUE 296 39,221 FALSE 3,839 311,954 0.126 0.077

    നਓʹൺ΂ͯதࠃਓ͕TRUEʹͳΔΦοζ͸0.611ഒʁ 0.077 / 0.126 = 0.611 Φοζ Φοζൺ
  26. தࠃਓ നਓ TRUE 296 39,221 FALSE 3,839 311,954 0.126 0.077

    നਓʹൺ΂ͯதࠃਓ͕TRUEʹͳΔΦοζ͸40ˋ௿͍ʁ 0.077 / 0.126 = 0.611 Φοζ Φοζൺ
  27. The odds of Chinese Mothers having premature babies is 40%

    less likely compared to White Mothers.
  28. Source: More meat, more problems: Bacon may increase breast cancer

    risk in Latinas. U of South Carolina News, Zen Vuong, March 3 2016 “ϕʔίϯΛຖ೔20άϥϜ΄Ͳ৯΂Δϥςϯܥͷঁੑ͕ೕ͕Μ ʹͳΔՄೳੑ͸ϕʔίϯΛ৯΂ͳ͍ϥςϯܥͷঁੑʹൺ΂ͯ 42ˋߴ͘ͳΔ͜ͱ͕ݚڀͷ݁ՌΘ͔ͬͨɻ”
  29. Source: More meat, more problems: Bacon may increase breast cancer

    risk in Latinas. U of South Carolina News, Zen Vuong, March 3 2016 “ϕʔίϯΛຖ೔20άϥϜ΄Ͳ৯΂Δϥςϯܥͷঁੑ͕ೕ͕Μ ʹͳΔΦοζ͸ϕʔίϯΛ৯΂ͳ͍ϥςϯܥͷঁੑʹൺ΂ͯ 1.42ഒͰ͋Δ͜ͱ͕ݚڀͷ݁ՌΘ͔ͬͨɻ”