ocbe-uio / TruncExpFam

R package to generate data related to the Truncated Exponential Family
https://ocbe-uio.github.io/TruncExpFam/
GNU General Public License v3.0
0 stars 1 forks source link

Mixed argument naming causes problem on rtrunc #74

Closed wleoncio closed 2 years ago

wleoncio commented 2 years ago

Naming all arguments except n works fine:

r$> rtrunc(10, mean = 45, sd = 12, a = 50, family = "gaussian")                           
 [1] 50.49646 55.30235 57.44640 57.04836 63.30309 70.77076 54.10051 56.77301 55.77369
[10] 58.90156

Naming none also works fine:

r$> rtrunc(10, 45, 12, 50, family = "gaussian")                                           
 [1] 51.11625 50.25457 60.52160 61.72959 53.50454 66.66784 54.50252 51.34266 54.16256
[10] 56.92976

But naming just some causes validateFamilyParms() to incorrectly determine what the parameters are:

r$> rtrunc(10, 45, 12, a = 50, family = "gaussian")                                       
Error in validateFamilyParms(family, parms) : 
  The {, } parameter set does not match the normal family. Expected set of parameters: {mean, sd}. Please change the family to match the expected parameters or use a different family.

r$> rtrunc(10, 45, 12, b = 60, family = "gaussian")                                       
Error in validateFamilyParms(family, parms) : 
  The {, } parameter set does not match the normal family. Expected set of parameters: {mean, sd}. Please change the family to match the expected parameters or use a different family.