版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
迴 歸 分 析相關(guān)係數(shù)(Correlation)
描述兩個變數(shù)X、Y之間的線性相關(guān)Example:data1中的身高及體重
2如何量化這樣的線性關(guān)係呢?Correlation!Linearcorrelation!相關(guān)係數(shù)(Correlation)
Bydefinition,thecorrelationbetweenXandYisItsestimate,Pearson’scorrelationcoefficient3相關(guān)係數(shù)(Correlation)
r>o:positivelycorrelatedr<0:negativelycorrelatedr=0:nolinearcorrelationr=0不代表、Y之間沒有關(guān)係,有可能只是他們之間的關(guān)係不是線性的→畫圖還是必要的4相關(guān)係數(shù)(Correlation)
R程式:cor(x,y,method=c("pearson","kendall","spearman")))x:數(shù)值向量或是矩陣y:數(shù)值向量,當x是矩陣的時候,可以不需輸入5相關(guān)係數(shù)(Correlation)
若想進一步檢定vs.檢定統(tǒng)計量95%confidenceinterval:6相關(guān)係數(shù)(Correlation)
7所以身高與體重有統(tǒng)計顯著的正相關(guān)Practice8請畫出在Surgicaldata中,liver與clot的散佈圖。請問由圖中,可以看出liver與clot的關(guān)係嗎?請計算liver與clot的相關(guān)係數(shù)。請檢定liver與clot之相關(guān)係數(shù)是否為0。
Q:除了看相關(guān)性的強度,能不能看彼此如何影響?Regression!LinearRegressionStep1:
血壓的分布,該分布是否男女有別;Step2:血壓是否和體重有線性相關(guān);Step3:該線性關(guān)係如何描述;Step4:如何描述血壓和體重、性別、等等的關(guān)係。Y:responsevariable,dependentvariable(say,bp)X:covariate,explanatoryvariable,independentvariable(say,weight)9LinearRegressionQ:howdoesX
affectY?Canwefitalineinthescatterplot?Infact,weshouldsay,where
iscallederror,
isnormalwithzeromeanandvariance
2.10Regression
model-simplelinearregression
11直線上的點是估的,叫fittedvalues,這是已知體重X之後,期望的血壓值,是期望值,故人稱regresstowardthemean;這和觀察值不同,有samplingvariationEstimatecoefficientsHowtofind(intercept)and(slope)?LeastSquares!Minimizeresidualsumofsquares
Takederivative12“residual”isthedifferencebetweenfittedandobservedvalues;Y軸的差EstimatecoefficientsRearrangetheterms,getnormalequationsSolvingthenormalequations,wegetestimates13AretheseLSEgood?Aretheyunbiased?Standarderrorsoftheseestimates?14UnbiasedAretheseLSEgood?Instatistics,toask“Aretheseestimatesgood?”isthesameasasking“Aretheyclosetothetruevalues?”Theyaregoodinthesensethattheyareunbiased.Theyarebestlinearunbiasedestimators(BLUE)Gauss-Markovtheorem:Undertheconditionsofregressionmodel(mean,constantvariance,uncorrelatederrors),theleastsquaresestimatorsareunbiasedandhaveminimumvarianceamongallunbiasedlinearestimators.15EstimationofvariancecanbeestimatedbyTherefore16LinearregressionusingRR程式:lm(formula,data,...)formula:y~x,其中y是response,x是covariate
173.943=70.8432/17.9663Linearregression18LinearregressionMeaningfulwhenestimatingbpwith120kg?notreally,outsidetherangeofthedata,dangerousextrapolationRegressiondoesnotimplycausality.ItsimplyreflectstheregressionrelationbetweenX(weight)andY(bp).ThisregressiondoesnotsayXcausesY.Canweusebptopredictweight?yes,ifweightisthevariableofinterest19Practice想知道在Surgicaldata中,clot如何影響liver,請建立liver與clot之迴歸模式。如何解釋此模型呢?請問clot對liver的影響是顯著的嗎?20Homework想知道在Surgicaldata中,enzyme如何影響SVtime,請建立enzyme與SVtime之迴歸模式。如何解釋此模型呢?請問enzyme對SVtime的影響是顯著的嗎?21Howgoodistheregression?Howgooddoesthelineexplainallthevariationiny?Howgooddoesthefittedcorrelationof(X,Y)explainY?因為定義判斷係數(shù)(coefficientofdetermination):
Pearson’scorrelationcoefficientInsimplelinearregression,22totaldeviationinresponsesaroundthegrandmeandeviationofobservationsaroundfittedlinedeviationoffittedvaluesaroundthegrandmeanSSTOSSESSRpercentageofvariationexplainedbyregressionlineExample
23R2=0.4149AVOVAtableofregression
24SSESSRPractice在Surgicaldata中,模式為liver~clot請問在此模型中,判斷係數(shù)為多少25Diagnostics26基本假設(shè):殘差平均為0,相差變異數(shù)相同,殘差之間不相關(guān)看看殘差的分佈情況看殘差和index的關(guān)係(應(yīng)該要沒關(guān)係)殘差應(yīng)該要和fittedvalue無關(guān)殘差應(yīng)該要與解釋變數(shù)無關(guān)DiagnosticsIf…27Randomlyscatteredaroundzero!Fromminustopositive!Modelmaynotbeproper.Timeeffect?(Ifx=time)Linearity有問題試試polynomial或transformX?Constantvar有問題;若X值大則var大;試試加別的X或是weightedLS?Example
28Q-Qplot如果殘差服從常態(tài)分配,那麼除了它的長條圖像常態(tài)之外,它的排名的值和實際母體同排名的值像不像呢?Thequantileoftheresidualversusthenormalquantile:29OrderedStudentdizedResiduals,Q(quantiles)Rank/total(cumulativeprob.)c.p.FindzwhereP(Z
z)=c.p.Usemodifiedc.p.*=(rank-0.375)/(n+0.25)getz*s.t.P(Z
z*)=c.p.*
Qc.p.zc.p.*
z*-1.881/6=17%-0.9710%-1.28-1.332/6=33%-0.4326%-0.64-0.9
3/6=50%042%-0.20.34/6=67%0.4358%0.20.75/6=83%0.9774%0.641.76/6=100%inf90%1.28將殘差標準化,再排序,第2/6(=0.33)分位的quantile是-1.33即P(ei
-1.33)=2/6算出排序的名次對常態(tài)來說,第2/6(=0.33)分位的quantile是-0.43;即P(Z
-0.43)=2/6=33%對常態(tài)來說第0.26分位的quantile是-0.64;即P(Z
-0.64)=26%PlotthesetwocolumnsQ-QplotIfclosetoaX=Ystraightline,thenresidualsclosetonormality!R程式:qqnorm(model1$”residuals”)30殘差中排名4/6的殘差值和N(0,1)中累積機率為4/6的值Q-Qplot
31YisrightskewedYisleftskewedDiagnosticsinR
32Diagnostics33Practice在Surgicaldata中,模式為liver~clot請問此模式符合迴歸的假設(shè)嗎?34MultiplelinearregressionExtensionofSLR,includingmorethanonepredictorsinthemodel35Linear?Linear?Difference?MultiplelinearregressionModel::regressioncoefficients:observeddataareindependent
Inmatrixform36Multiplelinearregression哪些term可以放到X中呢?Predictors:如例子中的weight,age,sexTransformationsofpredictorsPolynomials:andDummyvariablesandfactorsIn
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 預(yù)支工資財務(wù)制度
- 種植藥材公司財務(wù)制度
- 中央空調(diào)公司財務(wù)制度
- 網(wǎng)絡(luò)安全與財務(wù)制度
- 學(xué)院研究中心財務(wù)制度
- 關(guān)于公交企業(yè)的詳細的保安服務(wù)管理制度
- 公司實驗室臺賬制度
- 養(yǎng)老院老人健康監(jiān)測人員表彰制度
- 清理池底施工方案(3篇)
- 施工項目合同糾紛處理制度
- Y -S-T 732-2023 一般工業(yè)用鋁及鋁合金擠壓型材截面圖冊 (正式版)
- 部編版四年級下冊必讀《十萬個為什么》閱讀測試題(分章節(jié))
- GB/T 43829-2024農(nóng)村糞污集中處理設(shè)施建設(shè)與管理規(guī)范
- HBM高帶寬存儲器專題研究分析報告
- 萬科物業(yè)服務(wù)指南房屋和設(shè)施維修管理
- 高一英語完型填空10篇實戰(zhàn)訓(xùn)練及答案
- 施工吊籃工程監(jiān)理實施細則
- 10kV架空線路現(xiàn)場驗收表
- 抗體偶聯(lián)藥物(ADC)專題分析報告
- 浙江省生態(tài)環(huán)境專業(yè)工程師職務(wù)任職資格量化評價表
- 成都市計劃生育條例
評論
0/150
提交評論