Commit 618483fd authored by Vallo Varik's avatar Vallo Varik
Browse files

Add plot

parent d09ac955
......@@ -32,7 +32,7 @@ str(ryegrass)
?ryegrass
```
The workhorse of the `drc` is function `drm` (Dose-Response Model) and it works pretty similarly to `lm` which we used to fit linear model. The only new thing is `fct` argument. `fct` defines the exact function to be used and some sane initial values for parameters. For four parameter logistic regression, we need to set `fct = LL.4` (log-logistic with 4 parameters, the extra "log" is just to denote that x-axis is in log scale; there is alos LL.3 for instance, this sets slope to be 1).
The workhorse of the `drc` is function `drm` (Dose-Response Model) and it works pretty similarly to `lm` which we used to fit linear model. The only new thing is `fct` argument. `fct` defines the exact function to be used and some sane initial values for parameters. For four parameter logistic regression, we need to set `fct = LL.4` (log-logistic with 4 parameters, the extra "log" is just to denote that x-axis is in log scale; there is also LL.3 for instance, this sets slope to be 1).
```{r}
mod = drm(rootl ~ conc, data = ryegrass, fct = LL.4())
......@@ -47,14 +47,17 @@ mod = drm(rootl ~ conc, data = ryegrass,
plot(mod, type = 'all')
```
We can get a summary of the model parameters using the `summary` function and
calculate the IC~10~ (dose that gives 10% of effect), IC~20~, IC~50~, IC~90~
etc with the `ED` function.
![](tasks/drm_ryegrass.png)
We can get a summary of the model parameters using the `summary` function
```{r}
summary(mod)
```
We can calculate the IC~10~ (dose that gives 10% of effect), IC~20~, IC~50~,
IC~90~ etc with the `ED` function.
```{r}
#interval = "delta" gives confidence intervals at a default 95% level.
ED(mod, c(10,20,50, 90), interval="delta")
......
......@@ -29,7 +29,7 @@ only new thing is `fct` argument. `fct` defines the exact function to be
used and some sane initial values for parameters. For four parameter
logistic regression, we need to set `fct = LL.4` (log-logistic with 4
parameters, the extra “log” is just to denote that x-axis is in log
scale; there is alos LL.3 for instance, this sets slope to be 1).
scale; there is also LL.3 for instance, this sets slope to be 1).
mod = drm(rootl ~ conc, data = ryegrass, fct = LL.4())
......@@ -44,10 +44,10 @@ explain four-parameter logistic regression:
![](drc_files/figure-markdown_strict/unnamed-chunk-4-1.png)
![](tasks/drm_ryegrass.png)
We can get a summary of the model parameters using the `summary`
function and calculate the IC<sub>10</sub> (dose that gives 10% of
effect), IC<sub>20</sub>, IC<sub>50</sub>, IC<sub>90</sub> etc with the
`ED` function.
function
summary(mod)
......@@ -68,6 +68,10 @@ effect), IC<sub>20</sub>, IC<sub>50</sub>, IC<sub>90</sub> etc with the
##
## 0.5196256 (20 degrees of freedom)
We can calculate the IC<sub>10</sub> (dose that gives 10% of effect),
IC<sub>20</sub>, IC<sub>50</sub>, IC<sub>90</sub> etc with the `ED`
function.
#interval = "delta" gives confidence intervals at a default 95% level.
ED(mod, c(10,20,50, 90), interval="delta")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment