uupharmacometrics / ncappc Goto Github PK
View Code? Open in Web Editor NEWNCA Calculation and Population PK Model Diagnosis
NCA Calculation and Population PK Model Diagnosis
Hi, I did several tests and found that there are several issues in the calculation of steady-state PK parameters (doseType = "ss"):
The time t in the calculation of AUC0-t and AUMC0-t is based on the closet time to the Tau, instead of the largest one. For example, if I had sample with time of 72 h and 192 h (24 h after scheduled 168 h), and I define Tau as 168 h, then the AUC0-t is calculated as AUC0-192h. However, if the patients had a unschuduled visit at 150 h (-14 h compared with Tau which is the closest), then the AUC0-t is calculated as AUC 0-150h. It could be better to always use the largest time provided to calculate AUC0-t and AUMC0-t.
The AUC or AUMC0-tau is based on Tau and AUC or AUMC 0-t through extrapolation. However, if the time point of last sample is greater than Tau (and is closest to Tau), then the AUC or AUMC0-Tau is equal to AUC or AUMC0-t, instead of intrapolation based on AUC or AUMC0-t.
It seemed that only the extrapolation from time point smaller the Tau worked well. In the former scenario where the last time point is greater than Tau (and is closest to Tau), the calculation of MRT as well as CLss would be not accurate, since the AUC0-tau and AUMC0-tau are not appropriately calculated, although AUC0-tau itself could be alternatively calculated using option AUCTimeRange.
Hello,
I am using ncappc package for the first time today.
I am able to run nca based diagnostics using ncappc() command for default extravascular model. However, my model is iv-bolus and when I change to adminType to "iv-bolus", I am getting error message that "MRTINF_obs" not found. Is there a way to turn that off? I do not need MRTINF_obs as parameter. I just need half-life evaluations.
Do you have any suggestions what might be the issue?
thanks,
Krina
Hello,
When i use the function ncappc, i have this error : "Error in est.nca(time = .$time, conc = .$conc, backExtrp = backExtrp, : object 'CR1' not found"
The problem may be in this code, in the last two lines, nconc shouldn't take the value of CR2 (instead of CR1) and ntime the value of TR2 ?
if(!TR2%in%ntime){
if(TR2<=Tlast & length(ntime[ntime<TR2])!=0 & length(ntime[ntime>TR2])!=0){
# If the end time falls within the range of the data but does not coincide with an observed data point
Intpol21 <- TRUE
ind1 <- tail(which(ntime==max(ntime[ntime<TR2])),1) # index just below time interpolation point
ind2 <- head(which(ntime==min(ntime[ntime>TR2])),1) # index just above time interpolation point
c1 <- nconc[ind1]; t1 <- ntime[ind1] # conc and time just below time interpolation point
c2 <- nconc[ind2]; t2 <- ntime[ind2] # conc and time just above time interpolation point
if(method=="linear" | (method=="linearup-logdown" & c2>=c1)) CR2 <- c1 + abs((TR2-t1)/(t2-t1)) * (c2-c1)
if(method=="log" | (method=="linearup-logdown" & c2<c1)) CR2 <- exp(log(c1) + abs((TR2-t1)/(t2-t1)) * log(c2/c1))
nconc <- c(nconc, CR2)
ntime <- c(ntime, TR2)
}else if(TR2>Tlast & exists("lastPt") & exists("Lambda_z")){
Intpol22 <- TRUE
CR2 <- lastPt * exp(-Lambda_z * (TR2-Tlast))
CR2 <- ifelse(CR2==0, 0.0001, CR2)
nconc <- c(nconc, CR1)
ntime <- c(ntime, TR1)
}
}
Thanks,
Angelina
Hi, I was using the est.nca function and calculating AUClast. I noticed that when the slope of first two concentrations are positive, the area under 0-t1 is not summed in the final AUClast result. I looked into the original code, and found this is due to line 263 and 264๏ผ
nconc <- c(C0, nconc) # extrapolation via log-linear regression
ntime <- c(0, ntime)
This is only performed for slope <0 conditions.
Is this exclusion of 0-t1 area when slope > 0 on purpose? Thank you!
Best
Kevin
In read_nm_table
/read_nm_tab_readr_1
~line 11 strsplit
does not replace ",". This means space separated header row is needed for comma separated file. It would be nice if table titles could be removed only if present.
library(ncappc)
# fake data
colnames(Theoph) <- c("ID", "WT", "DOSE", "TIME", "DV")
TheophSim <- rbind(
cbind(Theoph, NSUB = 1),
cbind(Theoph, NSUB = 2))
TheophSim$DV <- TheophSim$DV + rnorm(n = nrow(TheophSim))
# fake sim file comma separated
cat("Table 1\n", file = "theo_sim.tab")
suppressWarnings(write.table(TheophSim, file = "theo_sim.tab",
append = TRUE, sep = ",",
row.names = FALSE, quote = FALSE))
# in read_nm_table/read_nm_tab_readr_1 ~line 11
# strsplit does not replace ","
ncappc(
obsFile = Theoph,
simFile = "theo_sim.tab",
noPlot = TRUE,
printOut = FALSE,
psnOut = FALSE)
When conducting NCA, one subject has identical concentration values at 1 and 4 hours, which also are the highest concentration in this subject. Is there a way to choose which value is chosen for Cmax (e.g. at the lowest or highest time)?
When tabCol is single value in ncappc
, nca.npde
drops columns, resulting in only first record from being retained.
At ~line 18, replace npde[, pdecol]
with npde[, pdecol, drop = FALSE]
in call to lapply
.
# basic case
# 0, -0.841621233572914, -0.2533471031358,
# 0.2533471031358, 0.841621233572914, 0)
res <- nca.npde(pdedata = data.frame(A = (0:5)/5, B = 1), pdecol = c("A", "B"))
res$npdeA
# [1] 0.0000000 -0.8416212 -0.2533471 0.2533471 0.8416212 0.0000000
# single column
res <- nca.npde(pdedata = data.frame(ID = 1, A = (0:5)/5), pdecol = "A")
res$npdeA
# [1] 0 0 0 0 0 0
Documentation states that simFile may be internal data.frame. This case is not supported.
# fake simulated data
colnames(Theoph) <- c("ID", "WT", "DOSE", "TIME", "DV")
TheophSim <- rbind(
cbind(Theoph, REP = 1),
cbind(Theoph, REP = 2))
TheophSim$DV <- TheophSim$DV + rnorm(n = nrow(TheophSim))
# run analysis
ncappc::ncappc(
obsFile = Theoph,
simFile = TheophSim,
noPlot = TRUE,
printOut = FALSE,
psnOut = FALSE)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.