欢迎来到天天文库
浏览记录
ID:47044865
大小:115.50 KB
页数:8页
时间:2019-07-07
《时间序列上机作业一》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、上机作业一程序:习题3.8(a)library(TSA)data(retail)plot(retail,type='l',ylab='sales')points(y=retail,x=time(retail),pch=as.vector(season(retail)))(b)library(TSA)data(retail)retailmonth=season(retail)monthreg=lm(retail~month+time(retail))summary(reg)(c)plot(y=rstudent(reg),x=as.vector(time(retail)),type='l',y
2、lab='Standardizedresiduals',xlab='Time')points(y=rstudent(reg),x=as.vector(time(retail)),pch=as.vector(season(retail)))结果输出:(a)(b)reg=lm(retail~month+time(retail))>summary(reg)Call:lm(formula=retail~month+time(retail))Residuals:Min1QMedian3QMax-19.8950-2.4440-0.35182.197116.2045Coefficients:Estima
3、teStd.ErrortvaluePr(>
4、t
5、)(Intercept)-7.249e+038.724e+01-83.099<2e-16***monthFebruary-3.015e+001.290e+00-2.3370.02024*monthMarch7.469e-021.290e+000.0580.95387monthApril3.447e+001.305e+002.6410.00880**monthMay3.108e+001.305e+002.3810.01803*monthJune3.074e+001.305e+002.3550.01932*monthJuly6.053e+001.
6、305e+004.6385.76e-06***monthAugust3.138e+001.305e+002.4040.01695*monthSeptember3.428e+001.305e+002.6260.00919**monthOctober8.555e+001.305e+006.5553.34e-10***monthNovember2.082e+011.305e+0015.948<2e-16***monthDecember5.254e+011.305e+0040.255<2e-16***time(retail)3.670e+004.369e-0283.995<2e-16***---S
7、ignif.codes:0‘***’0.001‘**’0.01‘*’0.05‘.’0.1‘’1Residualstandarderror:4.278on242degreesoffreedomMultipleR-squared:0.9767,AdjustedR-squared:0.9755F-statistic:845on12and242DF,p-value:<2.2e-16(c)习题3.14程序:(a)library(TSA)data(retail)retailmonth=season(retail)monthreg=lm(retail~month+time(retail))summary
8、(reg)(b)runs(rstudent(reg))(c)acf(rstudent(reg))(d)qqnorm(rstudent(reg))qqline(rstudent(reg))hist(rstudent(reg),xlab='StandardizedResiduals')shapiro.test(rstudent(reg))结果输出:(a)>library(TSA)>data(retail)>retailJanFebMarAprMayJunJulAugSepOctNovDec198642.439.242.243.943.745.547.146.447.749.457.175.31
9、98745.944.045.049.347.048.952.251.151.554.662.783.5198853.449.050.853.453.854.358.557.356.960.869.293.7198957.853.956.657.559.557.560.160.060.363.571.699.5199061.458.560.062.663.661.465.463.363.165.772.9103.41991
此文档下载收益归作者所有