ImageVerifierCode 换一换
格式:DOCX , 页数:21 ,大小:332.55KB ,
资源ID:2160225      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bingdoc.com/d-2160225.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(R语言代码试题答案步骤.docx)为本站会员(b****1)主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(发送邮件至service@bingdoc.com或直接QQ联系客服),我们立即给予删除!

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

1、R语言代码试题答案步骤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()

2、来看一些示范程序,用help()来阅读在线帮助文件,或用()通过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

3、200243 河北 4211 1542 1502 1047 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 21

4、11 1790 1017 3724 78673 85373 2625310 江苏 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 1

5、656 41904 51768 1577816 河南 4607 1886 1191 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

6、1445722 重庆 6870 2229 1177 1102 1471 44498 38914 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 163

7、1 1288 1050 1388 37679 21978 1284729 青海 4667 1512 1232 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)Coeff

8、icients:(Intercept) x1 x2 x3 x4 x5 x6 x7 x8 x9 summary(lm)Call:lm(formula = y x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9, data = h)Residuals: Min 1Q Median 3Q Max Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) +02 +03 x1 +00 *x2 +00 *x3 +00 *x4 x5 +00 *x6 x7 x8 +01 +01 x9 +01 +02 -Sig

9、nif. codes: 0 * * * . 1Residual standard error: on 21 degrees of freedomMultiple R-squared: , Adjusted R-squared: F-statistic: on 9 and 21 DF, p-value: pre=(lm) res=residuals(lm) sd(res)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

10、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 - x1 1 Step: 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 3238

11、763 - x6 1 91813 3276139 3184326 - x3 1 2936130 6120456 - x2 1 5467941 8652267 - x5 1 9393345 - x1 1 Step: 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 82150 3283904 3201754 - x3 1 3055353 6257107 - x2 1 5725836 8927590 - x5 1 9382624 -

12、x1 1 Step: 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 1 Step: AIC=y x1 + x2 + x3 + x5 + x6 Df Sum of Sq RSS AIC- x6 1 137540 3444741 3307201 - x3 1 5771063 9078264 - x2 1 8871193 -

13、 x5 1 9473521 - x1 1 Step: 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 Max Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) * x1 *x2 *x3 *x5 *-Sign

14、if. codes: 0 * * * . 1Residual 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

15、) hTime Series:Start = 1 End = 56 Frequency = 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,

16、 9140, -5641, -5842, 143, 1444, -445, 7746, -12747, 9748, 1049, -2850, -1751, 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 drift Call:lm(formula = + 1 + Min 1Q Medi

17、an 3Q Max Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) * -Signif. codes: 0 * * * . 1Residual standard 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 =

18、 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)Coefficients: ar1 ma1 ma2 ma3 ma4 xmean . sigma2 estimated as 1850: log likelihood = , aic = $degrees_of_freedom1 50$ttable Estimate SE ar1 ma1 ma2 ma3 ma4

19、 xmean $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, REPORT = 1, reltol = tol)Coefficients: ma1 constant . sigma2 estimated as 3412: log likelihood = , aic =

20、$degrees_of_freedom1 53$ttable Estimate SE ma1 constant $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 = trc, REPORT = 1, reltol = tol)Coefficients: ar1 ma1 const

21、ant . sigma2 estimated as 2548: log likelihood = , aic = $degrees_of_freedom1 52$ttable Estimate SE ar1 ma1 constant $AIC1 $AICc1 $BIC1 res=residuals(ar$fit) (res) Box-Pierce testdata: resX-squared = , df = 1, p-value = plot(res*res) res resTime Series:Start = 1 End = 56 Frequency = 1 1 +01 +01 +01

22、+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 = 57 End = 66 Frequency = 1 1

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2