




已阅读5页,还剩40页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
迴歸分析 相關係數 Correlation 描述兩個變數X Y之間的線性相關Example data1中的身高及體重 2 如何量化這樣的線性關係呢 Correlation Linearcorrelation 相關係數 Correlation Bydefinition thecorrelationbetweenXandYisItsestimate Pearson scorrelationcoefficient 3 相關係數 Correlation r o positivelycorrelatedr 0 negativelycorrelatedr 0 nolinearcorrelationr 0不代表 Y之間沒有關係 有可能只是他們之間的關係不是線性的 畫圖還是必要的 4 相關係數 Correlation R程式 cor x y method c pearson kendall spearman x 數值向量或是矩陣y 數值向量 當x是矩陣的時候 可以不需輸入 5 相關係數 Correlation 若想進一步檢定vs 檢定統計量95 confidenceinterval 6 相關係數 Correlation R程式 cor test x y alternative c two sided less greater method c pearson kendall spearman exact NULL conf level 0 95 continuity FALSE x 數值向量y 數值向量exact T或F 表示是否計算exactp valuecontinuity 是否需要進行連續校正 7 所以身高與體重有統計顯著的正相關 Practice 8 請畫出在Surgicaldata中 liver與clot的散佈圖 請問由圖中 可以看出liver與clot的關係嗎 請計算liver與clot的相關係數 請檢定liver與clot之相關係數是否為0 Q 除了看相關性的強度 能不能看彼此如何影響 Regression LinearRegression Step1 血壓的分布 該分布是否男女有別 Step2 血壓是否和體重有線性相關 Step3 該線性關係如何描述 Step4 如何描述血壓和體重 性別 等等的關係 Y responsevariable dependentvariable say bp X covariate explanatoryvariable independentvariable say weight 9 LinearRegression Q howdoesXaffectY Canwefitalineinthescatterplot Infact weshouldsay where iscallederror isnormalwithzeromeanandvariance 2 10 Regressionmodel simplelinearregression 11 直線上的點是估的 叫fittedvalues 這是已知體重X之後 期望的血壓值 是期望值 故人稱regresstowardthemean 這和觀察值不同 有samplingvariation Estimatecoefficients Howtofind intercept and slope LeastSquares MinimizeresidualsumofsquaresTakederivative 12 residual isthedifferencebetweenfittedandobservedvalues Y軸的差 Estimatecoefficients Rearrangetheterms getnormalequationsSolvingthenormalequations wegetestimates 13 AretheseLSEgood Aretheyunbiased Standarderrorsoftheseestimates 14 Unbiased AretheseLSEgood Instatistics toask Aretheseestimatesgood isthesameasasking Aretheyclosetothetruevalues Theyaregoodinthesensethattheyareunbiased Theyarebestlinearunbiasedestimators BLUE Gauss Markovtheorem Undertheconditionsofregressionmodel mean constantvariance uncorrelatederrors theleastsquaresestimatorsareunbiasedandhaveminimumvarianceamongallunbiasedlinearestimators 15 Estimationofvariance canbeestimatedbyTherefore 16 LinearregressionusingR R程式 lm formula data formula y x 其中y是response x是covariate 17 3 943 70 8432 17 9663 Linearregression Confidenceintervalofand Uset distributionwithdf n 2Testingifthecoefficient 0 If 0 Usetwithdf n 2Anincreaseof1kginWeightleadstoanincreaseof0 7167inBp Ifsomeoneweighs70kg thenhis herbpisestimatedby70 84 0 72 70 121 24 interpolation 18 Linearregression Meaningfulwhenestimatingbpwith120kg notreally outsidetherangeofthedata dangerousextrapolationRegressiondoesnotimplycausality ItsimplyreflectstheregressionrelationbetweenX weight andY bp ThisregressiondoesnotsayXcausesY Canweusebptopredictweight yes ifweightisthevariableofinterest 19 Practice 想知道在Surgicaldata中 clot如何影響liver 請建立liver與clot之迴歸模式 如何解釋此模型呢 請問clot對liver的影響是顯著的嗎 20 Homework 想知道在Surgicaldata中 enzyme如何影響SVtime 請建立enzyme與SVtime之迴歸模式 如何解釋此模型呢 請問enzyme對SVtime的影響是顯著的嗎 21 Howgoodistheregression Howgooddoesthelineexplainallthevariationiny Howgooddoesthefittedcorrelationof X Y explainY 因為定義判斷係數 coefficientofdetermination Pearson scorrelationcoefficientInsimplelinearregression 22 totaldeviationinresponsesaroundthegrandmean deviationofobservationsaroundfittedline deviationoffittedvaluesaroundthegrandmean SSTO SSE SSR percentageofvariationexplainedbyregressionline Example 23 R2 0 4149 AVOVAtableofregression 24 SSE SSR Practice 在Surgicaldata中 模式為liver clot請問在此模型中 判斷係數為多少 25 Diagnostics 26 基本假設 殘差平均為0 相差變異數相同 殘差之間不相關 看看殘差的分佈情況 看殘差和index的關係 應該要沒關係 殘差應該要和fittedvalue無關 殘差應該要與解釋變數無關 Diagnostics If 27 Randomlyscatteredaroundzero Fromminustopositive Modelmaynotbeproper Timeeffect Ifx time Linearity有問題試試polynomial或transformX Constantvar有問題 若X值大則var大 試試加別的X或是weightedLS Example 28 Q Qplot 如果殘差服從常態分配 那麼除了它的長條圖像常態之外 它的排名的值和實際母體同排名的值像不像呢 Thequantileoftheresidualversusthenormalquantile 29 將殘差標準化 再排序 第2 6 0 33 分位的quantile是 1 33即P ei 1 33 2 6 算出排序的名次 對常態來說 第2 6 0 33 分位的quantile是 0 43 即P Z 0 43 2 6 33 對常態來說第0 26分位的quantile是 0 64 即P Z 0 64 26 Plotthesetwocolumns Q Qplot IfclosetoaX Ystraightline thenresidualsclosetonormality R程式 qqnorm model1 residuals 30 殘差中排名4 6的殘差值和N 0 1 中累積機率為4 6的值 Q Qplot 31 Yisrightskewed Yisleftskewed DiagnosticsinR 32 Diagnostics plotstoexamineThelineareffectofeachpredictor orConstantvariance Independenceofsamples orNormalityassumption Q QplotOtherimportantpredictors Say Arethereoutliers scatterplot IfYes examineifitistrueoutlier orgrosserror IfYes moredatanearthispoint IfNo deletethedatapointbeforeregressionanalysis 6 fittedmodel 2 3 1 4 5 33 Practice 在Surgicaldata中 模式為liver clot請問此模式符合迴歸的假設嗎 34 Multiplelinearregression ExtensionofSLR includingmorethanonepredictorsinthemodel 35 Linear Linear Difference Multiplelinearregression Model regressioncoefficients observeddataareindependentInmatrixform 36 Multiplelinearregression 哪些term可以放到X中呢 Predictors 如例子中的weight age sexTransformationsofpredictorsPolynomials andDummyvariablesandfactorsInteractionsandothercombinationsofpredictors 37 Example 38 Inferenceofregressioncoefficients 和SLR時一樣 用最小平方法satisfyGauss MarkovThm 39 Inferenceofregressioncoefficients 和在SLR中相同 我們想要估計的confidenceinterval 或是進行檢定 需要先估計出Recall inSLR 40 Hiscalledhatmatrix SST SSE SSR Therearep 1covariatesintheregressionmodel Therearenobservationsandpparameters Inferenceofregressioncoefficients 想要知道整個模式fit如何 Under E MSR otherwiseE MSR Define withdf p 1 n p 在H0之下 所以如果F偏離1太遠 我們就傾向拒絕H0H1是什麼呢 41 Inferenceofregressioncoefficients 若是針對某個 想知道是否和有
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 在线教育平台内容制作手册
- 房屋买卖合同居间协议
- 工程管理质量与安全控制手册
- 家具厂厂长聘任书合同
- 地皮交易居间协议合同
- 2025年绵阳货运从业资格证考试题库
- 《数据可视化技术应用》3.3 构建销售数据动态分析看板-教案
- 员工上下班安全协议书5篇
- 厂房消防劳务承包合同范例
- 淮北房产合同范本
- 蒋诗萌小品《谁杀死了周日》台词完整版
- 【海信电器产品成本控制问题及完善措施分析】9600字
- 电子书 -品牌设计法则
- 2021版劳动实践河北科学技术出版社二年级下册超轻黏土创意多教案
- 中考复习物理力学部分综合试题(人教版含答案)
- BCP业务连续性管理手册
- 2024年湖南铁路科技职业技术学院单招职业技能测试题库及答案解析word版
- 2024年中考英语第一次模拟试卷-(广州卷)(全解全析)
- 使用农产品承诺函
- 分式方程说课王彦娥
- 2023配电网施工典型工艺
评论
0/150
提交评论