⑴ R語言畫時間序列圖
用xlim或者ylim命令。比如:
# Specify axis options within plot()
plot(x, y, main="title", sub="subtitle",
xlab="X-axis label", ylab="y-axix label",
xlim=c(xmin, xmax), ylim=c(ymin, ymax))
⑵ 如何用R語言提取股票行情數據
你好,關於股票價格有關的開盤價格,當日最高價格,當日最低價格,收盤價格,股票交易量;和調整後的價格;
DIA.Open 當日開盤價格
DIA.High 當日最高價格
DIA.Low 當日最低價格
DIA.Close 當日收盤價格
DIA.Volume 當日股票交易量
DIA.Adjusted 當日調整後的價格
⑶ 如何用R語言的quantmod包獲取一系列股票的歷史日線數據
我舉個例子供你參考:
> install.packages('quantmod') # 安裝安裝quantmod包
> require(quantmod)#引用quantmod包
> getSymbols("GOOG",src="yahoo",from="2013-01-01", to='2013-04-24') #從雅虎財經獲取google的股票數據
> chartSeries(GOOG,up.col='red',dn.col='green') #顯示K線圖
⑷ 如何用R語言提取股票行情數據
最上邊一行菜單欄倒數第二個「高級」-「關聯任務定義」-選取最右邊從上到下第二個按鈕,找到2009年決算任務安裝路徑-確定。 然後 最上邊一行菜單欄正數第二個「錄入」-「上年數據提取」即可 提取完了,注意修改與去年不同的科目代碼!
⑸ 如何用R 語言 建立 股票價格的時間序列
在下想用R語言對股票價格進行時間序列分析。
問題出在第一步,如何將股票價格轉換為時間序列。
我想用的語句是 pri <- ts (data, start=(), frequency= )
但是我不知道frequency 項該如何填?
因為股票的交易日是一周五天的。 那麼這個frequency 該如何設置呢?
我知道通常frequency= 12 為月度數據,frequency= 4 為季度數據,frequency= 1 為年度數據 但日數據怎麼寫我就不知道了
初學R語言,還望各位大俠多多幫助。
⑹ R語言怎麼把股票日收盤價轉換成對數收益率
知道一系列收盤價向量X,length=1000,求對數收益率的R語言代碼
acf(int[,2], lag.max = 15,type = "correlation", plot = TRUE,main='int monthly
acf(int.l[,2], lag.max = 15,type = "correlation", plot = TRUE,main='int monthly
log return')
Box.test(int[,2], lag = 5, type = "Ljung-Box")
Box.test(int[,2], lag = 10, type = "Ljung-Box")
Box.test(int.l[,2], lag = 5, type = "Ljung-Box")
Box.test(int.l[,2], lag = 10, type = "Ljung-Box")
運行結錯誤辦
> int <- read.table("d-intc7208.txt", head=T)
錯誤於file(file, "rt") : 打鏈結
外: 警告信息:
In file(file, "rt") :
打文件'd-intc7208.txt': No such file or directory
+ acf(int.l[,2], lag.max = 15,type = "correlation", plot = TRUE,main='int monthly
錯誤: 意外符號 in:
"
acf(int.l[,2], lag.max = 15,type = "correlation", plot = TRUE,main='int"
> log return')
錯誤: 意外符號 in "log return"
⑺ 如何用matlab和R語言畫K線圖
採用默認的ChartSeries繪制K線圖
library(quantmod)
data_origin=read.csv("data.csv",header = F)
data<-data.frame(Open=data_origin[,2],High=data_origin[,3],Low=data_origin[,4],Close=data_origin[,5],Volume=data_origin[,7],Adjusted=data_origin[,6])
rownames(data)<-as.Date(as.character(data_origin$V1),"%Y%m%d")
chartSeries(data)