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

関連2群のt検定/独立2群のt検定 / Related 2-group t-test and ...

関連2群のt検定/独立2群のt検定 / Related 2-group t-test and independent 2-group t-test

早稲田大学大学院経営管理研究科「企業データ分析」2024 冬の第7-8回で使用したスライドです。

Kenji Saito

December 20, 2024
Tweet

More Decks by Kenji Saito

Other Decks in Technology

Transcript

  1. Corporate data analysis — generated by Stable Diffusion XL v1.0

    2024 7-8 2 t 2 t (WBS) 2024 7-8 2 t 2 t — 2024-12-23 – p.1/35
  2. ( ) 1 12 2 • 2 12 2 (B

    A ) • 3 12 9 • 4 12 9 • 5 12 16 • 6 12 16 t • 7 12 23 2 ( ) t • 8 12 23 2 ( ) t • 9 1 6 P 10 1 6 11 1 20 12 1 20 13 1 27 14 1 27 W-IOI 2024 7-8 2 t 2 t — 2024-12-23 – p.3/35
  3. ( 20 25 ) 1 (20 ) • 2 R

    ( 55 ) • 3 (32 ) • 4 (14 ) • 5 ( Git) (22 ) • 6 ( ) (24 ) • 7 (1) (25 ) • 8 (2) (25 ) • 9 R ( ) (1) — Welch (17 ) • 10 R ( ) (2) — (21 ) • 11 R ( ) (1) — (15 ) • 12 R ( ) (2) — (19 ) • 13 GPT-4 (19 ) • 14 GPT-4 (29 ) • 15 ( ) LaTeX Overleaf (40 ) • 8 (12/16 ) / (2 ) OK / 2024 7-8 2 t 2 t — 2024-12-23 – p.4/35
  4. 5 1 : 2 : 3 : 4 : 2

    6 t µ 95% Student t σ 95% 95% 95% 2024 7-8 2 t 2 t — 2024-12-23 – p.5/35
  5. ( Student µ 95% ) 7 2 t ( t

    ) 2 ( ) 2 d ( ) ← [ 3] σd 2 t 8 2 t ( t ) 2 ( ) ( ) ← [ 4] σ 2 t 2024 7-8 2 t 2 t — 2024-12-23 – p.6/35
  6. 3. µ 95% (1) (t ) µ 95% (2) 2024

    12 19 ( ) 23:59 JST ( ) Waseda Moodle (Q & A ) (1) Discord 2024 7-8 2 t 2 t — 2024-12-23 – p.8/35
  7. . . . . . . 17 16 (12/20( )

    ) ( ) ^^; ( ) 4 11 (1) ( p.146) ( ) . . . (2) ( σ √n ) ( ) t 95% ( ) (3) 95 100 sqrt(10) 10^2 ( 10^2=100, sqrt(10)=3.162) ( ) ( = ) t 2024 7-8 2 t 2 t — 2024-12-23 – p.9/35
  8. (1/2) (^^;) ( ( n ) ) = ( -

    ) ÷ × 10 + 50 x − µ σ (z) ×10 + 50 50 10 “ .txt” ( ) “ .R” psd(v) : v ( sd(v) ) ndistg(x, µ, σ) : z 2024 7-8 2 t 2 t — 2024-12-23 – p.10/35
  9. (2/2) (“ .R” ) > g <- read.table(" .txt", header=T)

    > g$ # > ndistg(x=91, mu=mean(g$ ), sigma=psd(g$ )) # 5 z ( ) z 2024 7-8 2 t 2 t — 2024-12-23 – p.11/35
  10. µ 95% (1/4) : N(µ, σ2) ( : ) STEP

    1 : : 10 STEP 2 : µ . . . 20 19 µ x [ 1] N(µ, σ2 n ) : 10 x z 95% ( 20 19 ) −z0.05 ≤ z (x − µ) √ n σ ≤ +z0.05 σ 2024 7-8 2 t 2 t — 2024-12-23 – p.12/35
  11. . . . . . . 1.96 σ √n (

    ) σ ↑ −z0.05 ≤ (x − µ) √ n σ (1) ⇒ −z0.05 × σ ≤ (x − µ) √ n (2) ⇒ −z0.05 × σ √ n ≤ x − µ (3) ⇒ µ − z0.05 × σ √ n ≤ x (4) ⇒ µ ≤ x + z0.05 × σ √ n (5) σ 2024 7-8 2 t 2 t — 2024-12-23 – p.13/35
  12. µ 95% (2/4) s N(0, 12) ( n 1,000 .

    . . ) n ( df) t (Student ) x Student t 95% ( 20 19 ) −t0.05 (df) ≤ t (x − µ) √ n s ≤ +t0.05 (df) µ . . . − t0.05 (df) ≤ (x − µ) √ n s (6) ⇒ − t0.05 (df) × s √ n ≤ x − µ (7) ⇒ µ ≤ x + t0.05 (df) × s √ n ( ) (8) (x − µ) √ n s ≤ +t0.05 (df) (9) ⇒ x − µ ≤ +t0.05 df × s √ n (10) ⇒ x − t0.05 (df) × s √ n ≤ µ ( ) (11) 2024 7-8 2 t 2 t — 2024-12-23 – p.14/35
  13. µ 95% (3/4) ┸ ┼ ┸⒨⒨⒭  ┸⒨⒨⒭  ┸

    df 9 t0.05 9 = 2.26  ▂  ▂ ฼ฏۉЖͷ  ৴པ۠ؒ ͕ 4UVEFOU Խ͞Εͨ΋ͷ ┸⒨⒨⒭  º 㲋┲ ┷ ্ଆ৴པݶք Լଆ৴པݶք 2024 7-8 2 t 2 t — 2024-12-23 – p.15/35
  14. µ 95% (4/4) “ .txt” µ 95% ( 100 )

    > mean(g$ ) - abs(qt(0.025, 99)) * sd(g$ ) / sqrt(100) # > mean(g$ ) + abs(qt(0.025, 99)) * sd(g$ ) / sqrt(100) # qt(0.025, length(g$ ) - 1) sqrt(length(g$ )) 95% CI [55.3, 62.9] “ L.R” sample t.test(g$ ) 95% CI [47.9, 55.6] 2024 7-8 2 t 2 t — 2024-12-23 – p.16/35
  15. M (1/2) [ ] 20 19 µ µ 95% [

    ] 0 1 [ ] t (Student t ) µ 95% t 2024 7-8 2 t 2 t — 2024-12-23 – p.17/35
  16. M (2/2) 6 5 t 2.571 31 30 2.042 1.96

    t 31 ⇒ 2024 7-8 2 t 2 t — 2024-12-23 – p.18/35
  17. N ( µ) 1. 1000 30 2. 30 3. 95%

    160cm 165cm 95% 160cm 165cm 100 95 ⇒ 95% 2024 7-8 2 t 2 t — 2024-12-23 – p.19/35
  18. M R R R R ⇒ . . . Perplexity

    ( ) Jiangshan Lai, Weijie Zhu, Dongfang Cui, Dayong Fan, Lingfeng Mao, The use of R in forestry research, Journal of Plant Ecology, Volume 16, Issue 6, December 2023, rtad047, https://doi.org/10.1093/jpe/rtad047 NotebookLM ( ) 2013 2022 10 8 14,800 R R 2013 28.3% 2022 60.9% 2020 R 2024 7-8 2 t 2 t — 2024-12-23 – p.20/35
  19. F TIPS R PC Windows11 Global options > Graphics >

    Backend AGG Save as PDF Use cairo_pdf device PDF . . . ⇒ PDF “startup.R” 2024 7-8 2 t 2 t — 2024-12-23 – p.21/35
  20. K web ⇒ 2024 7-8 2 t 2 t —

    2024-12-23 – p.22/35
  21. M pptx Word ⇒ ( ) ( ) . .

    . (cf. ) ( . . . ) ( LLM ) ( ) 2024 7-8 2 t 2 t — 2024-12-23 – p.23/35
  22. 7 2 t ( t ) 2 ( ) 2

    d ( ) ← [ 3] σd 2 t 2024 7-8 2 t 2 t — 2024-12-23 – p.24/35
  23. 3 : ( ) A B N(µA , σ2 A

    ) N(µB , σ2 B ) ( ) xA xB (xA + xB ) (xA − xB ) ( (reproductive property)) (xA + xB ) ( ) (µa + µb ) (xA − xB ) ( ) (µa − µb ) (xA + xB ) (xA − xB ) (σ2 A + σ2 B ) (xA + xB ) (xA − xB ) σ2 A + σ2 B 2024 7-8 2 t 2 t — 2024-12-23 – p.25/35
  24. 2 ( ) d ( ) d sd d (

    )µd d ( )µd d Student µd t = (d − µd ) √ n sd = d √ n sd (t ) t df = n − 1 t t(n − 1) ( ) t0.05 (df) t0.05 (df) < |t| (P < 0.05) 2024 7-8 2 t 2 t — 2024-12-23 – p.26/35
  25. N ( p.160) “ N.R” ( t.test() ) p.158 “

    .txt” / colnames(g) <- c(" ", " ") sampleA <- g$ sampleB <- g$ # 2024 7-8 2 t 2 t — 2024-12-23 – p.27/35
  26. 8 2 t ( t ) 2 ( ) (

    ) ← [ 4] σ 2 t 2024 7-8 2 t 2 t — 2024-12-23 – p.28/35
  27. 4 : (xA − xB ) ( ) 1 3

    A B N(µA , σ2 A ) N(µB , σ2 B ) xA xB xA xB (xA − xB ) (xA − xB ) ( ) (µA − µB ) (xA − xB ) xA xB σ2 A nA + σ2 B nB σ2 A nA + σ2 B nB 2024 7-8 2 t 2 t — 2024-12-23 – p.29/35
  28. (1/2) 2 ( ) xA − xB (1) : (2)

    : σ ( ) σ sp sp = s2 A (nA − 1) + s2 B (nB − 1) nA + nB − 2 (R var() ) nA + nB − 2 t Welch A B (µA = µB ) A B (µA = µB ) 2024 7-8 2 t 2 t — 2024-12-23 – p.30/35
  29. (2/2) xA − xB Student µA = µB t =

    (xA − xB ) − (µA − µB ) sp 1 nA + 1 nB = xA − xB sp 1 nA + 1 nB (t ) t dfp = nA + nB − 2 t ( ) t0.05 (dfp ) t0.05 (dfp ) < |t| (P < 0.05) 2024 7-8 2 t 2 t — 2024-12-23 – p.31/35
  30. P ( p.186) “ P.R” ( t.test() ) p.184 “

    .txt” A /B colnames(g) <- c(" ", " ") sampleA <- g$ sampleB <- g$ # 2024 7-8 2 t 2 t — 2024-12-23 – p.32/35
  31. 4. t (1) 2 t (2) 2 t (3) 2025

    1 2 ( ) 23:59 JST ( ) Waseda Moodle (Q & A ) (1)(2) Discord 2024 7-8 2 t 2 t — 2024-12-23 – p.34/35