RE: RE: VPC for non-uniform sampling

From: Diane Wang Date: January 14, 2012 technical Source: mail-archive.com
Dear Markus, 1. Here is the publication info. Diane D. Wang and Shuzhong Zhang, "Standardized Visual Predictive Check Versus Visual Predictive Check for Model Evaluation", J Clin Pharmacol January 2012 52: 39-54, first published on January 21, 2011 doi:10.1177/0091270010390040 The R code is in the supplemental material which is only available online. I was trying be send the R code out as an attachment in my last email but nmuser does not take attachment. Below is the R code and I will also send you a copy of the article and R code in a separate email. Please note that the editor used a wrong version of the manuscript for publication (a wrong example was used for simulation study 5). This will be addressed in the future. ########## A sample R code for conducting SVPC #------- Define functions percentile = function (x){ percent = quantile (x, probs = c(0.05, 0.5, 0.95), na.rm = T) } percent.matrix = function (x){ p = NULL for (i in 1:length(x)){ p = rbind(p, x[[i]]) } return (p) } SVPC = function(ori, sim){ n.of.sim = length(sim$ID)/length(ori$ID) sim$OBS = rep(ori$DV, n.of.sim) sim$IND = rep(0, length(sim$ID)) sim[sim$DV <= sim$OBS, "IND"] = 1 rank = tapply(sim$IND, list(sim$ID, sim$TIME), sum) Pij = c() for (i in 1:length(rank[,1])){ Pij = c(Pij, rank[i, ]) } return (Pij/n.of.sim) } #---Import original nonmem PK dataset (pk.csv) and simulated PK dataset (simu.tab) #---Reorganize both datasets so that they only contain event records that are relevant #---for SVPC (for example: removing all dosing records) #---Both datasets should have "ID", "TIME" and "DV" column variables defined as such setwd("c:/...") ori.data = read.table(file="pk.csv", header=T, sep=",") ori = ori.data[ori.data$AMT==0, c("ID", "TIME", "DV")] sim.data = read.table(file="pk_svpc.tab", sep="") name=names(ori.data) names(sim.data) = name sim = sim.data[sim.data$AMT== 0, c("ID", "TIME", "DV")] PIJ = SVPC(ori, sim) D.PIJ <- data.frame(TIME=names(PIJ), PIJ=PIJ) D.PIJ$TIME <- as.numeric(as.character(D.PIJ$TIME)) D.PIJ$ID <- rep(unique(ori$ID), each=nrow(D.PIJ)/length(unique(ori$ID))) D.PIJ <-D.PIJ[order(D.PIJ$ID, D.PIJ$TIME), ] ori<-merge(ori, D.PIJ, by = intersect(names(ori), names(D.PIJ)), all=T) ori <- ori[!is.na(ori$DV), ] #nrow(ori) #----calculate percentiles of the observed data. If data at each timepoint are not #----rich enough, it is suggested not to calculate and plot the observed percentiles. percent.obs = tapply(ori$PIJ, ori$TIME, percentile) percent.obs.time = as.numeric(names(percent.obs)) percent.obs.matrix = percent.matrix(percent.obs) plot(ori$TIME, ori$PIJ, type="n", xlab = "Time", ylab = "Pij", cex=1) title(main= "SVPC Plot") points (ori$TIME, ori$PIJ, cex=1, col=1) abline(h = 0.05, col=1, lwd = 1) abline(h = 0.95, col=1, lwd = 1) abline(h = 0.5, col=1, lwd = 1) #----plot 5, 50, and 95th percentiles of the observed data, it is optional for (i in 1:3){ lines(percent.obs.time, percent.obs.matrix[,i], lwd = 1, col=2) } Thanks, Diane Diane D. Wang, Ph.D. Clinical Pharmcology Oncology Business Unit Pfizer La Jolla 10555 Science Center Dr. (CB10/1719) San Diego, CA 92121 Office Phone: (858) 622-8021 Cell Phone: (858) 761-3667
Quoted reply history
From: markus joerger [mailto:[email protected]] Sent: Saturday, January 14, 2012 1:48 AM To: Wang, Diane Subject: Re: [NMusers] RE: VPC for non-uniform sampling dear Diane Wang, I would be interested on the R-Code for SVPC; your reference for the J Clin Pharmacology needs "log-in"; so reference with author-number etc. would be preferable! thanks and regards, Markus 2012/1/13 Wang, Diane <[email protected]> Dear Ayappa, If you would like to write your own code for diagnostic plots, here is the R code for SVPC. http://jcp.sagepub.com/content/suppl/2011/02/22/0091270010390040.DC1/DS_10.1177_0091270010390040.pdf As for the question Emmanuelle raised at the end of the email, please see "Author's Response", J Clin Pharmacol. 2011 Dec 13. [Epub ahead of print] http://jcp.sagepub.com/content/early/2011/12/12/0091270011427555.full.pdf+html Best Regards, Diane Diane D. Wang, Ph.D. Clinical Pharmcology Oncology Business Unit Pfizer La Jolla 10555 Science Center Dr. (CB10/1719) San Diego, CA 92121 Office Phone: (858) 622-8021 <tel:%28858%29%20622-8021> Cell Phone: (858) 761-3667 <tel:%28858%29%20761-3667> -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Emmanuelle Comets Sent: Thursday, January 12, 2012 12:32 AM To: [email protected] Subject: Fwd: [NMusers] RE: VPC for non-uniform sampling Dear Ayappa, "Standardized Visual Predictive Check" are in fact prediction discrepancies which were developed by Mentré et al., with a decorrelated version called normalised prediction distribution errors (npde) in Brendel et al. npde are available in Nonmem or Monolix. There is also a library in R to help compute both pd and npde (the library is called npde). Here are a few links to the original publications. Prediction discrepancies and their evaluation: Prediction discrepancies for the evaluation of nonlinear mixed-effects models. Mentré F, Escolano S. J Pharmacokinet Pharmacodyn. 2006 Jun;33(3):345-67. Epub 2005 Nov 13. http://www.ncbi.nlm.nih.gov/pmc/articles/PMC1989778/ The development of npde: Metrics for external model evaluation with an application to the population pharmacokinetics of gliclazide. Brendel K, Comets E, Laffont C, Laveille C, Mentré F. Pharm Res. 2006 Sep;23(9):2036-49. Epub 2006 Aug 12. http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2124466/ An evaluation of the npde: J Pharmacokinet Pharmacodyn. 2010 Feb;37(1):49-65. Epub 2009 Dec 23. Evaluation of different tests based on observations for external model evaluation of population analyses. Brendel K, Comets E, Laffont C, Mentré F. http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2874574/ The npde library for R: Computing normalised prediction distribution errors to evaluate nonlinear mixed-effect models: the npde add-on package for R. Comets E, Brendel K, Mentré F. Comput Methods Programs Biomed. 2008 May;90(2):154-66. Epub 2008 Jan 22. http://www.hal.inserm.fr/inserm-00274332/en/ And I leave you with a very fitting question in the light of Jean's response :-) Why Should Prediction Discrepancies Be Renamed Standardized Visual Predictive Check? Comets E, Brendel K, Mentré F. J Clin Pharmacol. 2011 Sep 10. [Epub ahead of print] http://www.hal.inserm.fr/inserm-00627625/fr/ All the best, Emmanuelle -------- Message original -------- Sujet: [NMusers] RE: VPC for non-uniform sampling Date : Tue, 10 Jan 2012 22:30:59 +0000 De : Lavigne, Jean <[email protected]> Pour : Ayyappa Chaturvedula <[email protected]>, "[email protected]" <[email protected]> Dear Ayyappa, You may consider using "Standardized Visual Predictive Check" published in the following links: http://jcp.sagepub.com/content/52/1/39 http://www.page-meeting.org/pdf_assets/4050-Standardized%20Visual%20Predictive%20Check%20in%20Model%20Evaluation%20-%20PAGE2009%20submit.pdf Best regards, Jean *From:*[email protected] [mailto:[email protected]] *On Behalf Of *Ayyappa Chaturvedula *Sent:* Tuesday, January 10, 2012 5:11 PM *To:* [email protected] *Subject:* [NMusers] VPC for non-uniform sampling Dear expert users, I am working on a dataset where subjects were sampled at different visits at random. I have developed a model for the data but not sure how to do a VPC as they do not have the same sampling scheme. I appreciate some guidance in this. Regards, Ayyappa This electronic transmission may contain confidential and/or proprietary information and is intended to be for the use of the individual or entity named above. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this electronic transmission is prohibited. If you have received this electronic transmission in error, please destroy it and immediately notify us of the error. Thank you.
Jan 10, 2012 Ayyappa Chaturvedula VPC for non-uniform sampling
Jan 10, 2012 Jean Lavigne RE: VPC for non-uniform sampling
Jan 10, 2012 Indrajeet Singh Re: VPC for non-uniform sampling
Jan 10, 2012 Nick Holford Re: VPC for non-uniform sampling
Jan 11, 2012 Norman Z Re: VPC for non-uniform sampling
Jan 11, 2012 Martin Bergstrand RE: VPC for non-uniform sampling
Jan 12, 2012 Emmanuelle Comets Fwd: RE: VPC for non-uniform sampling
Jan 13, 2012 Diane Wang RE: RE: VPC for non-uniform sampling
Jan 14, 2012 Diane Wang RE: RE: VPC for non-uniform sampling