Back to the Top
My skills in R are fundamental, and I am having trouble with creating subsets of xpdb.
I have modeled PK and PD data in NONMEM in a indirect model in which my drug concentration is
estimated with IPRED in compartment (CMT) 2 and the Effect is in CMT=3. After using xpose.data(1) to
import the xpose tables from the NM output, I would like to create separate xpdb2 and xpdb3 objects
that contain only the data from compartments CMT=2 and CMT=3, respectively.
I tried this code, and received the error message below it.
> > xpdb2 <- xpdb1[xpdb1.-at-.Data$CMT == 3,] #(same error when = is used instead of ==)
> >
Error in xpdb1[xpdb1.-at-.Data$CMT == 3, ] :
object of type 'S4' is not subsettable
Based upon the ?Data help query, I also tried.
> > xpdb2 <- Data(xpdb1, subset="CMT = 3")
> >
However, the resulting output to xpdb2 yielded only one record, which was not the first in the NM
.FIT output.
> > xpdb2
> >
ID TAD TIME IPRED IRES IWRES CWRES
5 1 5.75 5.75 7.0878 -67.266 -0.056183 -0.14804
NPDE DV PRED RES WRES ETA1
5 -0.21043 7.03 6.7886 0.24137 -0.0086168 0.90341
ETA2 ETA3 ETA4 ETA5 ETA6 SEX DOSE CMT
5 -0.11998 0.36275 -2.2421 0.29002 -0.01153 0 30 3
ANALYTE CYCLE NDOSE NAGE NWT
5 3 0 0.3 1.44 1.2229
How would you recommend separating data from the two CMT values into separate xpdb objects?
(I noted the by= option in basic.gof, but I would like to have the four panel gof separate for each
compartment.)
Many thanks.
Paul
--
Paul R. Hutson, Pharm.D.
Professor
Senior Associate Dean for Academic Affairs
UW School of Pharmacy
Back to the Top
Hi Paul,
Without access to that object, I would suggest:
xpdb2 <- xpdb1.aaa.Data[xpdb1.-a-.Data$CMT == 3,]
or
xpdb2 <- Data(xpdb1, subset="CMT == 3")
Regards,
Kees
Back to the Top
Dear Kees:
Both of your suggestions work well. Thank you very much for your
assistance. I see that I was close, but not close enough.
Paul
Back to the Top
Kees' suggestion creates the xpdb2 object, but when I try to perform
basic.gof() on the resulting spdb2 object, I get the following:
"Error in xvardef(v, object) :
trying to get slot "Prefs" from an object (class "data.frame") that
is not an S4 object"
Only the data remain, without the S4 Slots.
Are there suggestions on how the S4 structure can be maintained when the
subset is created?
Paul
Back to the Top
Dear Paul,
you can use subset='' directly in basic.gof()
Best regards,
Sam Liao, Ph.D.
Pharmax Research, Inc.
Back to the Top
Dear Sam:
Yes, that works beautifully, and I see that I missed subset in
xpose.panel.default as an option.
Embarrassing...
Thanks very much for your help.
Paul
Want to post a follow-up message on this topic?
If this link does not work with your browser send a follow-up message to PharmPK@lists.ucdenver.edu with "Creating subsets of xpdb objects in XPOSE" as the subject |
Copyright 1995-2014 David W. A. Bourne (david@boomer.org)