# Logistic Regression (Binary Response)

Determination of the effective dose of a herbicide under field, greenhouse, or laboratory conditions is a common goal of weed science experiments. Although the response variable in some cases is continuous (dry weight) or percent (visual injury), in many cases the response variable of interest is a binary response, such as mortality (the plant is alive or dead). This type of data is important in many types of toxicology and pest management, and weed science is no exception. In many ways the analysis of binary response data is analogous to using ANOVA followed by non-linear regression.

## Generalized Linear Model

Instead of fitting a linear model using the lm() function, analysis of binary response data requires the use of a generalized linear model with the glm() function. For this example, the data set has mortality observations collected 21 days after treatment with six rates of imazamox with and without six different growth regulator herbicides.

```
rye.dat <- read.csv("http://rstats4ag.org/data/2012_RyeGH.csv")
rye.glm <- glm(mort.21dat ~ imaz.rate + gr, data = rye.dat, family = binomial(link = "logit"))
anova(rye.glm, test = "Chisq")
```

```
## Analysis of Deviance Table
##
## Model: binomial, link: logit
##
## Response: mort.21dat
##
## Terms added sequentially (first to last)
##
##
## Df Deviance Resid. Df Resid. Dev Pr(>Chi)
## NULL 430 465
## imaz.rate 1 93.5 429 371 < 2e-16 ***
## gr 7 31.2 422 340 5.8e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
```

Using anova() on the glm() fit results in an analysis of deviance table with a similar interpretation as an ANOVA table for continuous response data. Both the imazamox rate and growth regulator herbicide significantly affected the mortality of feral rye, which was the expected result. The drc package can be used to quantify the response of feral rye to imazamox in the presence and absence of the growth regulator herbicides.

```
library(drc)
rye.drc <- drm(mort.21dat ~ imaz.rate, gr, data = rye.dat, fct = LL.2(),
type = "binomial", na.action = na.omit)
```

```
## Control measurements detected for level: Control
```

```
summary(rye.drc)
```

```
##
## 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:None 1.314 0.527 2.493 0.01
## b:2,4-D amine 1.934 0.630 3.070 0.00
## b:2,4-D ester 1.830 0.454 4.034 0.00
## b:MCPA amine 2.007 0.680 2.952 0.00
## b:MCPA ester 1.163 0.347 3.350 0.00
## b:dicamba 2.380 0.792 3.004 0.00
## b:fluroxypyr 1.938 0.631 3.072 0.00
## e:None 97.741 48.666 2.008 0.04
## e:2,4-D amine 61.904 15.272 4.053 0.00
## e:2,4-D ester 25.552 4.806 5.316 0.00
## e:MCPA amine 66.100 16.644 3.971 0.00
## e:MCPA ester 28.586 7.850 3.641 0.00
## e:dicamba 62.041 12.765 4.860 0.00
## e:fluroxypyr 61.845 15.216 4.064 0.00
```

```
SI(rye.drc, c(50,50))
```

```
##
## Estimated ratios of effect doses
##
## Estimate Std. Error t-value p-value
## 2,4-D amine/2,4-D ester:50/50 2.42265 0.75160 1.89284 0.06
## 2,4-D amine/dicamba:50/50 0.99780 0.32054 -0.00687 0.99
## 2,4-D amine/fluroxypyr:50/50 1.00097 0.34876 0.00277 1.00
## 2,4-D amine/MCPA amine:50/50 0.93653 0.33015 -0.19224 0.85
## 2,4-D amine/MCPA ester:50/50 2.16554 0.79943 1.45798 0.14
## 2,4-D amine/None:50/50 0.63335 0.35194 -1.04180 0.30
## 2,4-D ester/dicamba:50/50 0.41186 0.11482 -5.12238 0.00
## 2,4-D ester/fluroxypyr:50/50 0.41317 0.12796 -4.58598 0.00
## 2,4-D ester/MCPA amine:50/50 0.38657 0.12150 -5.04867 0.00
## 2,4-D ester/MCPA ester:50/50 0.89387 0.29753 -0.35669 0.72
## 2,4-D ester/None:50/50 0.26143 0.13915 -5.30788 0.00
## dicamba/fluroxypyr:50/50 1.00318 0.32175 0.00987 0.99
## dicamba/MCPA amine:50/50 0.93860 0.30521 -0.20117 0.84
## dicamba/MCPA ester:50/50 2.17032 0.74473 1.57148 0.12
## dicamba/None:50/50 0.63475 0.34197 -1.06808 0.29
## fluroxypyr/MCPA amine:50/50 0.93563 0.32939 -0.19543 0.85
## fluroxypyr/MCPA ester:50/50 2.16345 0.79769 1.45853 0.14
## fluroxypyr/None:50/50 0.63274 0.35141 -1.04510 0.30
## MCPA amine/MCPA ester:50/50 2.31230 0.86153 1.52323 0.13
## MCPA amine/None:50/50 0.67627 0.37733 -0.85793 0.39
## MCPA ester/None:50/50 0.29247 0.16630 -4.25452 0.00
```

Please note that the test for significant relative potency is not a null hypothesis, but that the relative potency SI is different from unity.

```
plot(rye.drc, legendPos=c(10,0.6), col=T, xt=unique(rye.dat$imaz.rate),
broken=T, bp=1.5, xlim=c(0,300),xlab="Imazamox rate", ylab="Probability of survival 21 DAT")
```