This is a simple demonstration of the R package LW1949, which automates the manual approach to evaluating dose-effect experiments described by Litchfield and Wilcoxon (1949). Use of LW1949 saves time and yields the best Litchfield Wilcoxon model fit possible, by minimizing the chi-squared statistic.
You can give it a try here, by providing information on three key inputs (on the left): the chemical concentration or dose, the number tested, and the number affected. Effective doses will be estimated for the specified percentages affected (on the right).
# Shinyapps.io automatically finds this package on GitHub! require(LW1949)
# read in the data mydat <- reactive({ dose <- c(input$dose1, input$dose2, input$dose3, input$dose4, input$dose5, input$dose6, input$dose7, input$dose8, input$dose9, input$dose10) ntot <- c(input$ntot1, input$ntot2, input$ntot3, input$ntot4, input$ntot5, input$ntot6, input$ntot7, input$ntot8, input$ntot9, input$ntot10) nfx <- c(input$nfx1, input$nfx2, input$nfx3, input$nfx4, input$nfx5, input$nfx6, input$nfx7, input$nfx8, input$nfx9, input$nfx10) sel <- !is.na(dose) & !is.na(ntot) & !is.na(nfx) if (sum(sel) < 1) stop("No dose effect data entered.") if (any(ntot[sel] < 0)) stop("No. tested should be greater than zero.") if (any(ntot[sel] < nfx[sel])) stop("No. affected should not be greater than No. tested.") dataprep(dose[sel], ntot[sel], nfx[sel]) }) # fitted LW model fLW <- reactive({ LWestimate(fitLWauto(mydat()), mydat()) }) # % affected pctaffected <- reactive({ pa <- c(input$pa1, input$pa2, input$pa3) sel <- !is.na(pa) if (sum(sel) < 1) stop("No % Affected values entered.") if (any(pa[sel] < 0.001) | any(pa[sel] > 99.999)) stop("% Affected should be between 0.001 and 99.999.") pa[sel] }) # predicted predLW <- reactive({ predlinear(pctaffected(), fLW()) })
# plot of dose vs. % affected, log scale output$onePlot <- renderPlot( { par(mar=c(4, 4, 1, 1), cex=1.5) plotDELP(mydat()) predLinesLP(fLW()) y <- probit(predLW()[, "pct"]/100) arrows(log10(predLW()[, "lower"]), y, log10(predLW()[, "ED"]), y, length=0.1, angle=90, code=3, col="red") arrows(log10(predLW()[, "ED"]), y, log10(predLW()[, "upper"]), y, length=0.1, angle=90, code=3, col="red") }, width=700, height=700, )
# plot of dose vs. % affected, arithmetic scale output$twoPlot <- renderPlot( { par(mar=c(4, 4, 1, 1), cex=1.5) plotDE(mydat(), ref=NA) predLines(fLW()) y <- predLW()[, "pct"] arrows(predLW()[, "lower"], y, predLW()[, "ED"], y, length=0.1, angle=90, code=3, col="red") arrows(predLW()[, "ED"], y, predLW()[, "upper"], y, length=0.1, angle=90, code=3, col="red") }, width=700, height=700, )
# table of predicted output$oneTable <- renderTable( { predLW() }, digits=c(2, 3, 3, 3, 3) )
fluidPage( fluidRow( column(2, numericInput("dose1", "Dose", value=0.0625), numericInput("dose2", NULL, value=0.125), numericInput("dose3", NULL, value=0.25), numericInput("dose4", NULL, value=0.5), numericInput("dose5", NULL, value=1.0), numericInput("dose6", NULL, value=NA), numericInput("dose7", NULL, value=NA), numericInput("dose8", NULL, value=NA), numericInput("dose9", NULL, value=NA), numericInput("dose10", NULL, value=NA) ), column(2, numericInput("ntot1", "No. tested", value=8), numericInput("ntot2", NULL, value=8), numericInput("ntot3", NULL, value=8), numericInput("ntot4", NULL, value=8), numericInput("ntot5", NULL, value=8), numericInput("ntot6", NULL, value=NA), numericInput("ntot7", NULL, value=NA), numericInput("ntot8", NULL, value=NA), numericInput("ntot9", NULL, value=NA), numericInput("ntot10", NULL, value=NA) ), column(2, numericInput("nfx1", "No. affected", value=1), numericInput("nfx2", NULL, value=4), numericInput("nfx3", NULL, value=4), numericInput("nfx4", NULL, value=7), numericInput("nfx5", NULL, value=8), numericInput("nfx6", NULL, value=NA), numericInput("nfx7", NULL, value=NA), numericInput("nfx8", NULL, value=NA), numericInput("nfx9", NULL, value=NA), numericInput("nfx10", NULL, value=NA) ), column(2), column(2, numericInput("pa1", label="% Affected", value=25), numericInput("pa2", label=NULL, value=50), numericInput("pa3", label=NULL, value=99.9) ) ), fluidRow( plotOutput("onePlot", inline=TRUE), h5("FIGURE 1. - Plot of the observed data with the Litchfield Wilcoxon fitted model on the log10-probit scale. Predicted effective doses with 95% confidence intervals for the specified percentages affected are in red. Observations with 0% or 100% affected are plotted at 0.1 and 99.9% respectively using white filled circles.") ), fluidRow( plotOutput("twoPlot", inline=TRUE), h5("FIGURE 2. - Plot of the observed data with the Litchfield Wilcoxon fitted model on the arithmetic scale. Predicted effective doses with 95% confidence intervals for the specified percentages affected are in red. Observations with 0% or 100% affected are shown as white filled circles.") ), fluidRow( h5("TABLE 1. - Predicted effective doses (with 95% confidence intervals) for the specified percentages affected using the Litchfield Wilcoxon approach."), tableOutput("oneTable") ) )
Adams, J. V., K. S. Slaght, and M. A. Boogaard. 2016. An automated approach to Litchfield and Wilcoxon's evaluation of dose-effect experiments using the R package LW1949. Environmental Toxicology and Chemistry 35(12):3058-3061. DOI 10.1002/etc.3490
Litchfield, J. T. Jr. and F. Wilcoxon. 1949. A simplified method of evaluating dose-effect experiments. Journal of Pharmacology and Experimental Therapeutics 96(2):99-113.
LW1949. An automated approach (R package) to Litchfield and Wilcoxon's (1949) evaluation of dose-effect experiments. Available on Cran, with the latest development version on GitHub.
Last modified: 19 March 2017
Author: Jean V. Adams, USGS - Great Lakes Science Center and Great Lakes Fishery Commission
Created with: R Shiny by Rstudio
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.