- 阅读权限
- 255
- 威望
- 13 级
- 论坛币
- 1096751 个
- 通用积分
- 77228.2228
- 学术水平
- 3447 点
- 热心指数
- 3906 点
- 信用等级
- 2743 点
- 经验
- 469733 点
- 帖子
- 11687
- 精华
- 5
- 在线时间
- 20148 小时
- 注册时间
- 2004-7-15
- 最后登录
- 2024-4-24
|
看linearHypothesis命令里面的例子
- Examples
- mod.davis <- lm(weight ~ repwt, data=Davis)
- ## the following are equivalent:
- linearHypothesis(mod.davis, diag(2), c(0,1))
- linearHypothesis(mod.davis, c("(Intercept) = 0", "repwt = 1"))
- linearHypothesis(mod.davis, c("(Intercept)", "repwt"), c(0,1))
- linearHypothesis(mod.davis, c("(Intercept)", "repwt = 1"))
- ## use asymptotic Chi-squared statistic
- linearHypothesis(mod.davis, c("(Intercept) = 0", "repwt = 1"), test = "Chisq")
- ## the following are equivalent:
- ## use HC3 standard errors via white.adjust option
- linearHypothesis(mod.davis, c("(Intercept) = 0", "repwt = 1"),
- white.adjust = TRUE)
- ## covariance matrix *function*
- linearHypothesis(mod.davis, c("(Intercept) = 0", "repwt = 1"), vcov = hccm)
- ## covariance matrix *estimate*
- linearHypothesis(mod.davis, c("(Intercept) = 0", "repwt = 1"),
- vcov = hccm(mod.davis, type = "hc3"))
- mod.duncan <- lm(prestige ~ income + education, data=Duncan)
- ## the following are all equivalent:
- linearHypothesis(mod.duncan, "1*income - 1*education = 0")
- linearHypothesis(mod.duncan, "income = education")
- linearHypothesis(mod.duncan, "income - education")
- linearHypothesis(mod.duncan, "1income - 1education = 0")
- linearHypothesis(mod.duncan, "0 = 1*income - 1*education")
- linearHypothesis(mod.duncan, "income-education=0")
- linearHypothesis(mod.duncan, "1*income - 1*education + 1 = 1")
- linearHypothesis(mod.duncan, "2income = 2*education")
复制代码
|
|