lbelzile / TruncatedNormal

Simulation from truncated Gaussian and Student vectors, high dimensional CDF via exponential tilting
https://lbelzile.github.io/TruncatedNormal/
8 stars 4 forks source link

Determine argument of univariate truncation based on largest argument #6

Closed lbelzile closed 2 years ago

lbelzile commented 2 years ago

Function rtnorm determines the output based on the dimension of the lower/upper bounds, so if users pass a vector of means mu or standard deviations sd of length $n$ with lb and ub shorter vectors of length m < n, these exact mean/std. dev parameters are ignored silently.

TruncatedNormal::rtnorm(n = 10, mu = c(1, 2, 3), sd = 0.1, lb = 0, ub = 2)
#>  [1] 1.0115600 1.1150791 1.0121371 1.1545362 0.9793326 1.2251340 1.0658336
#>  [8] 1.0580546 1.0475584 0.9115141

Created on 2021-11-30 by the reprex package (v2.0.1)