楼主: Robin_Lee000
6178 7

[问答] 如何在R中实现stata里的varlmar,varwle以及vargranger检验? [推广有奖]

  • 0关注
  • 0粉丝

小学生

64%

还不是VIP/贵宾

-

威望
0
论坛币
149 个
通用积分
0
学术水平
5 点
热心指数
0 点
信用等级
0 点
经验
364 点
帖子
7
精华
0
在线时间
9 小时
注册时间
2006-5-5
最后登录
2020-7-9

楼主
Robin_Lee000 发表于 2014-2-25 08:55:47 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
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没有包含此检验,请问如何实现?
万分感谢!
二维码

扫码加我 拉你入群

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

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

关键词:Granger Grange Anger range Stata 如何

已有 1 人评分学术水平 收起 理由
Lisrelchen + 5 观点有启发

总评分: 学术水平 + 5   查看全部评分

本帖被以下文库推荐

沙发
libraryrgl 发表于 2014-3-21 17:51:58
帮顶

藤椅
蒲虎fly 发表于 2014-5-20 23:04:38
这问题有意思
爱拼才会赢,笨鸟前飞,勤劳补拙。

板凳
wangguoping2013 发表于 2014-5-25 15:24:04
需要请联系QQ:1298997509

报纸
zxcv_bnm 发表于 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
已有 1 人评分论坛币 收起 理由
admin_kefu + 30 热心帮助其他会员

总评分: 论坛币 + 30   查看全部评分

地板
hubifeng? 学生认证  发表于 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.

7
gssdzc 在职认证  发表于 2014-9-13 17:21:16
感谢分享。。。

8
讷人 发表于 2017-4-20 00:38:40
hubifeng? 发表于 2014-9-2 23:12
grangertest: grangertest is simply a Wald test comparing the unrestricted model—in which y is expla ...
是说wald type test是检验相关性是否不为零,是这个意思吗?
在eviews里怎么实现呢?需要先做var吗?
请指教,多谢啦~

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-30 13:17