我正在尝试从引导的 GLM 输出列表中计算 LC50
我将引导 GLM 的输出放在一个列表(命名结果)中,如下所示:(为了方便起见,我刚刚放入了最后一个结果,而不是整个列表)
$thetastar[[100]]
Call: glm(formula = dead[x] ~ concentration[x] + factor(female.no[x]),
family = binomial, data = subset.data.48hr)
Coefficients:
(Intercept) concentration[x] factor(female.no[x])3 factor(female.no[x])4 factor(female.no[x])7
0.7386 0.1869 -0.8394 -5.6613 -2.9576
factor(female.no[x])8 factor(female.no[x])9
-1.5329 -2.7826
Degrees of Freedom: 354 Total (i.e. Null); 348 Residual
(1265 observations deleted due to missingness)
Null Deviance: 484.2
Residual Deviance: 257 AIC: 271
dose.p
从包中使用MASS
我正在尝试为已运行的模型中的每个人计算 LC50
dose.p(results$thetastar[[100]], cf = c(2,3), p = 0.5)
返回
Dose SE
p = 0.5: 0.2227249 0.161769
据我了解,这是我放入factor(female.no[x])3.
的LC50,我认为它是第2 列和第 3 列,以及dose.p
cf = c(2,3)
concentration
factor(female.no[x])3.
这个对吗?
其次:
有没有一种方法可以为每个女性获得 LC50,即factor(female.no[x])3
, factor(female.no[x])4
等等 factor(female.no[x])7
,我不知道如何dose.p
在不手动更改代码的情况下根据不同的变量进行工作cf=
:
dose.p(results$thetastar[[100]], cf = c(2,3), p = 0.5)
dose.p(results$thetastar[[100]], cf = c(2,4), p = 0.5)
dose.p(results$thetastar[[100]], cf = c(2,4), p = 0.5)
最后:我的结果存储在一个列表中,我如何才能dose.p
沿着列表工作,它会是这样的:
test=matrix
for(i in 1:results){
test[i,]= dose.p(results$thetastar[[i]], cf = c(2,3), p = 0.5)
谢谢你的帮助