drc::optim初始值在';vmmin';不是有限的

drc::optim初始值在';vmmin';不是有限的,r,logistic-regression,drc,R,Logistic Regression,Drc,我想为drcR包中的以下数据拟合log logistic回归。但是,我的代码抛出以下错误 df1 <- structure(list(Temp = c(15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 20L, 20L, 20L, 20L, 20L, 20L, 25L, 25L, 25L, 25L, 30L, 30L, 30L, 30L, 35L, 35L, 35L, 35L, 40L, 40L, 40L, 40L),

我想为
drc
R
包中的以下数据拟合
log logistic
回归。但是,我的代码抛出以下错误

df1 <-
  structure(list(Temp = c(15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 
      15L, 20L, 20L, 20L, 20L, 20L, 20L, 25L, 25L, 25L, 25L, 30L, 30L, 
      30L, 30L, 35L, 35L, 35L, 35L, 40L, 40L, 40L, 40L), Start = c(0L, 
      24L, 48L, 72L, 96L, 120L, 144L, 168L, 192L, 0L, 24L, 48L, 72L, 
      96L, 120L, 0L, 24L, 48L, 72L, 0L, 24L, 48L, 72L, 0L, 24L, 48L, 
      72L, 0L, 24L, 48L, 72L), End = c(24, 48, 72, 96, 120, 144, 168, 
      192, Inf, 24, 48, 72, 96, 120, Inf, 24, 48, 72, 96, 24, 48, 72, 
      Inf, 24, 48, 72, Inf, 24, 48, 72, Inf), Germinated = c(0L, 0L, 
      1L, 3L, 3L, 12L, 14L, 12L, 15L, 0L, 11L, 27L, 15L, 3L, 4L, 2L, 
      30L, 15L, 13L, 6L, 43L, 7L, 4L, 5L, 48L, 3L, 4L, 0L, 31L, 21L, 
      8L)), .Names = c("Temp", "Start", "End", "Germinated"), row.names = c(NA, 
      -31L), class = "data.frame")

library(drc)

fm1 <-
  drm(
        formula = Germinated ~ Start + End 
      , data    = df1
      , fct     = LL.2()
      , type    = "event" 
      , control   = drmc(
                            constr      = FALSE
                            , errorm      = TRUE
                            , maxIt       = 1500
                            , method      = "BFGS"
                            , noMessage   = FALSE
                            , relTol      = 1e-07
                            , rmNA        = FALSE
                            , useD        = FALSE
                            , trace       = FALSE
                            , otrace      = FALSE
                            , warnVal     = -1
                            , dscaleThres = 1e-15
                            , rscaleThres = 1e-15
                            )

          )

summary(fm1)

df1您需要按Temp对数据进行分组,因为Temp的每个值都会重复时间段<代码>曲线ID=Temp
实现了以下功能:

fm1 <-drm(data = df1, curveid = Temp,
          formula = Germinated ~ Start + End,  fct = LL.2(), type = "event", 
          control = drmc(constr = FALSE, errorm = TRUE, maxIt = 1500, method = "BFGS", 
                         noMessage = FALSE, relTol = 1e-07, rmNA = FALSE, useD = FALSE, 
                         trace = FALSE, otrace = FALSE, warnVal = -1, dscaleThres = 1e-15, rscaleThres = 1e-15))

summary(fm1)

Model fitted: Log-logistic (ED50 as parameter) with lower limit at 0 and upper limit at 1 (2 parms)

Parameter estimates:

      Estimate Std. Error   t-value p-value
b:15  -6.03055    0.78915  -7.64179       0
b:20  -4.96450    0.60740  -8.17338       0
b:25  -4.43973    0.54904  -8.08639       0
b:30  -4.80876    0.60792  -7.91025       0
b:35  -5.45991    0.69159  -7.89467       0
b:40  -5.43892    0.79772  -6.81811       0
e:15 162.33568    6.10473  26.59177       0
e:20  64.71588    3.08660  20.96674       0
e:25  48.23883    2.68278  17.98090       0
e:30  36.38415    2.04252  17.81337       0
e:35  35.07398    1.85537  18.90405       0
e:40  48.44494    2.21375  21.88366       0

fm1您完全正确@G.Grothendieck。我已经尝试了
curveid=factor(Temp)
,但出现了相同的错误。任何想法。这会给出结果(也可以尝试使用
separate=TRUE
separate=FALSE
并与将数据分为一个温度并仅运行该温度进行比较),但在所有情况下,每个温度都会得到单独的系数:
drm(发芽~开始+结束,数据=df1,曲线ID=Temp,fct=LL.2(),类型=“事件”)
感谢@dww提供有用的答案。如果您能指导我如何为
Temp
Variety
的交互设置
drm
模型,我会尝试
curveid=Temp:Variety
但抛出错误:
Temp:Variety:NA/NaN参数中的错误。有什么想法吗?我当然可以告诉您怎么做是-但我认为其他人可能会发现这个问题本身就很有用。因此,我建议你将这个问题作为一个新问题来问。这样,其他人也可以搜索解决方案,他们也想知道如何在多个列上分组。如果我在这里回答,解决方案将对其他SO用户相当隐藏。Tha谢谢你的建议。新问题是。