I have a list of values sampled from a beta distribution that therefore lie in the interval [0,1]. I would like to add (e.g. Gaussian) noise to these values, but of course there is the problem of the values then potentially leaving the interval. What is the proper way to do this?


closed as unclear what you're asking by COOLSerdash, mpiktas, Xi'an, Nick Cox, Glen_b Apr 2 '15 at 11:49

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 7
    $\begingroup$ Could you explain the purpose of this "noise" and what it represents? After all, as a purely mathematical question this has infinitely many equally good answers, but as a statistical question the answers have to reflect the reality you are attempting to model. What is the genesis of this noise and why do you need to incorporate it explicitly in a distribution? Indeed, what role will this distribution play in your study? $\endgroup$ – whuber Apr 1 '15 at 17:06
  • 3
    $\begingroup$ Ordinarily one would begin by considering how the experimental outcomes could deviate from $d$ and go on from there to create a probability model of those deviations. Without any further information about your experiment there is little we could add to that. What does all this have to do with the beta distribution you mention, given that there is a single "true value" of $d$? $\endgroup$ – whuber Apr 1 '15 at 17:20
  • 1
    $\begingroup$ I suspect I don't fully understand. At this point it seems to me that in each iteration of the simulation you choose a $d$ randomly and then, conditional on that value, you create some experimental data and apply your method to those. If this is a correct interpretation, then the issue concerns how to generate the experimental data--you definitely would not want just to add noise to $d$! $\endgroup$ – whuber Apr 1 '15 at 17:26
  • 1
    $\begingroup$ Against closing: It's often useful to test an estimator using simulated data, but in the real world, noise is often normally distributed. So a reasonable way to investigate the quality of an estimator using simulated data is to add normally distributed noise to underlying values (which will be generated randomly--how isn't that important). However, the data is constrained to an interval, and the normal distribution isn't. The question doesn't have the specificity that would come from using real data, but still seems appropriate to me. I'm grateful for the answers given, in fact. $\endgroup$ – Mars Jul 20 '15 at 16:27
  • 1
    $\begingroup$ Would it make the question more acceptable if, instead of asking "What is the proper way to do this?", OP had instead said, "What are some ways do this? What are their advantages and disadvantages? Under what circumstances would each be appropriate?" (And what if OP didn't know enough to ask the question in that way, as the existing wording suggests? Might it be reasonable to provide such answers?) $\endgroup$ – Mars Jul 20 '15 at 18:14

A traditional way to handle constrained variables is to transform them into unconstrained variables, apply the jittering, and turn them back into the original scale.

For instance, if $d_i\in(0,1)$, one can use the logit transform $$x_i=\text{logit}(d_i)=\log\left(\frac{d_i}{1-d_i}\right)$$ and add as much noise as necessary$$y_i=x_i+\epsilon_i$$ where $\epsilon_i$ is for instance a centred Gaussian variate, before returning $$\delta_i=\exp(y_i)\big/(1+\exp(y_i))=1\big/(1+\exp(-y_i))$$

Here is an illustration in R:

> d=rbeta(10^4,2.4,6.2)
> logit=function(x){log(x/(1-x))}
> de=1/(1+exp(-rnorm(10^4,mean=logit(d),sd=2)))

It appears there are many ways to accomplish what you are looking for. Here's one suggestion.

Treat each $d$ as if it were the value of some function $\Phi$ from the real number line to the unit interval. For example, let $\Phi$ denote the cumulative density function of the standard normal distribution, so that $d = \Phi(z)$ for some real-valued $z$. Then $z = Probit(d)$, where $Probit$ denotes the inverse of $\Phi$. Let $\hat{z} = z + a \cdot e$, where $e$ is a standard normal random variable and $a >0$ is a scaling factor. Let $\hat{d} = \Phi(\hat{z})$ be your noisy estimate of $d$. Putting everything together, you have

$\hat{d} = \Phi(Probit(d) + a \cdot e)$

which will lie in the open unit interval. By adjusting $a$ you adjust the degree of noise.


Not the answer you're looking for? Browse other questions tagged or ask your own question.