[R] fit for truncated normal distribution

William Dunlap wdun|@p @end|ng |rom t|bco@com
Sat Mar 14 22:22:14 CET 2020


On Linux it says "Program received signal SIGFPE, Arithmetic exception".  I
think the only way to get a SIGFPE (floating point exception) any more (on
machines with IEEE floating point arithmetic) is taking an integer modulo
zero, which do_druncnorm does when length(x) is 0:
       const double cx = x[i % n_x];
Should R catch SIGFPE and turn it into an error condition?

Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Sat, Mar 14, 2020 at 12:19 PM peter dalgaard <pdalgd using gmail.com> wrote:

> I see it in three different Mac builds, including a quite recent local
> R-devel build.
>
> It boils down to this:
>
> > dtruncnorm(numeric(0), mean=6.7, sd=1.38, a=-Inf, b=9)
> Floating point exception: 8
>
> which looks like a bug in the truncnorm package, where dtruncnorm() is
> unprepared for a zero-length argument.
>
> (The indirect cause is fitdistrplus:::test1fun, which makes calls like the
> above.)
>
> -pd
>
> > On 14 Mar 2020, at 19:42 , Bert Gunter <bgunter.4567 using gmail.com> wrote:
> >
> > Inline.
> >
> > Bert Gunter
> >
> > "The trouble with having an open mind is that people keep coming along
> and
> > sticking things into it."
> > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
> >
> >
> > On Sat, Mar 14, 2020 at 10:36 AM |Juergen Hedderich <
> j.hedderich using t-online.de>
> > wrote:
> >
> >> Dear R-help list members,
> >>
> >> the R Session aborted without any 'comment'  for the following 'small
> >> example':
> >>
> >> /library(fitdistrplus)
> >> library(truncnorm)
> >>
> >> filter <- c(4.98, 8.60, 6.37, 4.37, 8.03, 7.43, 6.83, 5.64, 5.43, 6.88,
> >>             4.57, 7.50, 5.69, 7.88, 8.98, 6.79, 8.61, 6.70, 5.14, 7.29)
> >>
> >> fit  <- fitdist(filter, "truncnorm", fix.arg=list(a=-Inf, b=9),
> >>                 start=list(mean=mean(filter), sd=sd(filter)),
> >>                 optim.method="L-BFGS-B",
> >>                 lower=c(-0.1, -0.1), upper=c(Inf, Inf))/
> >>
> >> R worked fine in an 'older'  R-version (environment). Can anyone help
> me?
> >>
> >
> > I can't. But without including the specifics of the older and newer
> > software (including OS version, maybe), maybe no one can.
> > See ?sessionInfo
> >
> >
> >
> >>
> >> Many thanks in advance.
> >>
> >> Best regards
> >>
> >> J. Hedderich
> >>
> >>
> >>        [[alternative HTML version deleted]]
> >>
> >> ______________________________________________
> >> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >> 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.
> >>
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > 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.
>
> --
> Peter Dalgaard, Professor,
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Office: A 4.23
> Email: pd.mes using cbs.dk  Priv: PDalgd using gmail.com
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list