[R] Converting PROC NLMIXED code to NLME

Singh, Jatinder SinghJatinder at PRAIntl.com
Fri Oct 14 17:57:08 CEST 2005


Hi Peter,

Apologies - I ran the script using S-Plus 6.2. I am happy to run it in R, but my feeling is that there may be something wrong with the code itself. I have included the dataset and script, in case you can help.

Jindi Singh. 


Jatinder Singh
Senior Manager, Analysis and Reporting
PRA International
300-730 View Street
Victoria, B.C. V8W 3Y7
Tel: 250-483-4416
Fax: 250 483 4588
http://www.prainternational.com 
e-mail: singhjatinder at praintl.com

-----Original Message-----
From: pd at pubhealth.ku.dk [mailto:pd at pubhealth.ku.dk] On Behalf Of Peter Dalgaard
Sent: Saturday, October 08, 2005 1:29 AM
To: Singh, Jatinder
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] Converting PROC NLMIXED code to NLME

"Singh, Jatinder" <SinghJatinder at PRAIntl.com> writes:

> Hi,
> 
> I am trying to convert the following NLMIXED code to NLME, but am 
> running into problems concerning 'Singularity in backsolve'. As I am 
> new to R/S-Plus, I thought I may be missing something in the NLME code.

Which version of R and NLME? R 2.2.0 ships with a version where the internal optimizer is changed to nlminb(). As I understand it, this was in response to reports where code that worked in S-PLUS refused to work in R.

 
> NLMIXED
> ***********
> proc nlmixed data=kidney.kidney;
> parms delta=0.03 gamma=1.1 b1=-0.003 b2=-1.2 b3=0.09 b4=0.35 b5=-1.43 
> varu=0.5; eta=b1*age+b2*sex+b3*gn+b4*an+b5*pkn+u;
> hazard=eta+log(delta)+log(gamma)+(gamma-1)*log(rtime);
> survivor=(-exp(eta))*delta*(rtime**gamma);
> ll=(event*hazard)+survivor;
> model rtime ~ general(ll);
> random u~normal(0,varu) subject=patient out=frailty; run;
> 
> NLME
> ********
> kidney.nlme<-nlme(model=rtime~
> (event*
> ((b1*age+b2*sex+b3*gn+b4*an+b5*pkn+u)+log(delta)+log(gamma)+(gamma-1)*
> lo
> g(rtime))
> +((-exp(b1*age+b2*sex+b3*gn+b4*an+b5*pkn+u))*delta*(rtime**gamma))
> ),
> fixed=list(delta~1,gamma~1,b1~1,b2~1,b3~1,b4~1,b5~1),
> random=u~1|patient,
> start=c(delta=0.03,gamma=1.1,b1=-0.003,b2=-1.2,b3=0.09,b4=0.35,b5=-1.4
> 3)
> ,
> data=(kidney),
> method="ML",
> na.action=na.include
> )
> 
> Error in NLME
> *************
> > traceback()
> 11: eval(action, sys.parent())
> 10: doErrorAction("Problem in .C(\"fit_nlme\",: Singularity in 
> backsolve", 1000)
> 9: .C("fit_nlme",
> 8: nlme(model = rtime ~ (event * ((b1 * age + b2 * sex + b3 * gn + b4 
> * an + b5 *
> 7: NULL
> 6: nlme.formula(model = rtime ~ (event * ((b1 * age + b2 * sex + b3 * 
> gn
> + b4 *
> 5: eval(i, local)
> 4: source(auto.print = auto.print, exprs = substitute(exprs.literal))
> 3: script.run(exprs.literal = {
> 2: eval(expression(script.run(exprs.literal = {
> 1: 
> Message: Problem in .C("fit_nlme",: Singularity in backsolve
> 
> I am actually trying to fit a parametric model to the kidney catheter 
> data and compare NLMIXED with NLME. I am aware that COXPH and SURVREG 
> are also available with a frailty element added in, but wanted to fit 
> the likelihood model as above for a direct comparison.
> 
> Cheers,
> 
> Jindi
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907


More information about the R-help mailing list