全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
6097 7
2014-02-25
R的vars包里没找到与stata相对应的检验,查看stata的说明文件后发现varwle和vargranger都是用Wald test。尝试用restrict拟合restricted model,然后调用lmtest包里的waldtest,得出的Chisq都比stata的结果低10%左右,p-value也不大相同,求助原因。
另外stata的varlmar采用的是Johansen的LM test,R的vars包里的serial.test没有包含此检验,请问如何实现?
万分感谢!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2014-3-21 17:51:58
帮顶
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2014-5-20 23:04:38
这问题有意思
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2014-5-25 15:24:04
需要请联系QQ:1298997509
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2014-7-19 21:09:18

下面是协整的Johansen的LM test程序,看看没有么帮助:

johansen.test<-
function(x, L = 2)
{
        x <- ts(x)
        n <- nrow(x)
        p <- ncol(x)
        Ly <- lag(x[, 1], -1)
        D <- diff(x[, 1])
        for(i in 1:p) {
                if(i > 1) {
                        D <- ts.intersect(D, diff(x[, i]))
                        Ly <- ts.intersect(Ly, lag(x[, i], -1))
                }
                if(L > 0)
                        for(j in 1:L)
                                D <- ts.intersect(D, lag(diff(x[, i]),  - j))
        }
        iys <- 1 + (L + 1) * (0:(p - 1))
        Y <- D[, iys]
        X <- D[,  - iys]
        Ly <- ts.intersect(Ly, D)[, 1:p]
        ZD <- lm(Y ~ X)$resid
        ZL <- lm(Ly ~ X)$resid
        df <- nrow(X) - ncol(X) - 1
        S00 <- crossprod(ZD)/df
        S11 <- crossprod(ZL)/df
        S01 <- crossprod(ZD, ZL)/df
        M <- solve(S11) %*% t(S01) %*% solve(S00) %*% S01
        eigen(M)$values   #返回特征值
}

关于该检验的部分理论见http://en.wikipedia.org/wiki/Johansen_test
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2014-9-2 23:12:06
grangertest: grangertest is simply a Wald test comparing the unrestricted model—in which y is explained by the lags (up to order order) of y and x—and the restricted model—in which y is only explained by the lags of y.
causality:Two causality tests are implemented. The first is a F-type Granger-causality test and the second is a Wald-type test that is characterized by testing for nonzero correlation between the error processes of the cause and effect variables.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群