欢迎来到天天文库
浏览记录
ID:44343210
大小:320.07 KB
页数:9页
时间:2019-10-21
《回归分析案例》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、回归分析案例现收集到若干年粮食产量以及受灾面积、农作物总播种面积、乡村从业人员、农用化肥施用折纯量等数据,利用多元线性回归分析,分析影响粮食产量的主要因素。一、相关分析(相关矩阵)setwd(HD:/Rdatan)data<-read.csv(file=file.choose(),head=T)colnames(data)<-c(,,Y^nXl,X2,X3n,nX4n)dataX<-cor(data)Xpairs(data)结果显示YXIX2X3X4Y1・0000000-0.1578042280,83206530.9351404660.93610270XI-O
2、・l5780421.000000000-O・1132702一0.009719孑26-0.07870641X20.8320653-0.1132703291.00000000.8331847930.88927486X30.9351405-0.0097192260.83318481.0000000000.98533592X40.9361027-0.0787064110.88927490.9853359181.00000000Ocf5^oooo°lX330000450006000014500015500000090000^000镖0000^§000090009b0000C00
3、009L0009MX4000寸000L100030005000分析XI与Y的相关系数较小,X2、X3、X4与Y的相关系数较人。X3、X4可能存在较强的相关性。二、多重共线性诊断kappa(X„exact=T)结果显示[1]580.8733K值V100说明共线性很小,K值在100到1000Z间说明中等强度,K>1000存在严重共线性。此处K=580.8733,说明存在多重共线性。三、线性回归attach(data)lm.sol4、als:Min1QMedian3QMax•4620.4-1117.090.81154.84885.4coefficients:Estimatestd.ErrortvaluePr(>5、t6、)(intercept)-2・762e+043.539e+04-0.7810.4412XI-1.375e-015.843e-O2-2.3530.0254龙X22.391e-011.956e-011.2220.2311X31.068e+004.449e-012.4010.0228X4-1.348e+002.5O2e+OO-0.5390.5939Signif.codes:00.001o.O7、l*0.05J0.1g'1Residualstandarderror:2378on30degreesoffreedomMultipleR-squared:0.9023,AdjustedR-squared:0.8892F-statistic:69.24on4and30DF,p-value:1.03e-14分析F统计量的P-value<0.05,故线性回归显著。XI、X3的系数显著,其他系数均不显著,“为0.9023o这很可能出现多重共线性。综合kappa检验,确定是多重共线性引起的。可用逐步回归法修止该模型。lm.step<-step(lm.sol)summary(l8、m.step)结果显示Start:AIC=548.79Y~XI+X2+X3+X4DfSumofSqRSSAIC-X411642688171333130547.13-X21845162217814206454&50onGA16969044254&79_XI131310457201000899552.72-X3132603830202294272552.95step:AIC=547.13Y~XI+X2+X3DfSumofSqRSSAIC-X218186300179519430546.77171333130547.13-XI13068868120202181259、50.90-X31355754563527087693584.46step:AIC=546.77Y~XI+X3DfSumofSqRSSAIC179519430546.77-XI138403295217922725551.55一X3115135095421693028972623.31call:lm(formula=丫~xl+X3)Residuals:MinIQMedian3QMax-5079-1011-12411034872coefficients:EstimateStd.ErrortvaluePr(>10、t1)(intercept)953
4、als:Min1QMedian3QMax•4620.4-1117.090.81154.84885.4coefficients:Estimatestd.ErrortvaluePr(>
5、t
6、)(intercept)-2・762e+043.539e+04-0.7810.4412XI-1.375e-015.843e-O2-2.3530.0254龙X22.391e-011.956e-011.2220.2311X31.068e+004.449e-012.4010.0228X4-1.348e+002.5O2e+OO-0.5390.5939Signif.codes:00.001o.O
7、l*0.05J0.1g'1Residualstandarderror:2378on30degreesoffreedomMultipleR-squared:0.9023,AdjustedR-squared:0.8892F-statistic:69.24on4and30DF,p-value:1.03e-14分析F统计量的P-value<0.05,故线性回归显著。XI、X3的系数显著,其他系数均不显著,“为0.9023o这很可能出现多重共线性。综合kappa检验,确定是多重共线性引起的。可用逐步回归法修止该模型。lm.step<-step(lm.sol)summary(l
8、m.step)结果显示Start:AIC=548.79Y~XI+X2+X3+X4DfSumofSqRSSAIC-X411642688171333130547.13-X21845162217814206454&50onGA16969044254&79_XI131310457201000899552.72-X3132603830202294272552.95step:AIC=547.13Y~XI+X2+X3DfSumofSqRSSAIC-X218186300179519430546.77171333130547.13-XI1306886812020218125
9、50.90-X31355754563527087693584.46step:AIC=546.77Y~XI+X3DfSumofSqRSSAIC179519430546.77-XI138403295217922725551.55一X3115135095421693028972623.31call:lm(formula=丫~xl+X3)Residuals:MinIQMedian3QMax-5079-1011-12411034872coefficients:EstimateStd.ErrortvaluePr(>
10、t1)(intercept)953
此文档下载收益归作者所有