0

我想start在模型中使用参数geeglm来帮助它收敛。使用默认起始值​​,模型似乎永远运行,我怀疑为参数指定起点可以帮助geeglm不被卡住。

指定起始值会导致以下错误:

Error in model.frame.default(formula = mf, data = dietox, start = gee1$coefficients,  : 
  variable lengths differ (found for '(start)')

这是一个虚拟的可重现示例,我使用拟合模型 ( gee1) 中的系数来指定第二个模型的起点 ( gee1.start)

library(geepack)
data(dietox)
dietox$Cu     <- as.factor(dietox$Cu)
mf <- formula(Weight ~ Cu * (Time + I(Time^2) + I(Time^3)))
gee1 <- geeglm(mf, data=dietox, id=Pig, family=poisson("identity"), corstr="ar1")
gee1.start <- geeglm(mf, data=dietox, id=Pig, family=poisson("identity"), corstr="ar1", start = gee1$coefficients)

这将返回以下错误:

Error in model.frame.default(formula = mf, data = dietox, start = gee1$coefficients,  : 
  variable lengths differ (found for '(start)')

geeglm帮助页面中,表明该start参数的行为与常规参数相同,glm但将完全相同的技术应用于glm没有任何问题的作品,如下面的虚拟示例:

## Dobson (1990) Page 93: Randomized Controlled Trial :
counts <- c(18,17,15,20,10,20,25,13,12)
outcome <- gl(3,1,9)
treatment <- gl(3,3)
data.frame(treatment, outcome, counts) # showing data
glm1 <- glm(counts ~ outcome + treatment, family = poisson())
glm1.start <- glm(counts ~ outcome + treatment, family = poisson(), start = glm1$coefficients)

有谁知道如何start在函数中正确使用参数geeglm

4

0 回答 0