【问题标题】:GLHT for multiple regression coefficients in RGLHT 用于 R 中的多个回归系数
【发布时间】:2017-10-04 03:58:12
【问题描述】:

我已经运行了 GLM 二项式模型

fit <- glm(highlow ~ V1 + V2 + V3 + V4 + V5 + V6 + V7 + V8 + V9 + V10,
       family="binomial")

为了检验 V1 = V2 的原假设,我使用了以下代码。

glht.mod <- glht(fit, linfct = c("V1 - V2 = 0"))
summary(glht.mod) 

我的问题是我是否可以测试 V1 = V2 = V3(所有三个系数相等的零假设 - 请注意,这与在单独的迭代中测试 V1 = V2 和 V2 = V3 是否相同)?

如果有任何帮助,我可以使用以下代码在 SAS 中实现这一点

proc logistic;
   model highlow = V1 V2 V3 V4 V5 V6 V7 V8 V9 V10;
   test1: V1 = V2;
   test2: V1 = V2 = V3;
run;

【问题讨论】:

  • 在 proc logistic ( support.sas.com/documentation/cdl/en/statug/63347/HTML/default/… ) 中查看 test 语句的 SAS 手册,您可以找到“test3: test a1=a2=a3; test4: test a1”的断言=a2,a2=a3;"是等价的。
  • 没错,但在 SAS 手册中的 test3 和 test4 中,测试都是在同一步骤中运行的。这是我在 R 中不知道如何做的。我可以在 SAS 中做相当于 Test1 V1=V2;测试2 V2=V3;我无法做的是 Test1 V1=V2=V3;或者如果你更喜欢 Test1 V1=V2, V2=V3;
  • 谢谢。看起来这就是我所追求的解决方案。

标签: r glm


【解决方案1】:

问题的可能解决方案:

set.seed(1)
n <- 1000
highlow <- factor(runif(n)>0.5)
X <- matrix(rnorm(n*10),nrow=n)
df <- data.frame(highlow, X)
names(df) <- c("highlow", paste("V",1:10,sep=""))

fit <- glm(highlow ~ V1 + V2 + V3 + V4 + V5 + V6 + V7 + V8 + V9 + V10,
       family="binomial", data=df)

library(car)
linearHypothesis(fit, c("V1-V2", "V2-V3"), c(0,0))


################
Linear hypothesis test

Hypothesis:
V1 - V2 = 0
V2 - V3 = 0

Model 1: restricted model
Model 2: highlow ~ V1 + V2 + V3 + V4 + V5 + V6 + V7 + V8 + V9 + V10

  Res.Df Df  Chisq Pr(>Chisq)
1    991                     
2    989  2 0.2761      0.871

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-10-09
    • 2013-05-17
    • 1970-01-01
    • 2017-11-24
    • 1970-01-01
    • 1970-01-01
    • 2018-06-06
    • 1970-01-01
    相关资源
    最近更新 更多