+ Reply to Thread
Results 1 to 2 of 2

Thread: Add covariate in nlme?

  1. #1
    Points: 218, Level: 4
    Level completed: 36%, Points required for next Level: 32

    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Add covariate in nlme?



    Hi R-experts,

    I successfully used you nlme function in R but I’m struggling when including a covariate in the model.
    I could implement the same model in sas but need to do the work in R for practical reasons.

    I use the following code to group my data:

    Parameterg <- groupedData( result ~ time | Batch,
    data = Batchdata,
    labels = list( x = "Time", y = "analysis")
    )

    and then uses the nlme function to fit a nonlinear mixed model that includes Process as a fixed covariate:
    nlme.model001epr <- nlme(result ~ A0 * exp(- ( exp(A1) * exp(-Ea / (0.0083144*TEMP.K)) * exp(eps)) * time),
    data = Parameterg,
    fixed=list(A0+Ea~1,A1~Process),
    random=eps~1,
    start=c(93, 92, 34.5,37),
    control=list(msVerbose=TRUE, maxIter = 200),
    verbose=TRUE, method="REML",
    na.action=na.pass)
    this fit give the following error:
    Error in MEEM(object, conLin, control$niterEM) :
    Singularity in backsolve at level 0, block 1

    Note that I’m not having any missing values in my data.

    Do you know what the correct implementation is for adding a covariate in a nlme and what might be my problem here?

    FYI: the sas-code that worked in my case was like:
    proc nlmixed data=stab.BatchdataParameter ;
    parms Ea=92 A0=93 A1=34.5 e=10 s2=10 A11=1 A12=1;
    k= exp(A1)*exp(-Ea/(.0083144*tempK))*exp(eps1)*exp(A11*(Process='Process 1') + A12*(Process='Process 3'));
    m= A0*exp(-k*time);
    model result ~ normal(m,e);
    random eps1~normal(0,s2) subject=batch;
    contrast "Process" A11,A12;
    contrast "Process 2 vs 3" A12;
    estimate "Process 1" A1+A11;
    estimate "Process 3" A1+A12;
    estimate "Process 2" A1;
    run;

    Looking forward to your replies,
    Heidi

  2. #2
    Points: 218, Level: 4
    Level completed: 36%, Points required for next Level: 32

    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Add covariate in nlme?


    Problem solved: my initial values were not chosen correctly :-)

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts








Advertise on Talk Stats