[R] Error: function cannot be evaluated at initial parameters
Rolf Turner
r.turner at auckland.ac.nz
Fri Sep 19 07:08:10 CEST 2008
On 19/09/2008, at 2:33 PM, sandsky wrote:
>
> I have an error for a simple optimization problem.
It is not a simple optimization problem. It is a
totally silly optimization problem.
> Is there anyone knowing
> about this error?
>
> lambda1=-9
> lambda2=-6
> L<-function(a){
> s2i2f<-(exp(-lambda1*(250^a)-lambda2*(275^a-250^a))
> -exp(-lambda1*(250^a)-lambda2*(300^a-250^a)))
> logl<-log(s2i2f)
> return(-logl)}
> optim(1,L)
>
> Error in optim(1, L) : function cannot be evaluated at initial
> parameters
What is your difficulty? The error means what it says. Nothing
more, nothing less.
Did you ***try*** just typing ``L(1)'' to see what you get?
Hint: exp(2250) is infinity as far as your --- or anyone else's ---
computer
is concerned.
cheers,
Rolf Turner
######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
More information about the R-help
mailing list