Coder Social home page Coder Social logo

tsk's Introduction

Notice

You probably want to use the ecotoxicology package instead of this.

tsk

Trimmed Spearman-Karber Method. A simple nonparametric method to determine median effective doses (LD50, etc.) from dose-response curves. This package is based on the paper by Hamilton et al (1977, 1978).

To install, just type this in your R session:

install.packages("devtools")
install.packages("isotone")
devtools::install_github(repo="brsr/tsk")

The package contains one function, tsk. Type ?tsk in your R terminal for detailed help on the function. An example:

> tsk( c(1, 10, 100, 1000), 20, c(0, 3, 17, 20) )
$use.log.doses
calculations done using the logs of the doses? 
                                          TRUE 
$trim
[1] 0
$was.smoothed
[1] FALSE
$LD50
[1] 31.62278
$gsd
geometric standard deviation of LD50 estimate 
                                     1.296928 
$conf.int
[1] 18.99717 52.63942
attr(,"conf.level")
[1] 0.95

This code was written several years ago. It runs and produces valid results, but may not be written in a contemporary R idiom.

This package was formerly located at https://r-forge.r-project.org/projects/tskarber/ . The R-forge project is being kept around to direct any existing users here. Any future updates will happen on Github.

Citations

Hamilton, M. A.; Russo, R. C.; Thurston, R. V. Trimmed Spearman-Karber Method for Estimating Median Lethal Concentrations in Toxicity Bioassays. Enviro. Sci. Tech. 1977, 11 (7), 714-719. http://dx.doi.org/10.1021/es60130a004

Ibid, 1978, 12 (4), 417. http://dx.doi.org/10.1021/es60140a017

tsk's People

Contributors

brsr avatar

Watchers

 avatar

Forkers

thanhkhiet84

tsk's Issues

Is it possible to perform Abbott's correction before smooth the data using the PAVA algorithm?

Dear Brenton,

I got two questions here:

First of all, in tsk::tsk(), you smooth the data (of course only when the data do not show monotonically increasing trend) before doing the Abbott's correction of the control response (when control response is not 0). Shouldn't the Abbott's correction be done before smoothing?

In tsk::tsk(), smoothing using gpava() will sometimes result in a smoothed control p different from the original control p.

# Correct for the control dose.
  data.smoothed$p <- (data.smoothed$p-control)/(1-control)

Then you correct the smoothed data with the original control p based on Abbott's formula. It will not normalize the smoothed corrected control p to 0, likely leading to biases in the results.

Secondly, in the ecotoxicology::TSK(), after Abbott's correction, sample size (n) for all groups is also corrected to n_i_-r[1], where ni is the sample size of each test group, r[1] is the number of original control response. I am not sure if it is correct to do this sample size correction, but would like to hear your opinion. Thank you very much!

n vs n-1 in variance estimation

Received by e-mail in February from Dr. Jerry Lewis:

Variance of m is calculated by noting that within each dose, the number of responders, X, is distributed binomial(n,P), where P is a monotonic function of dose. But, as noted in all editions of Finney (Statistical Method in Biological Assay), while p = X/n is unbiased for P, E[ p_(1-p)/n ] < P_(1-P)/n. You need p_(1-p)/(n-1) for unbiased estimation of P_(1-P)/n, which Finney used in his worked Karber example (omitted from 3rd ed). Without this modification, the Karber intervals seem too narrow when compared to the 50% horizontal slice through intervals from generalized linear models.

The original goal of this package was to replicate a program that used $n$ in the variance estimate, so that's what the current state is. It would be reasonable to add an option to use $n-1$ instead, but I can't determine what needs to be changed in the variance calculation from Dr Lewis's email alone, since there are multiple different $n$s that appear.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.