# Truncated Normal — Reproduce a randomly generated data set

help.

Problem: Given a bounded Gaussian Distribution -- looking reproduce similar results i.e. same mean and standard deviation randomly.

Definition: Data set exhibits properties of a Gaussian distribution. Data set is bounded. Each value of the data set is an integer.

Let mu and sigma represent the mean and standard deviation. Let a and b represent the lower and upper bounds.

Comments: Tried to employ both rtnorm or rttruncnorm functions in R programming.

When I get a value from either of these functions, I'm simply rounding the result to the nearest integer. When I elect to unbound either function ie. from -Inf to Inf, I find that I can reproduce an experimental data set that is quite similar to the original data except for having data values that are obviously falling outside of the original boundaries [a,b], but yes do achieve the goal mu and sigma.

When I bound my result using these functions, the effective standard deviation is smaller as compared to the original standard deviation; I'm cutting away the head and tail of the distribution leaving an effective sigma that spans a smaller range.

While I appreciate that I can multiply and shift between truncated and non-truncated distributions using (X-mu)/sigma where X is a random value, the real goal is to reproduce an experimental truncated Gaussian distribution corresponding to the original truncated Gaussian data set.

For example, I tried simply increasing the goal standard deviation in rtnorm function for a bounded data set [a,b] to generate an effective standard deviation that is equivalent to the original standard deviation; however, this approach failed. This resulted in the standard deviation increasing somewhat but the effective standard deviation hit a ceiling falling short of the goal sigma thus never realizing the original standard deviation, mean and boundaries.

Remember, I am going on the premise that since I have an actual, real-world bounded Gaussian distribution with a given mean and standard deviation, I'm thinking that I can absolutely reproduce a similar randomly generated result.

Am I mistaken? What might I do differently?

I appreciate any insight that any of you might lend. Your help would really be welcomed and valued.

• In the help page for rtnorm it says mean and sd are for the untruncated distribution. – Peter Flom - Reinstate Monica Apr 24 '13 at 23:57
• What's your evidence that it is Gaussian, other than being rounded and bounded? Unless you've made a coding error, it sounds like you've shown that it isn't. Maybe give us some actual values of a,b, mu and sigma of the original data and a qqplot. – Peter Ellis Apr 25 '13 at 1:25
• Thank you for the reply Peter. Actually, I think that you are right. After scratching my head further, I realized that all my observations didn't adhere to a Gaussian distribution strictly. 68% 1 standard deviation 95% 2 standard deviations 97.7% 3 standard deviations What I found was that the distribution was more like the following: 55% 1 standard deviation 100% 2 standard deviations Know, I guess, I need to figure what kind of distribution that I really have. Any suggestions? – Gideon Apr 25 '13 at 1:59
• plot(density(x)); and library(MASS); truehist(x) are good starts. Unless you've made a coding error there must be something dramatic enough that it will show up visually, as it seems the variance of the population is more than of a uniform distribution and this should be visible. – Peter Ellis Apr 25 '13 at 2:22

As the variance of your simulated untruncated normal distribution increases the density gets flatter across the [a,b] interval. At its limit it becomes almost a uniform distribution hence with a maximum standard deviation of $\sqrt{\frac{1}{12}(b-a)^2}$. If the standard deviation of the population you are looking at is more than that, it must mean you have a bimodal distribution of some sort.

Even in that case (which means you don't have a truncated normal distribution) the maximum theoretical variance happens when $\mu$ is bang in the middle of $a$ and $b$ and the data is all at the extremes - half at the lower bound and half at the upper. The maximum possible standard deviation from a bounded distribution of any sort is $\sqrt{.5(a-\mu)^2+.5(b-\mu)^2}$ which reduces to $b-\mu$.

I would suggest you look at histograms and density line plots of your original data and question your starting assumption that comes from a truncated rounded Gaussian distribution. I would also compare its actual standard deviation with the two theoretical limits above. If it is less than the standard deviation of a uniform distribution you should be able to simulate a truncated normal distribution with that standard deviation, and you probably have a coding error. If it is more than that amount, you need to find an alternative model.

• Thank you Peter for the second reply. Again, you are correct that the data doesn't entirely adhere to a Gaussian Distribution. I'm now going through the checklist using the reference for example -- "How to determine the probability distribution Type for your data?" ehow.com/… Thank you for your input. – Gideon Apr 25 '13 at 2:15
• Hi @Gideon, no probs, if it was useful could you consider clicking on the "tick" mark next to the answer to accept it, so the question is removed from the "unanswered questions" category. – Peter Ellis Apr 28 '13 at 5:56