4069 3

[问答] R语言Wald检验两变量回归系数是否相等 [推广有奖]

  • 0关注
  • 0粉丝

高中生

47%

还不是VIP/贵宾

-

威望
0
论坛币
19 个
通用积分
1.4000
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
73 点
帖子
8
精华
0
在线时间
44 小时
注册时间
2020-4-25
最后登录
2021-1-26

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
请问一下大家

R语言Wald检验两变量回归系数是否相等问题,具体代码应该怎么写呀?

R里面给出的示例都是变量为0的情况,不知道两个变量系数相等应该怎么检验。

比如这里Yi=β0+β1*x1i+β2*x2i+β3*x3i+εi,想检验H0:β2=β3
二维码

扫码加我 拉你入群

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

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

关键词:wald检验 回归系数 Wald R语言 变量系数

沙发
蓝色 发表于 2020-8-12 12:23:03 |只看作者 |坛友微信交流群
看linearHypothesis命令里面的例子


  1. Examples
  2. mod.davis <- lm(weight ~ repwt, data=Davis)

  3. ## the following are equivalent:
  4. linearHypothesis(mod.davis, diag(2), c(0,1))
  5. linearHypothesis(mod.davis, c("(Intercept) = 0", "repwt = 1"))
  6. linearHypothesis(mod.davis, c("(Intercept)", "repwt"), c(0,1))
  7. linearHypothesis(mod.davis, c("(Intercept)", "repwt = 1"))

  8. ## use asymptotic Chi-squared statistic
  9. linearHypothesis(mod.davis, c("(Intercept) = 0", "repwt = 1"), test = "Chisq")


  10. ## the following are equivalent:
  11.   ## use HC3 standard errors via white.adjust option
  12. linearHypothesis(mod.davis, c("(Intercept) = 0", "repwt = 1"),
  13.     white.adjust = TRUE)
  14.   ## covariance matrix *function*
  15. linearHypothesis(mod.davis, c("(Intercept) = 0", "repwt = 1"), vcov = hccm)
  16.   ## covariance matrix *estimate*
  17. linearHypothesis(mod.davis, c("(Intercept) = 0", "repwt = 1"),
  18.     vcov = hccm(mod.davis, type = "hc3"))

  19. mod.duncan <- lm(prestige ~ income + education, data=Duncan)

  20. ## the following are all equivalent:
  21. linearHypothesis(mod.duncan, "1*income - 1*education = 0")
  22. linearHypothesis(mod.duncan, "income = education")
  23. linearHypothesis(mod.duncan, "income - education")
  24. linearHypothesis(mod.duncan, "1income - 1education = 0")
  25. linearHypothesis(mod.duncan, "0 = 1*income - 1*education")
  26. linearHypothesis(mod.duncan, "income-education=0")
  27. linearHypothesis(mod.duncan, "1*income - 1*education + 1 = 1")
  28. linearHypothesis(mod.duncan, "2income = 2*education")
复制代码

使用道具

藤椅
会发光的智智 学生认证  发表于 2020-8-13 12:57:58 |只看作者 |坛友微信交流群
蓝色 发表于 2020-8-12 12:23
看linearHypothesis命令里面的例子
谢谢!原来linearHypothesis用的就是wald检验

使用道具

板凳
橘皮小苏打 发表于 2020-8-18 19:10:22 |只看作者 |坛友微信交流群
会发光的智智 发表于 2020-8-13 12:57
谢谢!原来linearHypothesis用的就是wald检验
你好,你的解决了吗?我用了之后出现了Error: $ operator not defined for this S4 class

使用道具

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

本版微信群
加好友,备注jltj
拉您入交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-28 02:34