当前位置: 代码迷 >> 综合 >> 嵌套模型(Nested Models)和非嵌套模型(Non-Nested Models) 的统计检验(R语言)
  详细解决方案

嵌套模型(Nested Models)和非嵌套模型(Non-Nested Models) 的统计检验(R语言)

热度:91   发布时间:2023-12-15 20:04:09.0

在R语言中,对于嵌套(nest)模型可以使用likelihood ratio tests(似然比检验),对于非嵌套模型(Non-Nested Models) 可以使用Davidson and MacKinnon’s J-test。这两种检验在论文中经常使用如:
在这里插入图片描述

如下为其代码示例:

require(lmtest)
## Fit two competing, non-nested models for aggregate 
## consumption, as in Greene (1993), Examples 7.11 and 7.12## load data and compute lags
data(USDistLag)
usdl <- na.contiguous(cbind(USDistLag, lag(USDistLag, k = -1)))
colnames(usdl) <- c("con", "gnp", "con1", "gnp1")## C(t) = a0 + a1*Y(t) + a2*C(t-1) + u
fm1 <- lm(con ~ gnp + con1, data = usdl)## C(t) = b0 + b1*Y(t) + b2*Y(t-1) + v
fm2 <- lm(con ~ gnp + gnp1, data = usdl)fm3 <- lm(con ~ gnp, data = usdl)
## Cox test in both directions:
coxtest(fm1, fm2)## ...and do the same for jtest() and encomptest().
## Notice that in this particular case they are coincident.
jtest(fm1, fm2)
encomptest(fm1, fm2)
# likelihood ratio tests
lrtest(fm3, fm1)

检验结果如下图所示:
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

参考

http://math.furman.edu/~dcs/courses/math47/R/library/lmtest/html/jtest.html
https://www.bauer.uh.edu/rsusmel/phd/ec1-6.pdf
http://www.empowerstats.com/cn/manuals/RCH/html/z_lrt.pdf

  相关解决方案