d <- read.csv("file.csv")
avgHumidity <-numeric(0)#月平均风级
length(avgHumidity)<- 60
for(i in 2012:2016){
for(j in 1:12){
print((i-2012)*12+j)
avgHumidity[(i-2012)*12+j]<-mean(c(d$最大风级[grep(paste(i,"/",j,"/",sep=""),d$日期)],
d$最小风级[grep(paste(i,"/",j,"/",sep=""),d$日期)]),na.rm=TRUE)
}
}
avgHumidityTS<- ts(avgHumidity,frequency=12,start=c(2012,1))
plot.ts(avgHumidityTS,main="长春2012-2016年月平均风级图",xlab="时间",ylab="月平均风级")
lowestTS <-ts(d$最小风级[1:(360*4)],frequency=360,start=c(2012,1))
highestTS <-ts(d$最大风级[1:(360*4)],frequency=360,start=c(2012,1))
plot.ts(highestTS,col="red",main="长春2012-2016年最高最低风级时序图",xlab="时间轴",ylab="风级")
lines(lowestTS,col="blue")
legend("topright",c("最大风级","最小风级"),col=c("red","blue"),lty=1)
highestTS<-ts(d$最大风级,frequency=360,start=c(2012,1))
lowestTS<-ts(d$最小风级,frequency=360,start=c(2012,1))
highestForecasts<-HoltWinters(highestTS)
lowestForecasts<-HoltWinters(lowestTS)
lowestForecasts
highestForecasts
library("forecast")
highestForecast2<- forecast.HoltWinters(highestForecasts,h=360)
lowestForecast2<- forecast.HoltWinters(lowestForecasts,h=360)
highestForecast3<-ts(highestForecast2$mean,frequency=360,start=c(2017,1))
lowestForecast3<-ts(lowestForecast2$mean,frequency=360,start=c(2017,1))
plot(highestForecast3,col="red",ylim=c(0,15),main="长春2017年最大最小风级预测时序图",xlab="时间",ylab="风级")
lines(lowestForecast3,col="blue")
legend("topright",c("最大风级","最小风级"),col=c("red","blue"),lty=1)
附件已添加改一下名就行
为什么会出现下面这问题
highestForecast2$residuals
Time Series:
Start = c(2012, 1)
End = c(2017, 27)
Frequency = 360
[1] NA NA NA NA NA
[6] NA NA NA NA NA
[11] NA NA NA NA NA
[16] NA NA NA NA NA
[21] NA NA NA NA NA
[26] NA NA NA NA NA
[31] NA NA NA NA NA
[36] NA NA NA NA NA
[41] NA NA NA NA NA
[46] NA NA NA NA NA
[51] NA NA NA NA NA
[56] NA NA NA NA NA
[61] NA NA NA NA NA
[66] NA NA NA NA NA
[71] NA NA NA NA NA
[76] NA NA NA NA NA
[81] NA NA NA NA NA
[86] NA NA NA NA NA
[91] NA NA NA NA NA
[96] NA NA NA NA NA
[101] NA NA NA NA NA
[106] NA NA NA NA NA
[111] NA NA NA NA NA
[116] NA NA NA NA NA
[121] NA NA NA NA NA
[126] NA NA NA NA NA
[131] NA NA NA NA NA
[136] NA NA NA NA NA
[141] NA NA NA NA NA
[146] NA NA NA NA NA
[151] NA NA NA NA NA
[156] NA NA NA NA NA
[161] NA NA NA NA NA
[166] NA NA NA NA NA
[171] NA NA NA NA NA
[176] NA NA NA NA NA
[181] NA NA NA NA NA
[186] NA NA NA NA NA
[191] NA NA NA NA NA
[196] NA NA NA NA NA
[201] NA NA NA NA NA
[206] NA NA NA NA NA
[211] NA NA NA NA NA
[216] NA NA NA NA NA
[221] NA NA NA NA NA
[226] NA NA NA NA NA
[231] NA NA NA NA NA
[236] NA NA NA NA NA
[241] NA NA NA NA NA
[246] NA NA NA NA NA
[251] NA NA NA NA NA
[256] NA NA NA NA NA
[261] NA NA NA NA NA
[266] NA NA NA NA NA
[271] NA NA NA NA NA
[276] NA NA NA NA NA
[281] NA NA NA NA NA
[286] NA NA NA NA NA
[291] NA NA NA NA NA
[296] NA NA NA NA NA
[301] NA NA NA NA NA
[306] NA NA NA NA NA
[311] NA NA NA NA NA
[316] NA NA NA NA NA
[321] NA NA NA NA NA
[326] NA NA NA NA NA
[331] NA NA NA NA NA
[336] NA NA NA NA NA
[341] NA NA NA NA NA
[346] NA NA NA NA NA
[351] NA NA NA NA NA
[356] NA NA NA NA NA
[361] 1.004040e-01 8.515679e-02 7.029268e-02 5.715599e-02 5.110153e-02
[366] 4.991736e-02 5.581525e-02 6.241661e-02 6.269524e-02 5.877482e-02
[371] 5.253223e-02 4.562624e-02 3.952282e-02 3.829537e-02 3.443280e-02
[376] 2.407467e-02 1.769808e-02 1.761810e-02 2.032520e-02 1.993991e-02
[381] 1.821051e-02 2.084876e-02 2.179151e-02 1.568026e-02 8.890338e-03
[386] 7.056170e-03 2.657382e-03 -9.563535e-03 -1.897531e-02 -2.312664e-02
[391] -2.957330e-02 -3.110409e-02 -2.690143e-02 -2.457607e-02 -2.252095e-02
[396] -1.653800e-02 -4.305910e-03 3.726853e-03 6.659425e-03 7.862300e-03
[401] 6.147606e-03 1.018774e-02 1.931391e-02 2.460170e-02 2.927498e-02
[406] 3.201626e-02 3.166119e-02 3.551405e-02 3.891915e-02 3.776186e-02
[411] 3.673906e-02 4.277958e-02 4.811809e-02 5.283620e-02 5.283932e-02
[416] 4.173097e-02 3.330246e-02 2.446458e-02 1.804268e-02 2.208932e-02
[421] 1.733235e-02 2.017096e-03 -4.573855e-03 -4.843286e-03 -7.859183e-03
[426] -1.330237e-02 -1.255742e-02 -1.051015e-02 -1.425636e-02 -2.034499e-02
[431] -2.572603e-02 -2.770393e-02 -2.806309e-02 -2.838050e-02 -3.004992e-02
[436] -3.291421e-02 -3.405674e-02 -2.951094e-02 -2.271565e-02 -1.671007e-02
[441] -1.140243e-02 -5.322725e-03 5.042986e-05 6.324783e-04 -2.420048e-04
[446] -2.403749e-03 -2.925378e-03 3.558059e-03 7.899136e-03 4.791272e-03
[451] 4.822365e-03 6.238733e-03 5.460544e-04 -4.485052e-03 2.179642e-03
[456] 1.362536e-02 1.679647e-02 1.265460e-02 8.994082e-03 1.409230e-02
[461] 2.137581e-02 1.947954e-02 1.641475e-02 1.370614e-02 1.131230e-02
[466] 1.197445e-02 8.392970e-03 1.061049e-03 1.367594e-04 -6.801138e-04
[471] -5.568721e-03 -9.889200e-03 -1.092980e-02 -1.184946e-02 -1.682892e-02
[476] -1.845191e-02 -1.433073e-02 -1.207738e-02 -1.564146e-02 -2.018023e-02
[481] -2.419152e-02 -2.634776e-02 -2.547563e-02 -1.914930e-02 -1.078041e-02
[486] -4.772991e-03 5.362762e-04 1.061862e-03 -4.029188e-03 -1.130636e-02
[491] -1.634893e-02 -1.386104e-02 -1.166227e-02 -9.719036e-03 3.317008e-04
[496] 7.825506e-03 5.595319e-04 -5.862029e-03 -1.815089e-03 4.539316e-03
[501] 8.766357e-03 1.111326e-02 1.596520e-02 1.886439e-02 1.864887e-02
[506] 1.845839e-02 2.245672e-02 2.876816e-02 2.879057e-02 2.325481e-02
[511] 1.697351e-02 8.644400e-03 -2.883408e-03 -6.127071e-03 7.284491e-04
[516] 5.398368e-03 2.581130e-03 -1.297593e-03 -5.588842e-04 9.397542e-05
[521] -7.179257e-04 -1.435472e-03 -2.069629e-03 -2.630087e-03 1.041254e-03
[526] 2.897043e-03 -2.407282e-03 -8.484056e-03 -1.246573e-02 -1.459579e-02
[531] -1.231163e-02 -6.126266e-03 -2.048617e-03 1.662603e-04 2.123736e-03
[536] -3.129416e-04 -3.855331e-03 -5.597153e-03 -7.136551e-03 -9.885937e-03
[541] -2.223427e+00 3.694470e-02 -2.969539e+00 3.747643e-01 1.331799e+00
[546] 3.179001e+00 5.812920e+00 3.139351e+00 7.792666e-01 -3.023744e-01
[551] -1.263868e+00 -1.119178e+00 -9.899142e-01 2.122938e+00 -3.128746e+00
[556] -2.770107e+00 -4.489812e-01 1.603785e+00 1.416601e+00 -7.502190e-01
[561] 3.347776e-01 2.292293e+00 -9.749063e-01 -2.861020e+00 -1.532106e+00
[566] 6.423682e-01 -3.434474e+00 -5.038917e+00 -1.454122e+00 -1.280377e+00
[571] -3.129601e+00 2.229136e+00 9.623327e-01 8.427501e-01 7.342870e-01
[576] 3.637040e+00 5.209395e+00 6.045748e-01 1.533513e+00 -6.468933e-01
[581] -5.752936e-01 3.487985e+00 3.079051e+00 7.190306e-01 2.630501e+00
[586] -6.829471e-01 3.928426e-01 2.349165e+00 7.952353e-02 -9.291304e-01
[591] 1.794361e-01 4.157782e+00 -3.289920e-01 3.712607e+00 -3.712709e+00
[596] -4.279261e+00 -1.782749e+00 -4.580535e+00 -5.317714e-02 2.953591e+00
[601] -6.390461e+00 -4.649985e+00 -1.076121e-01 -9.035143e-02 -2.072319e+00
[606] -1.823953e+00 2.392772e+00 -8.874931e-01 -1.780988e+00 -2.566478e+00
[611] -1.267628e+00 -1.197232e-01 -1.066106e-01 -9.502189e-02 -1.086169e+00
[616] -9.635188e-01 1.462663e-01 3.128467e+00 1.768259e+00 2.561960e+00
[621] 1.262033e+00 3.120121e+00 7.608828e-01 -3.325106e-01 -2.988356e-01
[626] -1.260741e+00 8.877525e-01 3.776837e+00 -6.795543e-01 -1.612492e+00
[631] 1.578269e+00 -5.976169e-01 -3.522022e+00 -1.107342e-01 4.898556e+00
[636] 3.324304e+00 -1.068385e+00 -1.949191e+00 -7.276339e-01 4.346405e+00
[641] 8.293766e-01 -2.276143e+00 -1.936762e-02 -2.026251e+00 2.070391e-01
reached getOption("max.print") -- omitted 827 entries ]
前三百六十个数据为什么会为为空,求解答