[R] Applying nlmeODE

Dominik Heinzmann dominik.heinzmann at math.unizh.ch
Wed Mar 15 08:50:21 CET 2006


Dear R-users

My problem is the following:
     1) Suppose we have the data test.txt:
     Data has form: Subject  age   test (=binary variable)
                      1       0.6   0
                      2       2     1
                      3       0.9   1
                      ...
     2) I would like solving the following differential equations:
            dA/dt = u*A + v*B
            dB/dt = -v*B -u*A
        in addition, the parameter
            u=k*t
        where k is a constant and t is the time.

     How could I implement that into nlmeODE?
     I tried the following procedure:
     a) Apply the nlmeODE function
     dataModel=groupedData(formula=test~age|Subject,
        data=read.table("E:/test.txt",header=T),
        labels=list(x="Age",y="testpositiv"),
        units=list(x="(year)",y="(+/-)"))
        modelform <- list(DiffEq=list(
                         dSdt = ~  u*I-b*S,
                         dIdt = ~ -u*I+b*S,
                 dbdt = ~ -k       ),
                     ObsEq=list(
                         c1 = ~ S,
                         c2 = ~ 0,
                 c3 = ~ 0),

                     States=c("S","I","b"),
                     Parms=c("u","k","start"),
                     Init=list("start",0,0.3))

             Modeleasy <- nlmeODE(modelform,dataModel)

     b) as far as good, now the problem if I run an estimation

     Modeleasy.nlme <- nlme(test ~ Modeleasy(u,k,start,age,Subject),
        data = dataModel, fixed=u+k+start~1, random = pdDiag(start+u~1),
        start=c(u=5.7,k=-2,start=-5.9),

     control=list(msVerbose=TRUE,tolerance=1e-1,pnlsTol=1e-1,msTol=1e-1),
        verbose=TRUE)

     plot(augPred(Modeleasy.nlme,level=0:1))

     => I get always an error message "leading Minor of degree 2 is not
     positiv definit"

     Hope anybody can help me or propose an alternative method to solve
     that problem.
     Thanks a lot. Best regs...


-- 
Dominik Heinzmann
Master of Science in Mathematics, EPFL
Ph.D. student in Biostatistics
Institute of Mathematics
University of Zurich




More information about the R-help mailing list