R軟件中的主成分分析_第1頁
R軟件中的主成分分析_第2頁
R軟件中的主成分分析_第3頁
R軟件中的主成分分析_第4頁
R軟件中的主成分分析_第5頁
已閱讀5頁,還剩6頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、表1為某地區(qū)農(nóng)業(yè)生態(tài)經(jīng)濟(jì)系統(tǒng)各區(qū)域單元相關(guān)指標(biāo)數(shù)據(jù),運(yùn)用主成分分析方法,用更少的指標(biāo)信息較為精確地描述該地區(qū)農(nóng)業(yè)生態(tài)經(jīng)濟(jì)的發(fā)展?fàn)顩r表1某農(nóng)業(yè)生態(tài)經(jīng)濟(jì)系統(tǒng)各區(qū)域單元的有關(guān)數(shù)據(jù)X1:人口密度 X2:人均耕(人/km2)地面積(ha)YQ:經(jīng)濟(jì)作X3-;X4藍(lán)年嘉金潟引渭襄髓:X;S盛:黑年()/人)人)精忱率()比()之比()(%)11111問題樣本序號123456789101112131415161718192021解答:依次類推,當(dāng)前m個主成分的累積貢獻(xiàn)率達(dá)到80%及以上,我們就說腦的大小與前m主成分有關(guān)。并求解轉(zhuǎn)化后的乙與xj之間的相關(guān)系數(shù)。2問題解答在F盤保存某地區(qū)農(nóng)業(yè)生態(tài)經(jīng)濟(jì)系統(tǒng)各區(qū)域單

2、元相關(guān)指標(biāo)數(shù)(見附錄)1模型選擇X1:人口密度(人/km2)x3:森林覆蓋率(%)X5:人均糧食產(chǎn)量(kg/人)X7:耕地占土地面積比率()X9:灌溉田占耕地面積之比()x2:人均耕地面積(ha)X4:農(nóng)民人均純收入(元/人)X6:經(jīng)濟(jì)作物占農(nóng)作物播面比例()X8:果園與林地面積之比()做主成分分析,命名第一主成分為Z1第二主成分為Z2,第三主成分為Z3,在R軟件中輸入代碼:Iinydataread,tablettrF!tKtPf)mydatz-a-prsunmiuy(mydava(prxload!ngs=TRUE)得到如下結(jié)果:5 5口E E=的收n n utilutil工CompComp.

3、 .1Camp.1Camp.Z ZCaup,3Caup,3匚口BYiji-TBYiji-T匚口 x.三匚nsp.MCopiji,7nsp.MCopiji,7匚口w wP P.13Caifip-S.13Caifip-SScfijuluddlffvlaLLDnScfijuluddlffvlaLLDn.159921.4451C7.159921.4451C7 fi.71239539D.fi.71239539D.1400114001.41.41抬I I口口上3 3曲口.i i,?,?4b4b 自中工PftlflEbLDBiaPftlflEbLDBia Vtaium0Vtaium0 fil7SNEIfil

4、7SNEI0.0. 毅1 1如1 10i0i ll5BMall5BMa% %056Mg7gBSlLD.aS14Kh53i056Mg7gBSlLD.aS14Kh53i0 0由L*TL*Tg g強(qiáng)0.0030.003 1919。藺3 3,/ /口熊CwivUtivcCwivUtivc打口口加口口國O O+ +5nSIO3O5nSIO3Ofefe75OC75OC 70Q70Q用4 45 5 561O.561O. 23Dm23Dm。.新73557355:0.#13750.#1375 77Q451M77Q451M訓(xùn)也口.外后】川口口口1 1 叩口L LiHiJ.iHiJ.ln.grln.gr: :鵬1n

5、BfinBfi: :-ii,-ii,1 1Carr*Carr* *CrCrw w.5.5Cmq(Coup.Cmq(Coup.氣Comp9Comp9VIVIQ|Q|H2-gH2-g*55&*55&-g.573-Pi-l53-g.573-Pi-l53-43-43vzvz.GL4.GL4口-1-1占主-0-.11D-0-.11DVIVIMMa 例-O.IDJ-O.IDJO.S52O.S52VV4ie-O-ZZfl-O-ZZfl-0_l-0_l -O.14G-O.14G.E3Z.E3Z. .EL3EL3第一主成分的貢獻(xiàn)率為,第二主成分的貢獻(xiàn)率為,第三主成分的貢獻(xiàn)率為。前三個主成分白累積

6、貢獻(xiàn)率為,另六個主成分可舍去。Z1=從第一主成分中,可看出農(nóng)業(yè)生態(tài)經(jīng)濟(jì)與人均耕地面積,農(nóng)民人均純收入,人均糧食產(chǎn)量,灌溉田占耕地面積之比,成反比,即人均耕地面積,農(nóng)民人均純收入,人均糧食產(chǎn)量,灌溉田占耕地面積之比越大,生態(tài)農(nóng)業(yè)經(jīng)濟(jì)越差。做碎石圖:mydatarCompCompI IComp.2ComaCompSCofnpOComp.TComp3Comp9Comp.2ComaCompSCofnpOComp.TComp3Comp9建立模型:目標(biāo)變量:農(nóng)民人均純收入(元/人)一y決策變量:xi:人口密度(人/km2)x3:森林覆蓋率(%)x6:經(jīng)濟(jì)作物占農(nóng)作物播面比例()X8:果園與林地面積之比()

7、進(jìn)行多元線性回歸分析:y=B)+Bix+B2x2+B3x3+B5x5+B6x6+B7x7+B8x8+B9x9x2:人均耕地面積(ha)x5:人均糧食產(chǎn)量(kg/人)x7:耕地占土地面積比率()x9:灌溉田占耕地面積之比()在R軟件中輸入:attach(mydara)mydaca,lm=lit(V4V1+VZ+V34V54V6+V7+V6+V9:stut四號匚ya 1 醐得到以下結(jié)果Call:liii(foLttiula=V4-UI+V2+V3+V5+V6+V7-bUS-bV9)iResidualstMlnIQMedian3QMaw-560-00-143-25-36.29162.19SB*7.2

8、4CoeffL?ients:EstiimateStd_EcroirtvaluePt(!111彳Intercept)-1340*3791259.7S1-1,0640.306VI-2*8162603-1.0820.300V227B-234231.3E61.3030.253V35.30915.4S51.S350.127V51.7191.5191,1320.280V6-6.30313.79S13.79S-0.457-0.4570 0 55$55$V727,98953,0610.665V8-18-96456,572-0,5350.7T3VS52.52339,7610.211Residualstandar

9、derrct:319.3on12degreescfreedomMultipleR-squsised;,6283rAdjustedR-squsued;,3805Fstatistic;2.535on6and12DF,p-value;0,07109丫=此結(jié)果不合理,對其做主成分回歸檢驗:Importanceofcompontrits:Laadinjs:Ccirip.1Coirip.2Comp.3Comp.4Snip.5Compx6Coimp7Comp,RVI0,3440.-1610.369-口.邙0,5B40,1210.E21V20.7SCH554-0.3230.11*1V3一口木70524-0.2

10、28671VS0.3740.368-0.166046470,514.1D3V6口.3790.2170.L4E0,122-.136V?0.433-0.108.2550.131-04223-0.707-0.223VS-0.1300.133-0.227.101790,4460.2420.154-0.229O.SOS-0.631由結(jié)果可得前三個主成分貢獻(xiàn)率達(dá)到,然后進(jìn)行主成分分析:prewdatazK-jire,1;ift7clac&Sz2-pre,2;ntyd&rz3Im.soK-lm(V6zl+z2dst.a=mydata)summaty(Im.sc1)Standarddeviat

11、iflnPrcpcrtionorvarianceCumulatIveProportionStandariddeviationProportionof:VarianceCumulativeProportionCctnp.12.15ECS52.5B247940.5824794Cctnp.60.3421531.013720a.96S39BO2Comp.21.270497u.iai15iz0.7S75307Comp.31,0203105.L3D1Z9Z0.8977599Ccutip.7L212Q347120.005667S490.955065370Comp.4Comp.S0.eOC981990.497

12、57460o.D4buiJjyu.ujuy40.943313260.9747C082Conip.8a.iees22?0.004934331X0000000在R中建立模型:iny sujiiniry(mydatasujiiniry(mydata Call:lmi(criiiuia=V4-VI+V2+V3+VS+75+V7+VS+V9)繼續(xù)建模:Coefficients:EsclitiareScd.ErrorrvaluePr(|t|)(Inv&rcepv)16.6311.037115,3109.15e-12*工13.4Z000.5066.7912.32&-06*Z21.96300.

13、893ZZ.1960.0413內(nèi)Residuals:Residuals:Hi_nLQMedianHi_nLQMedian-7.33-7.337483483L L.口口口Signit.codes:Signit.codes:0 0左舌卡O.ooiO.ooi擊擊.口.口1 1、士1r口,0505., ,o.o.1RESideals;UinIQMeilicin.3QMax-560.00143.25-36.29162.19587.2Coeficients:EstiraateStd.ErrortvaluePELIt|)(Intercept)-1340.S791259.751-1.0540.30BVI-2.

14、6162.fiCiS-1.0320.300V2273.234231,3561.2Ci3Q.Z5ZV325.30915.4S51.638a,127V51V51.7191.5191.1320.280VG-6.30313.73-0.457a,.6S6V727.98963,064口,444口,665VS-IB,96456.572-0.33S口.743V952.5939.7811.3220.211Residua1standarderror;Residua1standarderror;319.3319.3onon1212decreesdecreesoffoffceedcmceedcmCall:Lm(for

15、mulaV6V6zl+z2rdata30Max3.6933.113Residualstandarderror:4.982R-squared:0.Fst-at-istic:25.45on2and18on18degreescireedcunAdjListedR-squared:0.7099DF.p-value;5-55ie0mydaca.Inn(V4-V1+V2+V3+V5+V6+V7+V9)siunmary(mydaca.Irn)Call:Im(formula=V4-VI+V2+V3+V5+V6+V7+V9)Residuals:MinIQMedian3QMax-552.77-122-93-44.

16、06174.98611.38Coefficients:EstimateStd.ErrortvalueP門舊)(Inveucept)-1313.8931213.498-1.0830.299VI-2.6892.503-1.1540.269VZZ94.636Z16.2671.350O.ZOOV324.64514.7951.6660.120V51.7711.4581.2150.246V6-7.65912.733-0.6010.558V739.60950.8540.7790.450V944.38630.2641.4670.166Residualstandarderror:308.2on13degrees

17、offreedomMultipleR-squared:0.6248,AdjustedR-squarred:0.4228F-statistic:3.093on7and13DF.p-value:.0376wydata.1=Im(V4-VI4-V2+V3+V5+V7+V9)suwwary(wydata.lift)Call:Im(formula=V4-VI+V2+V3+V54-V7+V9)Residuals:IlinIQMedian3QMax-562.72-125.32-59.32152.355mCoefficients;EstimateStd.ErrorcvaluePr(|11)(Intercept

18、)-1583.2331101.840-1.4370.1727VI-2.9422-1.2040.2486V2274.517210.7151.3030.2137V327.99013.395Z.0900.0554.V51.553L.380L.1260.2792V744.33849.0840.9030.3816V945.20329.5371.5300.1482Signif.codes:0、*0.0010.01、才,0.050.1、1Residualstandarderror:301.1on14degreesoffreedomMultipleR-squared:0.6144,AdjustedR-squa

19、red:0.4491F-statistic:3.717on.6and14DF,p-value:0.02013mydata.Lm=Lm(V4-Vl+V2+U3+V5+V9)summary(wdata.Im)Call:Im(formula=V4-vi+V2+V3+V5+V9)Residuals:MinIQMedian3QMax-634.7-138.6-62.6160.6519.9Coefficients:EstimateStd.EuortvaluePr(|r|)(Intercept)-1062.030932.908-1.1380.2728VI-1.8452.108-0.8750.3952V2307

20、.817206.1881.493O.1562V320.60810.5461.9540.0696.V51.7171.3591.2630.2257V943.55629.2991.4870.1578Signif.codes:0十十0.0010.01、畬0.05、.0.1、z1Residualstandarderror:299.2on15degreesoffreedomMultipleR-squared:0.5919#AdjustedR-squared!0.45S8F-statistic:4.3S1on5and15DFZp-value!0.01201mydata.lro=Im(V4-V2+V3+V5+

21、V9)summary(roydata.Im)Call:lw(forwula=V4-V2+V3+VS+V9)Coefficients;Residualstandarderror:297on.16degreesoffreedomMultipleP-squared!0.571,JLdjlistedR-squared!0.4638F-statistic!5.325on4and16DF,p-value:0.006384EsriroaceStd.ErrortvaluePr(|t|)(Intercept)-1396.280844.920-1.6530.1179V2377.319188.8881.9980.0631.V322.07910.3372.136.0485余V52.1731.2461.734.1004V929.76824.5221.2140.

溫馨提示

  • 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)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論