[R] What does it mean by "initial value not available"?
Yuchen Luo
realityrandom at gmail.com
Sun Sep 9 21:59:47 CEST 2007
Dear Professor Mordoch.
Thank you very much for your help! Your time is highly appreciated!
I do intend to optimize over 3 parameters and the way I did it is
constrOptim(c(0.5,0.3,0.5), fit.error, fit.error.grr, ui=ui,ci=ci).
Also, There is a missing value for both sigmae and ss. (The last 3rd
and 4th line) Please correct them as:
sigmae=c(0.172239074,0.188209271,0.193703774,0.172659891,0.164427247,0.24602361,0.173555309,0.186701165,0.193150456,
0.1857315601)
ss=c(56.49,56.39,56.55,57.49 ,57.37,55.02,56.02,54.35,54.09,54.67)
Best Wishes
Yuchen Luo
> On 9/9/07, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
> > On 09/09/2007 7:01 AM, Yuchen Luo wrote:
> > > Dear friends.
> > > I use ConstrOptim( ) and got error message "initial value not
> available".
> > > My understanding of "initial value not available" is that one of the
> > > following 3 cases happens:
> > >
> > > 1.The objective function is not well defined at the point of the initial
> > > value.
> > > 2. The differentiation of the objective function is not well defined at
> > the
> > > point of the initial value.
> > > 3. The initial value violate the constrain of "ui %*% theta - ci >= 0"
> > >
> > > But my situation does not belong to any of the above cases.
> > >
> > > I have attached my code bellow and could you please help me take a look?
> >
> > I haven't tried your code, but there's one obvious error:
> > ...
> > > fit.error=function(rec,lambda,lbar)
> > > {sum((eval(apple)*1000-orange)^2/(orange^2))
> > > }
> >
> > The function optimizes over the elements of the first parameter. You've
> > got two other parameters there, and I think you're trying to optimize
> > over them as well. Put them all into one vector.
> >
> > The documentation for constrOptim doesn't make this as clear as it
> > should; I'll clarify (by copying the docs from ?optim).
> >
> > Duncan Murdoch
> >
> > >
> > >
> > > fit.error.grr=function(rec,lambda, lbar)
> > > {drec=sum(eval(D(apple,'rec'))*(eval(apple)*1000-orange)/(orange^2))
> > >
> dlambda=sum(eval(D(apple,'lambda'))*(eval(apple)*1000-orange)/(orange^2))
> > > dlbar=sum(eval(D(apple,'lbar'))*(eval(apple)*1000-orange)/(orange^2))
> > > c(drec,dlambda,dlbar)
> > > }
> > >
> > >
> > > rr=c(4.33,4.22,4.27,4.43,4.43,4.44,4.45,4.65,4.77,4.77)
> > > tot=rep(13319.17,10)
> > > sh=rep(1553656,10)
> > > sigmae=c(0.172239074,0.188209271,0.193703774,0.172659891,0.164427247,
> > > 0.24602361,0.173555309,0.186701165,0.193150456)
> > > ss=c(56.49,56.39,56.55,57.49,57.37,55.02,56.02,54.35,54.09)
> > > orange=rep(21.25,10)
> > >
> > > constrOptim(c(0.5,0.3,0.5), fit.error, fit.error.grr, ui=ui,ci=ci)
> > >
> > > [[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
> > > and provide commented, minimal, self-contained, reproducible code.
> >
> >
>
More information about the R-help
mailing list