2016-08-04 50 views
0

長話短說,我嘗試做一個閃亮的應用程序,它具有以下功能: 如果我的時間序列是固定的,然後嘗試傅立葉 別的嘗試小波如何從一個函數輸出中刪除不必要的內容

但有以下的問題: 我用ur.dfurca包,每當我做增強迪基富勒 結果是類似以下

############################################################### 
# Augmented Dickey-Fuller Test Unit Root/Cointegration Test # 
############################################################### 

The value of the test statistic is: -0.9401 2.5819 3.3893 

我怎麼能隔離檢驗統計量-0.9401

預先感謝您

+1

請調用'ur.df'一些樣本數據重複的例子。這將使我們更容易回答。 – Spacedman

回答

2

運行示例從?ur.df

data(Raotbl3) 
attach(Raotbl3) 
lc.df <- ur.df(y=lc, lags=3, type='trend') 

什麼你得到看起來像輸出打印返回的對象:

> lc.df 

############################################################### 
# Augmented Dickey-Fuller Test Unit Root/Cointegration Test # 
############################################################### 

The value of the test statistic is: -2.2389 3.7382 2.5972 

代碼打印這些對象從@teststat插槽獲取測試統計信息:

> [email protected] 
       tau3  phi2  phi3 
statistic -2.238865 3.738151 2.597211 

了該類文件中明確記載爲ur.df類對象:

> class?ur.df 

顯示:

‘teststat’: Object of class ‘"matrix"’: Value of the test 
     statistic. 

因此,要獲得檢驗統計量的第一行的第一個元素:

> [email protected][1,1] 
[1] -2.238865 
+0

對不起,同一個答案,同一時間 – NJBurgo

2

ur.df函數返回一個S4類對象(ur.df),數據存儲在插槽中(看到這些使用slotNames)。

其中之一是有效地命名爲:

# Using the EuStockmarket data from the datasets package (standard in R) 
df <- ur.df(EuStockMarkets[,"FTSE"]) 

slotNames(df) 
# [1] "y"   "model"  "lags"  "cval"  "res"  "teststat" "testreg" "test.name" 

#To access it use 
[email protected] 

# This is a primative matrix, so then get the value needed 
[email protected]["statistic", "tau1"] 
+1

是的,但你應該始終確保插槽有文件記錄,否則作者可以改變,因爲它們可以被認爲是「內部」或「私人」(R的S4級系統沒有簡單的方法強制私人課程資料)。 – Spacedman

相關問題