[R] HELP with NLME

Loki Natarajan loki at math.ucsd.edu
Wed Jul 26 00:52:01 CEST 2006


Hi,

I was very much hoping someone could help me with the following.
I am trying to convert some SAS NLMIXED code to NLME in R (v.2.1),
but I get an error message. Does anyone have any suggestions?
I think my error is with the random effect "u" which seems to be
parametrized differently in the SAS code. In case it's helpful, 
what I am essentially trying to do is estimate parameters using ML in a 
measurement error setting with some validation data (indicated by 
vs.flag). Any help would be greatly appreciated.I apologize for the
clumsiness of the R code.
Many thanks in advance.

Sincerely,
Loki
#################################################################
SAS Code:

proc nlmixed data=repdat
parms b0 -3 b1 -.135 a0 3 a1 4 sigsq 0.25;

if vs.flag = 1 then do;
    eta1 = b0 + b1*lnbldT;
    llbin = anybc.cens.ind*eta1 - log(1+exp(eta1));
    eta2 = a0 + a1*lnndsTs;
    llnorm = -1/(2*sigsq)*(lnbldT - eta2)**2 - .5*log(sigsq);
    ll = llbin + llnorm;
    end;

else do;
    eta2 = a0 + a1*lnndsTs;
    eta1 = b0 + b1*eta2 + u;
    llbin = anybc.cens.ind*eta1 - log(1+exp(eta1));
    ll = llbin;
    end;

sigma2 = sigmasq*b1**2 /*variance of random effect;
model anybc.cens.indic ~ general(ll);
random u ~ normal(0,sigma2) subject = CaseID; */;
run;
####################################################################
R Code with error message:

me.km.nlme <- nlme(model = anybc.cens.indic ~ 
vs.flag*((anybc.cens.indic*(b0+b1*lnbldT) - log(1 + exp(b0+b1*lnbldT))) + 
(((-1/(2*sigsq))*(lnbldT -a0 -a1*lnndsTs)^2) - 0.5*log(sigsq))) + 
(1-vs.flag)*((anybc.cens.indic*(b0+b1*(a0 + a1*lnndsTs + u))) - log(1 + 
exp(b0+b1*(a0 + a1*lnndsTs + u)))), fixed = 
list(a0~1,a1~1,b0~1,b1~1,sigsq~1),na.action=na.omit, data=rc.df, 
method="ML", random=u~1|CaseID,
start = c(a0=0, a1=1, b0=-3, b1 = -0.135, sigsq = 0.25))

+ Error: Singularity in backsolve at level 0, block 1
In addition: There were 16 warnings (use warnings() to see them)
> >
>
> warnings()
Warning messages:
1: Singular precision matrix in level -1, block 5
2: Singular precision matrix in level -1, block 5
3: Singular precision matrix in level -1, block 5
4: NA/Inf replaced by maximum positive value
5: Singular precision matrix in level -1, block 5
6: Singular precision matrix in level -1, block 5
7: Singular precision matrix in level -1, block 5
8: NA/Inf replaced by maximum positive value
9: NaNs produced in: log(x)
10: NaNs produced in: log(x)
11: NaNs produced in: log(x)
12: NaNs produced in: log(x)
13: NaNs produced in: log(x)
14: NaNs produced in: log(x)
15: NaNs produced in: log(x)
16: NaNs produced in: log(x)
>
#####################################################################


Loki Natarajan
Associate Professor of Biostatistics
Moores UCSD Cancer Center
3855 Health Sciences Drive #0901
La Jolla, CA 92093-0901


phone:     858 822 4763
Fax:       858 822 6897



More information about the R-help mailing list