Author: Zhian N. Kamvar
Date: 2026-03-09

# Getting Started with EZEC

#### Zhian N. Kamvar

#### 2026-03-09

# Welcome

## Introduction

The package EZEC stands for Easy Effective Concentration. This package was designed to be a simple wrapper for the functions `drm()` and `ED()` in the drc package. It provides the function `EC_table()` that will first fit a model to your data and then calculate effective concentrations from that model over several samples arranged in a data frame. In this tutorial, I will give a couple of short examples of how you can analyze your data. To get help with any functions in the package, simply type `help("function.name")` and replace function.name with the name of the function you want help for.

## Credit

As this package is simply a wrapper to two functions from the drc package, please cite the drc package and indicate the version number you used:

    packageVersion("drc")

    ## [1] '3.0.1'

    citation("drc")

    ## To cite the package 'drc' in publications:
    ##
    ##   Ritz, C., Baty, F., Streibig, J. C., Gerhard, D. (2015) Dose-Response
    ##   Analysis Using R PLOS ONE, 10(12), e0146021
    ##
    ## A BibTeX entry for LaTeX users is
    ##
    ##   @Article{,
    ##     title = {Dose-Response Analysis Using R},
    ##     author = {C. Ritz and F. Baty and J. C. Streibig and D. Gerhard},
    ##     journal = {PLOS ONE},
    ##     volume = {10},
    ##     issue = {12},
    ##     number = {e0146021},
    ##     year = {2015},
    ##     url = {http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0146021},
    ##   }

# Data Format

Your data must be in a format that encodes one observation per row. You can see an example of this in the `dummydata` data set:

    library("ezec")
    data("dummydata", package = "ezec")
    head(dummydata) # the function head means "look at the top of the object"

    ##        ID strain      fung dose rep response
    ## 1 Sample1      a Metalaxyl  0.0   1      1.5
    ## 2 Sample1      a Metalaxyl  0.0   2      1.0
    ## 3 Sample1      a Metalaxyl  0.1   1      0.5
    ## 4 Sample1      a Metalaxyl  0.1   2      1.0
    ## 5 Sample1      a Metalaxyl  1.0   1      0.5
    ## 6 Sample1      a Metalaxyl  1.0   2      0.5

You can see that this contains the columns ID, strain, fung, dose, rep, response. The only important columns here are the ID, dose, and response columns.

To import your own data from csv text file, you should use the function `read.table()` to import it into R. If you want to import data from an xlsx file, you can use the function `read_excel()` from the readxl package.

# Data Analysis

You can analyze your data simply by running `EC_table()` with your data and supplying a formula to describe what you want to analyze in the form of `response_variable ~ explanitory_variable`. In our example of “dummydata”, our response variable is “response” and our explanitory variable is “dose”.

    library("ezec")
    data("dummydata", package = "ezec")
    res <- EC_table(dummydata, form = response ~ dose)

    print(res)

    ##    sample  Estimate.10        SE.10 Estimate.50      SE.50 Estimate.90    SE.90
    ## 1 Sample1 0.0009539812 0.0011786368  0.08287674 0.04098527    7.199884 5.060795
    ## 2 Sample2 0.0006601386 0.0008750109  0.09240879 0.04713886   12.935744 9.767668

If you want to have all the plots plotted in one window, you can use the `par()` function:

    par(mfrow = c(1, 2)) # set window to have 1 row and two columns
    EC_table(dummydata, form = response ~ dose)

    ##    sample  Estimate.10        SE.10 Estimate.50      SE.50 Estimate.90    SE.90
    ## 1 Sample1 0.0009539812 0.0011786368  0.08287674 0.04098527    7.199884 5.060795
    ## 2 Sample2 0.0006601386 0.0008750109  0.09240879 0.04713886   12.935744 9.767668

    par(mfrow = c(1, 1)) # reset the window

## Saving your results to a file

If you want to save your results to a file that you can format for a manuscript, you can use the `write.table()` functon:

    write.table(res, file = "dummy_results.csv", row.names = FALSE, sep = ",")

## Output: model summary

You can also have the output be a summary of the model for each sample as a list

    EC_table(dummydata, form = response ~ dose, plot = FALSE, result = "summary")

    ## $Sample1
    ##
    ## Model fitted: Log-logistic (ED50 as parameter) with lower limit at 0 (3 parms)
    ##
    ## Parameter estimates:
    ##
    ##                         Estimate Std. Error t-value   p-value
    ## Slope:(Intercept)       0.492158   0.096463  5.1020 6.545e-06 ***
    ## Upper Limit:(Intercept) 1.556544   0.084577 18.4038 < 2.2e-16 ***
    ## ED50:(Intercept)        0.082877   0.040985  2.0221   0.04913 *
    ## ---
    ## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
    ##
    ## Residual standard error:
    ##
    ##  0.2379276 (45 degrees of freedom)
    ##
    ## $Sample2
    ##
    ## Model fitted: Log-logistic (ED50 as parameter) with lower limit at 0 (3 parms)
    ##
    ## Parameter estimates:
    ##
    ##                         Estimate Std. Error t-value   p-value
    ## Slope:(Intercept)       0.444645   0.085522  5.1992 4.726e-06 ***
    ## Upper Limit:(Intercept) 1.607358   0.083651 19.2151 < 2.2e-16 ***
    ## ED50:(Intercept)        0.092409   0.047139  1.9604   0.05616 .
    ## ---
    ## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
    ##
    ## Residual standard error:
    ##
    ##  0.2355344 (45 degrees of freedom)

## Output: model

You can also choose to have the output be the model itself

    EC_table(dummydata, form = response ~ dose, plot = FALSE, result = "model")

    ## $Sample1
    ##
    ## A 'drc' model.
    ##
    ## Call:
    ## drc::drm(formula = form, data = x, fct = MODEL(names = mod.names),     na.action = na.omit)
    ##
    ## Coefficients:
    ##       Slope:(Intercept)  Upper Limit:(Intercept)         ED50:(Intercept)
    ##                 0.49216                  1.55654                  0.08288
    ##
    ##
    ## $Sample2
    ##
    ## A 'drc' model.
    ##
    ## Call:
    ## drc::drm(formula = form, data = x, fct = MODEL(names = mod.names),     na.action = na.omit)
    ##
    ## Coefficients:
    ##       Slope:(Intercept)  Upper Limit:(Intercept)         ED50:(Intercept)
    ##                 0.44464                  1.60736                  0.09241