I have a simple setting: I simulate demand patterns that are distributed according to a truncated normal distribution with a given mean and variance after truncation. The truncation is from the left at zero (as demand is always positive).
However, all functions that draw from truncated normal distributions require me to specify the mean and variance of the normal distribution before truncation as e.g. the truncnorm function from the truncnorm package in R.
val = rtruncnorm(10000, a=0, mean = 100, sd = 240) print(mean(val))  232.2385 print(sd(val))  162.853
I would like the resulting variable val to have mean 100 and standard deviation 240. Is there any function in R to do this or is there a formula to compute the mean and variance before truncation given the truncation limits and the post-mean and post-variance?