Re: [R] nlm behaviour and error

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Tue, 03 Jun 2008 07:23:11 +0100 (BST)

It says the value is *missing* (NA), not that the length is wrong.

My quess is that term*bexp is NaN, but you have given us no context to go on.

On Tue, 3 Jun 2008, Redding, Matthew wrote:

> Hi R-Gurus,
>
> I've been cutting along quite nicely with nlm, until
> I threw in the following condition in the function that nlm is
> minimising:
>
> if (((term*bexp) < 0.0001)) {
> #warning(term*bexp, "=term*bexp",psi,"=psi")
> theta<-2000
> }
>
>
>
> Now when I run this function anywhere else, there is no problem, whether
> or the if's condition is met.
>
> When I use this in nlm:
>
> nlm(f=ssewrap.dist, p=c(292397.7,-.14053,0.03,.0005), .5, 1,
> 295.15,C,theta)
> Error in if (((term * bexp) < 1e-04)) { :
> missing value where TRUE/FALSE needed
>
>
> Now I know that the condition in the if should only be one logical
> value, but is not the condition above evaluated to a single value, and
> why does the error only occur when the function is used by nlm?
>
> Any suggestions?
>
> Kind regards,
>
> Matt Redding
> ********************************DISCLAIMER**************...{{dropped:15}}
>
> ______________________________________________
> R-help_at_r-project.org 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.
>

-- 
Brian D. Ripley,                  ripley_at_stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help_at_r-project.org 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.
Received on Tue 03 Jun 2008 - 07:03:26 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 03 Jun 2008 - 07:30:39 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive