R语言代码试题答案步骤.pdf

上传人:l*** 文档编号:72085278 上传时间:2023-02-08 格式:PDF 页数:30 大小:633.89KB
返回 下载 相关 举报
R语言代码试题答案步骤.pdf_第1页
第1页 / 共30页
R语言代码试题答案步骤.pdf_第2页
第2页 / 共30页
点击查看更多>>
资源描述

《R语言代码试题答案步骤.pdf》由会员分享,可在线阅读,更多相关《R语言代码试题答案步骤.pdf(30页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。

1、R version (2017-11-30)-Kite-Eating TreeCopyright(C)2017 The R Foundation for Statistical ComputingPlatform:x86_64-w64-mingw32/x64(64-bit)R 是自由软件,不带任何担保。在某些条件下你可以将其自由散布。用license()或licence()来看散布的详细条件。R 是个合作计划,有许多人为之做出了贡献.用contributors()来看合作者的详细情况用citation()会告诉你如何在出版物中正确地引用R 或 R 程序包。用demo()来看一些示范程序,用he

2、lp()来阅读在线帮助文件,或用()通过 HTML 浏览器来看帮助文件。用q()退出 R.原来保存的工作空间已还原 h=(,header=true)Error in(file=file,header=header,sep=sep,quote=quote,:找不到对象true h=(,header=TRUE)h地区 x1 x2 x3 x4 x5 x6 x7 x8 x9 y1北京 7535 2639 1971 1658 3696 84742 87475 240462天津 7344 1881 1854 1556 2254 61514 93173 200243河北 4211 1542 1502 104

3、7 1204 38658 36584 125314山西 3856 1529 1439 906 1506 44236 33628 122125内蒙古 5463 2730 1584 1354 1972 46557 63886 177176辽宁 5809 2042 1433 1310 1844 41858 56649 165947吉林 4635 2045 1594 1448 1643 38407 43415 146148黑龙江 4687 1807 1337 1181 1217 36406 35711 129849上海 9656 2111 1790 1017 3724 78673 85373 2625

4、310江苏 6658 1916 1437 1058 3078 50639 68347 1882511浙江 7552 2110 1552 1228 2997 50197 63374 2154512安徽 5815 1541 1397 1143 1933 44601 28792 1501213福建 7317 1634 1754 773 2105 44525 52763 1859314江西 5072 1477 1174 671 1487 38512 28800 1277615山东 5201 2197 1572 1005 1656 41904 51768 1577816河南 4607 1886 1191

5、 1085 1525 37338 31499 1373317湖北 5838 1783 1371 1030 1652 39846 38572 1449618湖南 5442 1625 1302 918 1738 38971 33480 1460919广东 8258 1521 2100 1048 2954 50278 54095 2239620广西 5553 1146 1377 884 1626 36386 27952 1424421海南 6556 865 1521 993 1320 39485 32377 1445722重庆 6870 2229 1177 1102 1471 44498 38914

6、 1657323四川 6074 1651 1284 773 1587 42339 29608 1505024贵州 4993 1399 1014 655 1396 41156 19710 1258625云南 5468 1760 974 939 1434 37629 22195 1388426西藏 5518 1362 845 467 550 51705 22936 1118427陕西 5551 1789 1322 1212 2079 43073 38564 1533328甘肃 4602 1631 1288 1050 1388 37679 21978 1284729青海 4667 1512 1232

7、 906 1097 46483 33181 1234630宁夏 4769 1876 1193 1063 1516 47436 36394 1406731新疆 5239 2031 1167 1028 1281 44576 33796 13892 lm=lm(yx1+x2+x3+x4+x5+x6+x7+x8+x9,data=h)lmCall:lm(formula=y x1+x2+x3+x4+x5+x6+x7+x8+x9,data=h)Coefficients:(Intercept)x1 x2 x3 x4 x5x6 x7 x8 x9 summary(lm)Call:lm(formula=y x1+x

8、2+x3+x4+x5+x6+x7+x8+x9,data=h)Residuals:Min 1Q Median 3Q MaxCoefficients:Estimate Std.Error t value Pr(|t|)(Intercept)+02 +03x1 +00 *x2 +00 *x3 +00 *x4x5 +00 *x6x7x8 +01 +01x9 +01 +02-Signif.codes:0*.Residual standard error:on 21 degrees of freedomMultiple R-squared:,Adjusted R-squared:F-statistic:o

9、n 9 and 21 DF,p-value:pre=(lm)res=residuals(lm)sd(res)1 1 res=residuals(lm)dy=step(lm)Start:AIC=y x1+x2+x3+x4+x5+x6+x7+x8+x9 Df Sum of Sq RSS AIC-x4 1 21 3184326-x9 1 17149 3201454-x7 1 17700 3202005-x8 1 54295 3238599-x6 1 89586 3273891 3184305-x3 1 2662593 5846898-x2 1 4561056 7745361-x5 1 9377500

10、-x1 1Step:AIC=y x1+x2+x3+x5+x6+x7+x8+x9 Df Sum of Sq RSS AIC-x9 1 17428 3201754-x7 1 18563 3202889-x8 1 54437 3238763-x6 1 91813 3276139 3184326-x3 1 2936130 6120456-x2 1 5467941 8652267-x5 1 9393345-x1 1Step:AIC=y x1+x2+x3+x5+x6+x7+x8 Df Sum of Sq RSS AIC-x7 1 34634 3236387-x6 1 74800 3276554-x8 1

11、82150 3283904 3201754-x3 1 3055353 6257107-x2 1 5725836 8927590-x5 1 9382624-x1 1Step:AIC=y x1+x2+x3+x5+x6+x8 Df Sum of Sq RSS AIC-x8 1 70813 3307201-x6 1 152777 3389165 3236387-x3 1 5501284 8737672-x2 1 8895049-x5 1 9458098-x1 1Step:AIC=y x1+x2+x3+x5+x6 Df Sum of Sq RSS AIC-x6 1 137540 3444741 3307

12、201-x3 1 5771063 9078264-x2 1 8871193-x5 1 9473521-x1 1Step:AIC=y x1+x2+x3+x5 Df Sum of Sq RSS AIC 3444741-x3 1 5717883 9162624-x2 1-x5 1-x1 1 summary(dy)Call:lm(formula=y x1+x2+x3+x5,data=h)Residuals:Min 1Q Median 3Q MaxCoefficients:Estimate Std.Error t value Pr(|t|)(Intercept)*x1 *x2 *x3 *x5 *-Sig

13、nif.codes:0*.Residual standard error:364 on 26 degrees of freedomMultiple R-squared:,Adjusted R-squared:F-statistic:on 4 and 26 DF,p-value:newdata=(x1=5200,x2=2000,x3=1100,x4=1000,x5=1300,x6=45000,x7=34000,x8=,x9=predict(dy,newdata,interval=confidence)fit lwr upr1 h=ts(,header=TRUE)hTime Series:Star

14、t=1End=56Frequency=1 X78 1,-58 2,53 3,-63 4,13 5,-6 6,-16 7,-14 8,3 9,-7410,8911,-4812,-1413,3214,5615,-8616,-6617,5018,2619,5920,-4721,-8322,223,-124,12425,-10626,11327,-7628,-4729,-3230,3931,-3032,633,-7334,1835,236,-2437,2338,-3839,9140,-5641,-5842,143,1444,-445,7746,-12747,9748,1049,-2850,-1751,

15、2352,-253,4854,-13155,6556,-17 plot(h,type=o)local(pkg adf=(h),type=c(drift),selectlags=c(AIC)summary(adf)#Augmented Dickey-Fuller Test Unit Root Test#Test regression driftCall:lm(formula=+1+Min 1Q Median 3Q MaxCoefficients:Estimate Std.Error t value Pr(|t|)(Intercept)*-Signif.codes:0*.1Residual sta

16、ndard error:on 51 degrees of freedomMultiple R-squared:,Adjusted R-squared:F-statistic:on 2 and 51 DF,p-value:acf(h)pacf(h)ar=sarima(h,1,0,4,details=F)ar$fitCall:stats:arima(x=xdata,order=c(p,d,q),seasonal=list(order=c(P,D,Q),period=S),xreg=xmean,=FALSE,=list(trace=trc,REPORT=1,reltol=tol)Coefficien

17、ts:ar1 ma1 ma2 ma3 ma4 xmean.sigma2 estimated as 1850:log likelihood=,aic=$degrees_of_freedom1 50$ttable Estimate SEar1ma1ma2ma3ma4xmean$AIC1$AICc1$BIC1 ma=sarima(h,0,1,1,details=F)ma$fitCall:stats:arima(x=xdata,order=c(p,d,q),seasonal=list(order=c(P,D,Q),period=S),xreg=constant,=list(trace=trc,REPO

18、RT=1,reltol=tol)Coefficients:ma1 constant.sigma2 estimated as 3412:log likelihood=,aic=$degrees_of_freedom1 53$ttable Estimate SEma1constant$AIC1$AICc1$BIC1 arma=sarima(h,1,1,1,details=F)arma$fitCall:stats:arima(x=xdata,order=c(p,d,q),seasonal=list(order=c(P,D,Q),period=S),xreg=constant,=list(trace=

19、trc,REPORT=1,reltol=tol)Coefficients:ar1 ma1 constant.sigma2 estimated as 2548:log likelihood=,aic=$degrees_of_freedom1 52$ttable Estimate SEar1ma1constant$AIC1$AICc1$BIC1 res=residuals(ar$fit)(res)Box-Pierce testdata:resX-squared=,df=1,p-value=plot(res*res)res resTime Series:Start=1End=56Frequency=

20、1 1 +01+01 +01 +00+00+00 +01+01 +02+01+00 +01 +01+01+0117 +01 +01 +01+01+01 +00 +00 +02+02 +02+01+01+01 +01+01+0133+01 +01 +00+01 +01+01 +01+01+01 +00 +01 +01+02 +02+0149+01+01 +01 +01+02 +01+01 (res)#Box-Pierce testdata:resX-squared=,df=1,p-value=yc=(h,10,1,1,1)yc$predTime Series:Start=57End=66Frequency=1 1

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 应用文书 > 工作报告

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知得利文库网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

© 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

黑龙江省互联网违法和不良信息举报
举报电话:0468-3380021 邮箱:hgswwxb@163.com