# LD50、エームス試験　他

• 毒性評価の一般知識(資料１資料２資料３)
• 医薬品の遺伝毒性試験(資料)
• "CRAN, LD50"の検索でひっかかるパッケージ
• doBy パッケージのdose.LD50()
• データを回帰して回帰曲線式から算出
```install.packages("doBy")
data(budworm)
m1 <- glm(ndead/20 ~ sex + log(dose), data=budworm, weight=ntotal, family=binomial)
coef(m1)
dose.LD50(m1,c(1,1,NA))
dose.LD50(m1,c(1,0,NA))
```
• glm()関数とそのpredict()関数を使えば
```require(graphics)
par(mfcol=c(1,2))
## example from Venables and Ripley (2002, pp. 190-2.)
ldose <- rep(0:5, 2)
numdead <- c(1, 4, 9, 13, 18, 20, 0, 2, 6, 10, 12, 16)
sex <- factor(rep(c("M", "F"), c(6, 6)))
budworm.lg <- glm(SF ~ sex*ldose, family=binomial)
summary(budworm.lg)

plot(c(1,32), c(0,1), type = "n", xlab = "dose",
ylab = "prob", log = "x")
par(new=TRUE)
ld <- seq(0, 5, 0.1)

pr1<-predict(budworm.lg, data.frame(ldose=ld,
sex=factor(rep("M", length(ld)), levels=levels(sex))),
type = "response",se=TRUE)

pr2<-predict(budworm.lg, data.frame(ldose=ld,
sex=factor(rep("F", length(ld)), levels=levels(sex))),
type = "response",se.fit=TRUE,se=TRUE)
lines(2^ld, pr1\$fit)
lines(2^ld, pr1\$fit+pr1\$se.fit,col=2)
lines(2^ld, pr1\$fit-pr1\$se.fit,col=2)
lines(2^ld, pr2\$fit)
lines(2^ld, pr2\$fit+pr2\$se.fit,col=2)
lines(2^ld, pr2\$fit-pr2\$se.fit,col=2)

#########
## example from Venables and Ripley (2002, pp. 190-2.)
ldose <- rep(0:5, 2)
numdead <- c(1, 4, 9, 13, 18, 20, 0, 2, 6, 10, 12, 16)
sex <- factor(rep(c("M", "F"), c(6, 6)))
budworm.lg <- glm(SF ~ sex*ldose, family=binomial)
summary(budworm.lg)

plot(c(1,32), c(0,1), type = "n", xlab = "dose",
ylab = "prob", log = "x")
par(new=TRUE)
ld <- seq(0, 5, 0.1)

pr1<-predict(budworm.lg, data.frame(ldose=ld,
sex=factor(rep("M", length(ld)), levels=levels(sex))),
type = "response",se=TRUE)

pr2<-predict(budworm.lg, data.frame(ldose=ld,
sex=factor(rep("F", length(ld)), levels=levels(sex))),
type = "response",se.fit=TRUE,se=TRUE)
lines(2^ld, pr1\$fit)
lines(2^ld, pr1\$fit+pr1\$se.fit,col=2)
lines(2^ld, pr1\$fit-pr1\$se.fit,col=2)
lines(2^ld, pr2\$fit)
lines(2^ld, pr2\$fit+pr2\$se.fit,col=2)
lines(2^ld, pr2\$fit-pr2\$se.fit,col=2)
```