tData = Theoph
colnames(tData) = c("ID", "BWT", "DOSE", "TIME", "DV") # Table requires DV column
fPK = function(THETA) # Prediction function
{
AMT = 320000 # in microgram
TIME = e$DATA[,"TIME"]
V = THETA[1]
K = THETA[2]
Ka = THETA[3]
Cp = AMT/V*Ka/(Ka - K)*(exp(-K*TIME) - exp(-Ka*TIME))
return(Cp)
}
Data = tData[tData$ID == 1,]
Res = nlr(fPK, Data, pNames=c("V", "K", "Ka"), IE=c(30000, 0.1, 2))
Secondary(~V*K, Res$Est["PE",1:e$nPara], Res$Cov)
Run the code above in your browser using DataLab