【发布时间】:2016-07-03 08:56:07
【问题描述】:
我想为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), 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)
【问题讨论】:
-
你绝对正确@G.Grothendieck。我已经尝试过
curveid = factor(Temp)并且遇到了同样的错误。任何想法。 -
这会给出结果(也可以尝试使用
separate=TRUE和separate = FALSE并与将数据设置为单个温度并运行它进行比较),但在所有情况下,您都会为每个温度获得单独的系数:drm(Germinated ~ Start + End, data = df1, curveid = Temp, fct = LL.2(), type = "event")
标签: r logistic-regression drc