From the description of “truncation”, it looks like we should get all possible values of normal distribution from -inf to +inf when truncation is set to 1 and we should get 0 when truncation is set to 0. This can be achieved by assuming that truncation is equal to area under the curve of standard normal distribution between (-x,x). If area under standard normal distribution between (-x,x) = A, then x = - (inverse cdf of (1-A)/2). Then, we should set a,b in truncnorm.rvs as -x and x. However, that gives me assertion errors in the test. I am able to pass the test if I simply put a and b as -truncation and +truncation, which doesn’t seem correct. Can someone please clarify what I am missing here?

I think you’re just making this more complicated than it needs to be: we just use `truncnorm.rvs`

with the specified limits. What does that do? Check the docs …

Where does it say anything about us needing to deal with the area under the curve? You’re just specifying the truncation limits in terms of standard deviations.

Then, we should not define truncation parameter as 0 for generating mean and 1 for generating entire distribution because truncation parameter = 1 when used as providing limits of -truncation to +truncation will not generate entire distribution.

Yes, that sounds right. If you set it to 1, then you don’t get the entire Gaussian distribution. By definition, you get the central portion that is within one standard deviation of the mean. That’s the point, right?

Right. I got confused with the way “truncation” parameter was defined in the assignment. So, it is just specifying the range in terms of +/- standard deviations for truncation. Thanks for clarification.