全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
10187 14
2015-01-12
各位老师:我做方程组估计时用到R的systemfit包,已经可以运用systemfit包来做方程组估计。问题是,在多变量方程组中,如何检验两个变量的联合显著性?我找遍了systemfit包,没有给出方案,而在其他包中(如lmtest,sandwich等),我找不到类似的代码。现请教各位老师,请赐教。
二维码

扫码加我 拉你入群

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

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

全部回复
2015-1-12 20:28:29
stata中很简单,只要用test就行,但是不知道R中怎么干。
二维码

扫码加我 拉你入群

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

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

2015-1-12 21:03:28
好像是
linearHypothesis

查help吧下面是里面的例子

Examples

data( "Kmenta" )

eqDemand <- consump ~ price + income

eqSupply <- consump ~ price + farmPrice + trend

system <- list( demand = eqDemand, supply = eqSupply )


## unconstrained SUR estimation

fitsur <- systemfit( system, method = "SUR", data=Kmenta )


# create hypothesis matrix to test whether beta_2 = \beta_6

R1 <- matrix( 0, nrow = 1, ncol = 7 )

R1[ 1, 2 ] <- 1

R1[ 1, 6 ] <- -1

# the same hypothesis in symbolic form

restrict1 <- "demand_price - supply_farmPrice = 0"


## perform Theil's F test

linearHypothesis( fitsur, R1 )  # rejected

linearHypothesis( fitsur, restrict1 )


## perform Wald test with F statistic

linearHypothesis( fitsur, R1, test = "F" )  # rejected

linearHypothesis( fitsur, restrict1 )


## perform Wald-test with chi^2 statistic

linearHypothesis( fitsur, R1, test = "Chisq" )  # rejected

linearHypothesis( fitsur, restrict1, test = "Chisq" )


# create hypothesis matrix to test whether beta_2 = - \beta_6

R2 <- matrix( 0, nrow = 1, ncol = 7 )

R2[ 1, 2 ] <- 1

R2[ 1, 6 ] <- 1

# the same hypothesis in symbolic form

restrict2 <- "demand_price + supply_farmPrice = 0"


## perform Theil's F test

linearHypothesis( fitsur, R2 )  # accepted

linearHypothesis( fitsur, restrict2 )


## perform Wald test with F statistic

linearHypothesis( fitsur, R2, test = "F" )  # accepted

linearHypothesis( fitsur, restrict2 )


## perform Wald-test with chi^2 statistic

linearHypothesis( fitsur, R2, test = "Chisq" )  # accepted

linearHypothesis( fitsur, restrict2, test = "Chisq" )


二维码

扫码加我 拉你入群

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

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

2015-1-12 21:10:44
蓝色 发表于 2015-1-12 21:03
好像是
linearHypothesis
谢谢老师给我提供的例子,不过这和两个变量的联合显著检验不是一回事。再次感谢!
二维码

扫码加我 拉你入群

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

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

2015-1-12 21:26:06
道理是一样的
你吧那个约束的矩阵写好就可以了
二维码

扫码加我 拉你入群

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

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

2015-1-12 21:31:44
蓝色 发表于 2015-1-12 21:26
道理是一样的
你吧那个约束的矩阵写好就可以了
我试试再说,谢谢
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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