我们有一个数据框,其中包含变量(温室气体排放,每人汽车数量,所有汽车中LPG燃料汽车的百分比)
df <- data.frame(
emission = c(4.66,4.93,5.22,5.63,5.51,5.57,5.56,5.88,5.97,5.81,5.90,6.07),
carpp = c(0.1505125,0.1618598,0.1753534,0.1844976,0.1924772,0.1973057,0.2047611,0.2153194,0.2252293,0.2345578,0.2435042,0.2558408),
LPG_p=c(8.000962,11.653062,12.839622,14.436235,16.536271,18.109585,19.699988,20.731286,21.426939,21.933524,22.099233,21.799780)
)
rownames(df) <- 2004:2015
df
因此,我们的数据:
emission carpp LPG_p
2004 4.66 0.1505125 8.000962
2005 4.93 0.1618598 11.653062
2006 5.22 0.1753534 12.839622
2007 5.63 0.1844976 14.436235
2008 5.51 0.1924772 16.536271
2009 5.57 0.1973057 18.109585
2010 5.56 0.2047611 19.699988
2011 5.88 0.2153194 20.731286
2012 5.97 0.2252293 21.426939
2013 5.81 0.2345578 21.933524
2014 5.90 0.2435042 22.099233
2015 6.07 0.2558408 21.799780
通过单位根检验发现所有三个变量都是非平稳的,协整分析
library(urca)
summary(ca.jo(df, K=2,type="trace", ecdet="none", spec="transitory"))
透露,这三个系列与秩r = 1协整。
以下代码( Verena Brufatto,2015,“宏观经济因素和美国股票市场指数:协整分析”,MS论文,第99页;以及其他许多来源 )为alfa和beta生成alfa,beta,t-statistics:
V1.trace <- ca.jo(df, K=2,type="trace", ecdet="none", spec="transitory") # rank=1
vecm <- cajorls(V1.trace, r=1)
beta <- V1.trace@V[,1]
alfa <- V1.trace@W[,1]
residuals <- resid(vecm$rlm)
N <- nrow(residuals) # 10
sigma <- crossprod(residuals)/N
beta.se <- sqrt(diag(kronecker(solve(crossprod(V1.trace@RK[,-1])), solve(t(alfa)%*%solve(sigma) %*% alfa))))
beta.t <- c(NA, beta[-1]/beta.se)
alfa.se <- sqrt(solve(crossprod(cbind(V1.trace@ZK %*%beta, V1.trace@Z1)))[1,1]*diag(sigma))
alfa.t <- alfa/alfa.se
估计的协整归一化归一化特征向量矩阵,alfa权重(加载矩阵),来自上述代码的t统计量:
emission_(t-1) carpp_(t-1) LPG_p_(t-1)
β 1 -17.8569153 -0.0374754
(-15.487457) (-5.406585)
α -0.20755093 -0.01069378 2.76252149
(-0.8393556) (-7.4775057) (16.0376516)
t值处于paranthesis。
假设在这个阶段,我们想要找到α和β的t统计量的临界值。我们怎样才能找到那些?
我做了什么:
1。以下内容:
coeftest(cajorls(ca.jo(df, K=2,type="trace", ecdet="none", spec="transitory"), r=1)$rlm)
产生
t test of coefficients:
Estimate Std. Error t value Pr(>|t|)
emission.d:ect1 -2.0754e-01 3.4970e-01 -0.5935 0.578678
emission.d:constant -1.4452e-01 4.6887e-01 -0.3082 0.770334
emission.d:emission.dl1 -1.1461e-01 5.3116e-01 -0.2158 0.837695
emission.d:carpp.dl1 4.3285e+01 3.3596e+01 1.2884 0.253999
emission.d:LPG_p.dl1 9.8103e-02 9.9322e-02 0.9877 0.368642
carpp.d:ect1 -1.0694e-02 2.0225e-03 -5.2874 0.003225 **
carpp.d:constant 1.6675e-02 2.7117e-03 6.1495 0.001653 **
carpp.d:emission.dl1 1.2156e-02 3.0719e-03 3.9570 0.010775 *
carpp.d:carpp.dl1 1.9572e-01 1.9430e-01 1.0073 0.360017
carpp.d:LPG_p.dl1 2.2761e-03 5.7442e-04 3.9625 0.010716 *
LPG_p.d:ect1 2.7625e+00 2.4359e-01 11.3406 9.324e-05 ***
LPG_p.d:constant -1.5706e+00 3.2660e-01 -4.8088 0.004846 **
LPG_p.d:emission.dl1 -9.8081e-01 3.7000e-01 -2.6509 0.045380 *
LPG_p.d:carpp.dl1 -6.6548e+01 2.3402e+01 -2.8437 0.036091 *
LPG_p.d:LPG_p.dl1 -1.7219e-01 6.9186e-02 -2.4888 0.055240 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
虽然coeftest(cajorls(ca.jo()))
及以上代码的alfa值相同,但t统计量不同。