簡體   English   中英

從R.ca.jo中的Johannsen協整方法估計t統計量

[英]Estimating t-statistics from Johannsen cointegration method in ca.jo in R

我正在通過R中的“ vars”庫中的小插圖工作示例進行工作。我了解了小插圖中的大多數示例,請參見此處的小插圖表5。

運行以下代碼,我看到協整矢量和載荷點估計值的導出位置,但我不了解t統計量的導出位置。

我運行了這段代碼:

library("vars") data("Canada") Canada <- Canada[, c("prod", "e", "U", "rw")] vecm <- ca.jo(Canada[, c("rw", "prod", "e", "U")], type = "trace", ecdet = "trend", K = 3, spec = "transitory") vecm.r1 <- cajorls(vecm, r = 1)

得到了這些特征向量和權重,

    Eigenvectors, normalised to first column:
(These are the cointegration relations)

               rw.l1     prod.l1       e.l1       U.l1   trend.l1
rw.l1     1.00000000   1.0000000  1.0000000   1.000000  1.0000000
prod.l1   0.54487553  -3.0021508  0.7153696  -7.173608  0.4087221
e.l1     -0.01299605  -3.8867890 -2.0625220 -30.429074 -3.3884676
U.l1      1.72657188 -10.2183404 -5.3124427 -49.077209 -5.1326687
trend.l1 -0.70918872   0.6913363 -0.3643533  11.424630  0.1157125

Weights W:
(This is the loading matrix)

              rw.l1      prod.l1        e.l1          U.l1      trend.l1
rw.d   -0.084814510  0.048563997 -0.02368720 -0.0016583069  5.722004e-12
prod.d -0.011994081  0.009204887 -0.09921487  0.0020567547 -7.478364e-12
e.d    -0.015606039 -0.038019447 -0.01140202 -0.0005559337 -1.229460e-11
U.d    -0.008659911  0.020499657  0.02896325  0.0009140795  1.103862e-11

表5給了我正確的alpha和beta值。

但是我不知道表5中的t統計量是從代碼中導出的。 有人可以指出我的正確方向嗎?

問候,

詹姆士

我對urca最大抱怨是:它不計算beta向量的t統計量。 看起來作者可能在某個時候想包括該功能(因此,您在上面引用的小插圖中有表5),但並未真正做到這一點。

好消息: 對於一個協整向量(r = 1),可以使用示例代碼來獲取標准誤差 看到這個討論線程

當存在單個協整矢量時,與urca的長期協整關系的標准誤差

從上面的示例繼續,上面討論的nabble線程給出的代碼是:

 alpha <- coef(vecm.r1$rlm)[1, ]  # the coefficients on ecm1
 beta <- vecm.r1$beta  # the point estimates of beta

 resids <- resid(vecm.r1$rlm) 
 N <- nrow(resids) 
 sigma <- crossprod(resids) / N 

 ## t-stats for beta 
 beta.se <- sqrt(diag(kronecker(solve(crossprod(vecm@RK[, -1])), 
                                solve(t(alpha) %*% solve(sigma) %*% alpha)))) 
 beta.t <- c(NA, beta[-1] / beta.se) 
 names(beta.t) <- rownames(vecm.r1$beta) 
 beta.t 

這恰好再現了小插圖給出的標准誤差。

與Gretl比較

如果我們使用gretl運行相同的模型,我們將獲得完全相同的beta點估計,但標准誤差大致相同:

向量協整的Gretl標准誤

獎勵:使用urca和texreg創建具有標准誤差的協整向量的LaTeX表

您需要編寫一個稍微笨拙的“提取”函數,以將標准誤差和點估計值組合在一起,成為texreg喜歡的形式:

 extract.cajo_beta <- function(cajo, orls) {
   alpha <- coef(orls$rlm)[1, ];
   resids <- resid(orls$rlm);
   N <- nrow(resids);
   sigma <- crossprod(resids) / N;

   # get standard errors and p-values
   beta <- orls$beta
   beta.se <- sqrt(diag(kronecker(solve(crossprod(cajo@RK[, -1])), 
                                  solve(t(alpha) %*% solve(sigma) %*% alpha))));
   beta.se2 <- c(NA, beta.se);
   beta.t <- c(NA, beta[-1] / beta.se);
   beta.pval <- dt(beta.t, df= orls$rlm$df.residual)

   tr <- createTexreg(coef.names = as.character(rownames(beta)), coef = as.numeric(beta), se = beta.se2, 
         pvalues = beta.pval,
         # remove this goodness of fit measure afterwards from the table
         gof.names = c('Dummy'), gof = c(1), gof.decimal = c(FALSE)
   );
   return(tr);
 }

然后運行:

 > screenreg(extract.cajo_beta(vecm, vecm.r1))

 =================
           Model 1
 -----------------
 rw.l1      1.00  

 prod.l1    0.54  
           (0.61) 
 e.l1      -0.01  
           (0.68) 
 U.l1       1.73  
           (1.45) 
 trend.l1  -0.71 *
           (0.28) 
 -----------------
 Dummy      1     
 =================
 *** p < 0.001, ** p < 0.01, * p < 0.05

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM