Re: [R] Problem with try()

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Wed 05 Jul 2006 - 19:12:48 EST

The problem here seems to be that the C code you are using does not return to R. If so, it is nothing to do with try(), and you need to modify the way you are calling gsl to use a different error handler.

BTW, this seems much more appropriate to R-devel (see the posting guide).

On Mon, 3 Jul 2006, Landsman Leonid wrote:

> Dear R-experts,
> I am running a large simulation exercise where the enough complicated integration is required.
>
> The integral is computed within a C-function called Denom by use of function qags from the gsl library.
>
> Here is a piece of R-code:
>
> denom<-try(.C("Denom",as.double(x),as.integer(n), as.integer(p),
> as.double(param), as.double(delta),res=as.double(results)))
> denomres=if (class(denom)=="try-error") NA else denom$res
>
>
> Sometimes, it happens that the integration process fails with the follwoing error message
>
> gsl: qags.c:553: ERROR: bad integrand behavior found in the integration interval
> Default GSL error handler invoked.
>
>
> and the whole simulation job is destroyed. My question is: why try() does not work and how to fix this problem?
>
> Much thanks,
>
> Leonid Landsman.
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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
>

-- 
Brian D. Ripley,                  ripley@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@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
Received on Wed Jul 05 19:16:26 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 05 Jul 2006 - 20:18:39 EST.

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