时间序列分析 - 预测R股票价格

时间:2015-05-01 02:16:34

标签: r time-series analysis forecasting stocks

所以我正在尝试进行时间序列分析,我预测从2004年到2014年的APPL股票价格。数据来自雅虎财经。在我得到摘要后,我在尝试绘制它时会收到'ylim' values的错误。

summary(stockprices)
 Date             Open             High             Low              Close            Volume              Adj.Close     
 2004-01-02:  1   Min.   : 21.55   Min.   : 24.10   Min.   : 21.18   Min.   : 22.56   Min.   : 44485400   Min.   :  1.52  
 2004-02-02:  1   1st Qu.: 76.56   1st Qu.: 89.71   1st Qu.: 72.17   1st Qu.: 80.06   1st Qu.:110719100   1st Qu.: 10.79  
 2004-03-01:  1   Median :162.06   Median :180.22   Median :139.01   Median :161.17   Median :150701850   Median : 25.19  
 2004-04-01:  1   Mean   :233.15   Mean   :249.92   Mean   :213.69   Mean   :232.89   Mean   :167166820   Mean   : 36.12  
 2004-05-03:  1   3rd Qu.:383.36   3rd Qu.:408.27   3rd Qu.:353.32   3rd Qu.:382.86   3rd Qu.:216954225   3rd Qu.: 60.53  
 2004-06-01:  1   Max.   :671.16   Max.   :705.07   Max.   :656.00   Max.   :667.10   Max.   :468331100   Max.   :118.46  
 (Other)   :126      


plot(as.Date(stockprices$Date, "%d-%b-%y"), stockprices$Close.Price, 
     xlab = "Dates", ylab = "Adjusted closing price", type = "1", 
     col = "red", main = "Adjusted closing price of AAPL for past 10 years")

>Error in plot.window(...) : need finite 'ylim' values
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf

不知道如何修复它,我希望我的Y轴以几个月的形式显示日期。任何帮助表示赞赏。

0 个答案:

没有答案