Skip to content

Incoherent estimates and bug for truncated normal functions #2

Closed

Description

@benoitplaine-png

Hello,

Trying to run the examples for rNormal_trunc_ab and eNormal_trunc_ab that you provide in the documentation at https://search.r-project.org/CRAN/refmans/ExtDist/html/Normal_trunc_ab.html, I obtain incoherent estimates :

Console :

X <- rNormal_trunc_ab(n= 500, mu= 2, sigma = 5, a = 1, b = 2)
est.par <- eNormal_trunc_ab(X); est.par

Parameters for the Normal_trunc_ab distribution.
(found using the numerical.MLE method.)

Parameter Type Estimate
mu shape -93.752527
sigma shape 20.881979
a boundary 1.001197
b boundary 1.996527

...clearly far off for the shape parameters !?

Then other tests end up in errors, for example setting the bound "b" to 3 :

Console :

X <- rNormal_trunc_ab(n= 500, mu= 2, sigma = 5, a = 1, b = 3)
est.par <- eNormal_trunc_ab(X); est.par

Error in trans.est.par[[k]] : subscript out of bounds

Thanks for looking into this,
Benoît

Activity

  1. oleksii-nikolaienko commented on Sep 12, 2025

    @oleksii-nikolaienko
    Owner

    Thanks for the report. Will check within some days

  2. oleksii-nikolaienko commented on Sep 17, 2025

    @oleksii-nikolaienko
    Owner

    Fixed in #3

    There were a couple of errors indeed. But the example wasn't great either - impossible to converge with only 500 data points when mu=2, sigma=5, a=1, b=2, so I changed it to a more reproducible rNormal_trunc_ab(n=500, mu=2, sigma=5, a=-5, b=5)

    Please check if it works as expected for your data, and I'll submit to CRAN in a few days

  3. oleksii-nikolaienko commented on Sep 24, 2025

    @oleksii-nikolaienko
    Owner

    Reopen if error persists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions