# Calculate PK param. using TIBCO Spotfire?

Somedays ago,my colleague asked me how to calculate PK parameters in TIBCO Spotfire ?
Hmm. That’s sounds difficult, because Spotfire is not tool for analyse DMPK data.
But, there are some packages in CRAN for DMPK. So I thought that using TERR, some PK params could calculate.
Let’s do it. 😉
At first I installed ‘PK’ packages from source into TERR.

To install ‘PK’ package, is easy.
2nd step launch TERR command prompt, and type “install.packages(‘PK’)”
That’s all !
If successful, you can call PK package using ‘liblary(‘PK’)’

Next, register data-function to spotfire.
# I wrote in my MAC BOOK(not installed spotfire), so there are no screen shot. #
Following function is very simple. The function calculate AUC, MRT, etc. using non-compartmental estimation.
I named following function ‘pk_nan’.

```library('PK')
res <- nca(conc, time, n.tail=3, dose=0, method="z", conf.level=0.95,nsample=1000, design="ssd" )
result <- data.frame( res\$CIs )
result[' name '] <- row.names(result)
```

And set input data …
conc => column( real )
time => column( real )
Also set output data …
result => datatable # that means user can get data as new data table.

Finally run test.
Prepare data sample csv or excel format and load data to spotfire.
e.g.
time 1, 1, 2, 2, 4, 4, 8, 8, 24, 24
conc 2790, 3280, 4980, 7550, 5500, 6650, 2250, 3220, 213, 636

Then insert data function..
May new datatable has following data.
est
95% CI for the AUC to tlast using a z distribution 5.988600e+04
95% CI for the AUC to infinity using a z distribution 6.301882e+04
95% CI for the AUMC to infinity using a z distribution 4.918245e+05
95% CI for the Mean residence time using a z distribution 7.804406e+00
95% CI for the non-compartmental half-life using a z distribution 5.409602e+00
95% CI for the Clearance using a z distribution 0.000000e+00
95% CI for the Volume of distribution at steady state using a z distribution 0.000000e+00
….

Summary.
Tibco spotfire can calculate PK param indirectly using TERR.
I’m not charge of DMPK, and I think winnonline or another tools are used DMPK analysis.
This usage is limited for test.