Re: [R] optim with constraints

2009-12-07 Thread JPO
Steven, A quick trick to deal with problems of this nature (i.e. forcing parameters to stay positive although the parameter search isn't bound to non-negatives or positives) without resorting to another package is to re-parametrize the density function. Notice, x \in (-\infty,\infty) for x \in (-

Re: [R] optim with constraints

2009-12-07 Thread Ravi Varadhan
-help-boun...@r-project.org] On Behalf Of Prof. John C Nash Sent: Monday, December 07, 2009 9:01 AM To: r-help@r-project.org Subject: Re: [R] optim with constraints Without the data / script, I'm guessing that it is likely an attempt to evaluate the loss function at an inadmissible point e.g., at

Re: [R] optim with constraints

2009-12-07 Thread Prof. John C Nash
other things) on trying to provide a nice wrapper to catch these exceptions so that they can be handled better. JN Message: 56 Date: Sun, 6 Dec 2009 17:32:54 -0800 (PST) From: Steven Subject: Re: [R] optim with constraints To: r-help@r-project.org Message-ID: <88d5c01d-c30c-4

Re: [R] optim with constraints

2009-12-06 Thread Steven
function on > R-forgehttp://r-forge.r-project.org/R/?group_id=395 > is a wrapper that allows some other methods too. > > JN > > > > > > > Message: 72 > > Date: Sun, 6 Dec 2009 02:53:55 -0800 (PST) > > From: Steven > > Subject: [R] optim with cons

Re: [R] optim with constraints

2009-12-06 Thread Ravi Varadhan
- From: Steven Date: Sunday, December 6, 2009 5:54 am Subject: [R] optim with constraints To: r-help@r-project.org > Hi, dear R users > > I am a newbie in R and I wantto use the method of meximum likelihood > to fit a Weibull distribution to my survival data. I use "op

Re: [R] optim with constraints

2009-12-06 Thread Prof. John C Nash
function on R-forge http://r-forge.r-project.org/R/?group_id=395 is a wrapper that allows some other methods too. JN Message: 72 Date: Sun, 6 Dec 2009 02:53:55 -0800 (PST) From: Steven Subject: [R] optim with constraints To: r-help@r-project.org Message-ID: <5e293933-91f2-48f7-98e5-bc

[R] optim with constraints

2009-12-06 Thread Steven
Hi, dear R users I am a newbie in R and I wantto use the method of meximum likelihood to fit a Weibull distribution to my survival data. I use "optim" as follows: optim(c(1, 0.25),weibull.like,mydata=mydata,method="L-BFGS-B",hessian = TRUE) My question is: how do I setup the constraints so that