230 likes | 299 Views
變異數期末報告. 第 19 組 493310052 胡凱文 493310179 林冠仲 493310193 林銘賜 493310686 陳哲楷. Data Set C.9 Ischemic Heart Diease. 總理賠金 年齡 性別 拿藥次數 急診室次數 併發症次數 治療天數 179.1 63 0 1 4 3 300 319.0 59 0 0 6 0 120
E N D
變異數期末報告 第19組 493310052 胡凱文 493310179 林冠仲 493310193 林銘賜 493310686 陳哲楷
Data Set C.9 Ischemic Heart Diease • 總理賠金 年齡 性別 拿藥次數 急診室次數 併發症次數 治療天數 • 179.1 63 0 1 4 3 300 • 319.0 59 0 0 6 0 120 • 9310.7 62 0 0 2 5 353 • 280.9 60 1 0 7 2 332 • 18727.1 55 0 2 7 0 18 • 453.4 66 0 0 3 4 296 • 323.1 64 1 0 3 1 247 • 3873.6 45 1 0 5 1 82 • : : : : : : : • 1137.5 67 1 0 11 3 67 • 2677.7 68 0 2 6 10 303 • 1282.2 58 0 2 2 7 244 • 586.0 56 0 4 6 3 336
研究問題 • 此問題是研究保險公司對病人的總理賠金,而非病人保險所花費用,保險公司收集了788筆資料研究影響缺血性心臟病對於下列變數是否有關係 • 反應變項(response variable) : 總理賠金 • 自變項(independent variable) : 年齡、性別、介入、拿藥次數、進急診室次數、併發症、治療時間 • 我們這組自變項挑年齡、性別、拿藥次數這三個做研究
P值與R-Sq • P值如果小於0.05,表示較為顯著,如果大於0.05,表示較不顯著。 • R-Sq 表示我們所找的因子(年齡、性別、拿藥次數)對於反應變項(總理賠金)的影響程度,如果R-Sq愈大,表示影響程度就愈大,反之,如果R-Sq愈小,表示影響程度越小。
單因子 • 首先先研究年齡對保險公司所花費的總理賠金是否有影響 • 數據中年齡最高為70,最低為24,我們將所有年齡分5個區間1(24~34)、2(35~42)、3(43~52)、5(53~70),再做分析
One-way ANOVA: 總理賠金 versus 年齡 Source DF SS MS F P C3 4 232541324 58135331 1.30 0.268 Error 783 34993252138 44691254 Total 787 35225793462 S = 6685 R-Sq = 0.66% R-Sq(adj) = 0.15% Individual 95% CIs For Mean Based on Pooled StDev Level N Mean StDev --------+---------+---------+---------+- 1 4 302 232 (------------------*------------------) 2 21 4430 9369 (--------*-------) 3 107 3845 9037 (---*---) 4 353 2499 5702 (-*-) 5 303 2702 6595 (-*-) --------+---------+---------+---------+- -3500 0 3500 7000 Pooled StDev = 6685
由上表觀察出年齡與總理賠金並不是成正比的,各個年齡區間總理賠金是差不多的,而較特別的是區間1的範圍較廣由上表觀察出年齡與總理賠金並不是成正比的,各個年齡區間總理賠金是差不多的,而較特別的是區間1的範圍較廣
再來研究性別對保險公司所花費的總理賠金是否有影響再來研究性別對保險公司所花費的總理賠金是否有影響 • 由於性別只有1(男)、0(女),所以直接做分析
One-way ANOVA: 總理賠金 versus 性別 Source DF SS MS F P C4 1 12089215 12089215 0.27 0.604 Error 786 35213704248 44801150 Total 787 35225793462 S = 6693 R-Sq = 0.03% R-Sq(adj) = 0.00% Individual 95% CIs For Mean Based on Pooled StDev Level N Mean StDev --------+---------+---------+---------+- 0 608 2867 6867 (---------*----------) 1 180 2572 6067 (------------------*-------------------) --------+---------+---------+---------+- 2000 2500 3000 3500 Pooled StDev = 6693
由上表可知1(男生)範圍較廣,但總理賠金也是差不多的,平均2(女生)較男生高一點由上表可知1(男生)範圍較廣,但總理賠金也是差不多的,平均2(女生)較男生高一點
再來研究藥物種類對保險公司所花費的總理賠金是否有影響再來研究藥物種類對保險公司所花費的總理賠金是否有影響 • 拿藥次數有0、1、2、3、4、5、6、7次 • 直接做分析
One-way ANOVA: 總理賠金 versus 拿藥次數 Source DF SS MS F P C6 7 1686653262 240950466 5.60 0.000 Error 780 33539140201 42998898 Total 787 35225793462 S = 6557 R-Sq = 4.79% R-Sq(adj) = 3.93%
Individual 95% CIs For Mean Based on Pooled StDev Level N Mean StDev --------+---------+---------+---------+- 0 611 2230 5762 (*) 1 89 4323 8030 (-*-) 2 49 4025 6901 (--*-) 3 19 4012 7550 (---*---) 4 9 6023 11015 (------*-----) 5 5 14217 22001 (-------*--------) 6 4 13209 21319 (--------*--------) 7 2 3713 5199 (------------*------------) --------+---------+---------+---------+- 0 7000 14000 21000 Pooled StDev = 6557
觀察上表可發現,拿5次藥跟拿6次藥的總理賠金最多,而拿7次並不是最多,可知並沒有成正比觀察上表可發現,拿5次藥跟拿6次藥的總理賠金最多,而拿7次並不是最多,可知並沒有成正比
結論 • 由各個結果的R-Sq可知年齡(0.66%)、性別(0.03%)對總理賠金的影響較不顯著 • 拿藥次數(R-Sq = 4.79%)對總理賠金的影響較為顯著,拿5次藥跟拿6次藥的總理賠金較多
雙因子 • 再來用General Linear Model研究年齡和性別對保險公司所花費的總理賠金
General Linear Model: 總理賠金 versus 年齡, 性別 Factor Type Levels Values C3 fixed 5 1, 2, 3, 4, 5 C4 fixed 2 0, 1 Analysis of Variance for C2, using Adjusted SS for Tests Model Source DF Reduced DF Seq SS C3 4 4 232541324 C4 1 1 16982254 C3*C4 4 3+ 248542602 Error 778 779 34727727283 Total 787 787 35225793462 + Rank deficiency due to empty cells, unbalanced nesting, collinearity, or an undeclared covariate. No storage of results or further analysis will be done. S = 6676.82 R-Sq = 1.41% R-Sq(adj) = 0.40%
再來用General Linear Model研究年齡和拿藥次數對保險公司所花費的總理賠金
General Linear Model: 總理賠金 versus 年齡, 拿藥次數 Factor Type Levels Values C3 fixed 5 1, 2, 3, 4, 5 C6 fixed 8 0, 1, 2, 3, 4, 5, 6, 7 Analysis of Variance for C2, using Adjusted SS for Tests Model Source DF Reduced DF Seq SS C3 4 4 232541324 C6 7 7 1758461679 C3*C6 28 13+ 2338231348 Error 748 763 30896559111 Total 787 787 35225793462 + Rank deficiency due to empty cells, unbalanced nesting, collinearity, or an undeclared covariate. No storage of results or further analysis will be done. S = 6363.45 R-Sq = 12.29% R-Sq(adj) = 9.53%
再來用General Linear Model研究性別和拿藥次數對保險公司所花費的總理賠金
General Linear Model: 總理賠金 versus 性別, 拿藥次數 Factor Type Levels Values C4 fixed 2 0, 1 C6 fixed 8 0, 1, 2, 3, 4, 5, 6, 7 Analysis of Variance for C2, using Adjusted SS for Tests Model Source DF Reduced DF Seq SS C4 1 1 12089215 C6 7 7 1698963910 C4*C6 7 5+ 1527986751 Error 772 774 31986753587 Total 787 787 35225793462 + Rank deficiency due to empty cells, unbalanced nesting, collinearity, or an undeclared covariate. No storage of results or further analysis will be done. S = 6428.57 R-Sq = 9.20% R-Sq(adj) = 7.67%
結論 • 觀察年齡和性別、年齡和拿藥次數、性別和拿藥次數分別對總理賠金的影響,可發現年齡和拿藥次數對總理賠金的R-Sq = 12.29%最大,影響最大 • 為何交互因子無P-value? continous to be discrete 之 level數