Trimmed Spearman_karber Method using r for dose response analysis - Help needed!!!

#1
Please could anyone show me how to go about using r to LC50 and Confidence intervals with Trimmed Spearman-Karber method? I have had several go at the codes provided online (e.g, shown below) but couldn't make any progress. I loaded the package "drc" on r and yet couldn't find my way in using this method.

Would appreciate if someone could give me a clue on how to use r for it with this simple data:

Dose Subject Response
1 20 0
10 20 3
100 19 17
1000 20 18


tsk( c(1, 10, 100, 1000), 20, c(0, 3, 17, 20) )
dr <- data.frame( x=c(1, 10, 100, 1000), n=c(20, 20, 19, 20),
r=c(0, 3, 17, 18) )
tsk( dr, 0, 0.1, 0.99 )

data(hamilton)
tsk(hamilton$dr1a)


hamilton: Example dose-response curves from Hamilton (1977)
tsk: Trimmed Spearman-Karber Method


Thank you.
 

ledzep

Point Mass at Zero
#2
Re: Trimmed Spearman_karber Method using r for dose response analysis - Help needed!!

You need to install the tsk package first.
Code:
install.packages("tsk", repos="http://R-Forge.R-project.org")
require(tsk)
require(drc)
Now running your code, it worked fine for me.

Code:
#--------------
# Example 1
#--------------
tsk( c(1, 10, 100, 1000), 20, c(0, 3, 17, 20) )

Trimmed Spearman-Karber method using 0 percent trim

Data was not smoothed
Calculation done using the logs of the doses
Estimated LD50: 31.62278        GSD of estimate: 1.296928
95 percent confidence interval on LD50:
 18.99717 52.63942 

#--------------
# Example 2
#--------------
dr <- data.frame( x=c(1, 10, 100, 1000), n=c(20, 20, 19, 20), 
+ r=c(0, 3, 17, 18) )

tsk( dr, 0, 0.1, 0.99 )

Trimmed Spearman-Karber method using 10 percent trim

Data was not smoothed
Calculation done using the logs of the doses
Estimated LD50: 29.16838        GSD of estimate: 1.332339
99 percent confidence interval on LD50:
 13.92918 61.07998 

#--------------
# Example 3
#--------------
data(hamilton)
tsk(hamilton$dr1a)

Trimmed Spearman-Karber method using 0 percent trim

Data was not smoothed
Calculation done using the logs of the doses
Estimated LD50: 43.89387        GSD of estimate: 1.017758
95 percent confidence interval on LD50:
 42.40538 45.43460
HTH
 
#3
Re: Trimmed Spearman_karber Method using r for dose response analysis - Help needed!!

Hi ledzep,

Thank you for the answer. But I got a problem running it on my r. When I tried to install the package (tsk) using the link you gave me, below are what I got as a feedback:


Installing package into 'C:/Users/kingmax/Documents/R/win-library/3.2'
(as 'lib' is unspecified)
also installing the dependency 'isotone'

Package which is only available in source form, and may need compilation
of C/C++/Fortran: 'isotone'
These will not be installed
installing the source package 'tsk'

trying URL 'http://R-Forge.R-project.org/src/contrib/tsk_1.1.tar.gz'
Content type 'application/x-gzip' length 5740 bytes
downloaded 5740 bytes

ERROR: dependency 'isotone' is not available for package 'tsk'
* removing 'C:/Users/kingmax/Documents/R/win-library/3.2/tsk'
Warning: running command '"C:/PROGRA~1/R/R-32~1.1/bin/i386/R" CMD INSTALL -l "C:\Users\kingmax\Documents\R\win-library\3.2" C:\Users\kingmax\AppData\Local\Temp\RtmpGg5kxa/downloaded_packages/tsk_1.1.tar.gz' had status 1
Warning in install.packages("tsk", repos = "http://R-Forge.R-project.org") :
installation of package 'tsk' had non-zero exit status

The downloaded source packages are in
'C:\Users\kingmax\AppData\Local\Temp\RtmpGg5kxa\downloaded_packages'
> require(drc)
> require(tsk)
Loading required package: tsk
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
there is no package called 'tsk'

Could you please advise me on what to do to get it installed and running or do I need a particular version? My versio is R-3.2.1

Thanks.
 
#4
Re: Trimmed Spearman_karber Method using r for dose response analysis - Help needed!!

See reply I got from R

> require(tsk)
Loading required package: tsk
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
there is no package called 'tsk'
 

ledzep

Point Mass at Zero
#5
Re: Trimmed Spearman_karber Method using r for dose response analysis - Help needed!!

I am not sure why it aint working for you.
Here's my session information on R. Works fine with R 3.2.0 for me.

Code:
>sessionInfo ()

R version 3.2.0 (2015-04-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] drc_2.5-12    MASS_7.3-40   tsk_1.1       isotone_1.0-2

loaded via a namespace (and not attached):
 [1] Rcpp_0.11.6      splines_3.2.0    munsell_0.4.2    colorspace_1.2-6
 [5] lattice_0.20-31  multcomp_1.4-0   minqa_1.2.4      plyr_1.8.3      
 [9] car_2.0-25       tools_3.2.0      nnet_7.3-9       parallel_3.2.0  
[13] pbkrtest_0.4-2   grid_3.2.0       nlme_3.1-120     mgcv_1.8-6      
[17] quantreg_5.11    plotrix_3.5-12   TH.data_1.0-6    gtools_3.5.0    
[21] survival_2.38-1  lme4_1.1-7       Matrix_1.2-1     nloptr_1.0.4    
[25] codetools_0.2-11 sandwich_2.3-3   scales_0.2.5     SparseM_1.6     
[29] mvtnorm_1.0-2    zoo_1.7-12
What happens when you run this line of code?
Code:
install.packages("tsk", repos="http://R-Forge.R-project.org")
 

hlsmith

Not a robit
#6
Re: Trimmed Spearman_karber Method using r for dose response analysis - Help needed!!

Just curious of what the purpose of the procedure is? 10,000 foot view!
 
#7
Re: Trimmed Spearman_karber Method using r for dose response analysis - Help needed!!

Hi Ledzep,

Thank you so much for this.

I followed the clue provided by your R session information. I had to install MASS and Isotone because the "tsk" installation was failing due to no "Isotone" ( if you looked at the output I provided above). However, the tsk is working fine now and I am trying out examples to be sure.

Thank you Ledzep
 

ledzep

Point Mass at Zero
#8
Re: Trimmed Spearman_karber Method using r for dose response analysis - Help needed!!

Just curious of what the purpose of the procedure is? 10,000 foot view!
It is another way of estimating the mid-point of the dose-response curve. Traditionally, all sorts of logit models or probit models (e.g. 3 Parameter logistic, 4 parameter logistic etc) are used in order to estimate this.
In the example given by OP, the interest is in estimating the LC50, which is the lethal concentration which kills 50% of the subjects. Trimmed Spearman Karber method should overcome some of the limitations associated with logit and probit dose response models.
This paper proposes the Trimmed Spearman Karber method and discusses the statistical properties.
http://www.math.montana.edu/~jimrc/classes/stat524/notes/TrimmedSpearmanKarber.pdf

HTH