[R] Request for Assistance in R with NonMem

Douglas Bates bates at stat.wisc.edu
Fri Nov 28 17:41:25 CET 2008


On Wed, Nov 26, 2008 at 12:46 PM, Michael White <mpdubb at gmail.com> wrote:
> Hi
> I am having some problems running a covariate analysis with my
> colleage using R with the NonMem program we are using for a graduate
> school project. R and NonMem run fine without adding in the
> covariates, but the program is giving us a problem when the covariate
> analysis is added. We think the problem is with the R code to run the
> covariate data analysis. We have the control stream, R code (along
> with the error), and data attached. If anyone can help we would really
> appreciate it. Thank you very much.

The error message from R

> Error in as.vector(x, mode) : invalid 'mode' argument

is non-specific.  To diagnose exactly what the cause of this is you
would need to use

traceback()

after the error and determine where this error message originates.  It
is likely originating in code in the Mltools package that is trying to
parse the NonMem output file.

I myself would also be concerned about the warnings from the ld
program that indicate inconsistencies in the structure of the object
files from NonMem.  First of all the message doesn't make sense in
that 32 is not smaller than 28 and secondly it may indicate a
misalignment of storage in a Fortran common block.


> R Code:
> # load MItools from within R
> library(MItools)
>
> ProjectDir <- "~/EssentialsOpenCourseware/continuous_PKPD/Examples"
> NMcom <- "nm6osxg77big.pl"
> cov   <-  c("AGE", "BW")
>
> # run NONMEM using 3032.ctl
> NONR(ProjectDir=ProjectDir,
>     NMcom=NMcom,
>     dvname="Test (mcg/L)",
>     diag=1,
>     covplt=1,
>     b=3032,
>     boot=0,
>     nochecksum=TRUE,
>     grp=c("FLAG")
> )
>
> ERROR MESSAGE:
> ld warning: for symbol _cm41_ tentative definition of size 32 from
> /usr/local/nm6osxg77big/nm/nonmem.a(INITL.o) is is smaller than the
> real definition of size 28 from /usr/local/nm6osxg77big/nm/BLKDAT.o
> /usr/local/nm6osxg77big/test/nm6osxg77big.pl is starting
> /Users/mpdubb/EssentialsOpenCourseware/continuous_PKPD/Examples/3033/nonmem.exe
> /usr/local/nm6osxg77big/test/nm6osxg77big.pl is complete
> No TAD item for run 3033.
> Error in as.vector(x, mode) : invalid 'mode' argument
> Run 3033 complete.
> NONR complete.
>
> CONTROL STREAM (in NONMEM):
> $PROB RUN# 3033 EFFECT COMP POPULATION PK-PD MODEL 2
> $INPUT C REPL ID ARM TIME AGE BW GNDR DV MDV FLAG AMT EVID
> ;FLAG 1 = PK, FLAG 2=PD,
> ;CMT 1=GUT, 2=CENTRAL
> ;DV =PK  ORDERED BY ID, TIME
> $DATA ../projectRSD1.csv IGNORE=C
> $SUBROUTINE ADVAN2 TRANS2 INFN=../MItoolsRunlogNM6.for
> $ABB COMRES=8
> $PK
> FLA2=FLAG
> TVKA=THETA(1)
> TVCL=THETA(2)
> TVV=THETA(3)
> CL=TVCL*EXP(ETA(1))
> V=TVV*EXP(ETA(2))
> KA=TVKA*EXP(ETA(3))
> S2=V
> $ERROR
> EMAX=THETA(4)*EXP(ETA(4))
> EC50=THETA(5)*EXP(ETA(5))
> N = THETA(6)*EXP(ETA(6))
> EFF= (EMAX*F**N)/(EC50**N+F**N) + ERR(2)
> CONC= F + F*ERR(1)
> Y = CONC*(2-FLAG) + EFF*(FLAG-1)
> IPRED=Y
>    "  LAST
>    "  COM(1)=G(1,1)
>    "  COM(2)=G(2,1)
>    "  COM(3)=G(3,1)
>    "  COM(4)=G(4,1)
>    "  COM(5)=G(5,1)
>    "  COM(6)=G(6,1)
>    "  COM(7)=HH(1,1)
>    "  COM(8)=HH(2,1)
> $THETA
> (0, 1.7)     ;KA
> (0, 4.7)     ;CL
> (0, 38)     ;V
> (0.0, .5)                   ; EMAX
> (0.0, 100)                  ; EC50
> (0.0, 1, 10)                ; N
> $OMEGA
> 0.04
> 0.04
> 0.04
> 0.04
> 0.04
> 0.04
> $SIGMA
> 0.04
> 5
> $ESTIMATION MAXEVAL=9999 NOABORT METHOD=0 POSTHOC PRINT=5
> $COVARIANCE
> $TABLE ID TIME  AGE BW GNDR TVKA TVV TVCL ETA1 ETA2 ETA3
> EVID NOPRINT ONEHEADER FILE=TABLE.PAR
> $TABLE NOPRINT FILE=../3033.TAB ONEHEADER
> ID TIME AGE BW GNDR KA V CL TVKA TVCL TVV FLAG FLA2 EVID EFF CONC IPRED FLAG
> $TABLE NOPRINT ONEHEADER FILE=../3033par.TAB
> ID TIME  AGE BW GNDR KA V CL TVKA TVCL TVV EMAX EC50 ETA1 ETA2 ETA3
> EVID
> $TABLE ID TIME COM(1)=G11 COM(2)=G21
> COM(3)=G31 COM(4)=G41 COM(5)=G51 COM(6)=G61 COM(7)=H11
> COM(8)=H21 IPRED MDV NOPRINT ONEHEADER FILE=cwtab1.deriv
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>



More information about the R-help mailing list