0
$\begingroup$

If I have a set of $n$ elements, and I want to assign to each-one some value $\phi$, drawn at random from a distribution $f(\phi)$ such that $\int_0^1f(\phi)\;d\phi\:=\:1$

Does this mean that the sum of the values of all my elements should be equal to one?
If not, what does it mean?

EDIT As I've learned from the below answers, the sum is not one. The integral is describing the probability density of $f(\phi)$.

Does anyone know how I would go about generating these $n$ values so it was like I picked them randomly from the above distribution?

  • 0
    I deleted my answer because I misinterpreted the question.2011-08-05
  • 0
    @anon thanks for taking the time to answer anyway.2011-08-05
  • 0
    One can search under *simulation* , *random variable*. Use a pseudo random number generator to generate a real in $[0,1]$. (Many programming languages have one built in, OK for most applications. Can find fancier ones if necessary.) Then compute as in @Michael Hardy. Repeat. I hope your $f$ has a pleasant integral. If it doesn't, there are workarounds.2011-08-05
  • 0
    @Griffin: If you have a *concrete* situation that you need to deal with, then please send me message, and I (or someone else) can possibly send an explicit answer.2011-08-06
  • 0
    It sounds to me that you need to see [Devroye's book](http://cg.scs.carleton.ca/~luc/rnbookindex.html). There, he gives a lot of suggestions for generating non-uniform pseudorandom numbers...2011-08-07

2 Answers 2

0

No, it does not mean that your n elements must sum to 1. The pdf for $\phi$ is just a way of giving the probabilities for different values of $\phi$.

Although, I have absolutely no idea how to choose n elements randomly from such a distribution. It's equivalent to choosing a real number between 0 and 1 randomly... and I don't think this can be done.

  • 2
    Let $F(x) = \int_{-\infty}^x f(w)\,dw$, where $f$ is the probability density function. If $F$ is one-to-one, then the probability distribution of $F^{-1}(U)$ is the one whose density is $f$, if $U$ is uniformly distributed between 0 and 1. That's how.2011-08-05
  • 0
    @Michael In the end, do we not need to be able to choose a number from U, uniformly distributed, at random? Perhaps I'm being obtuse, but I still don't see how we can choose a number from the continuum at random.2011-08-05
  • 0
    @Michael Hardy: It should take very little time for you to provide an answer to the OP, most of it is in the comment above.2011-08-05
  • 0
    @mixedmath: Sure we can, at the "practical" level, using a pseudo random number generator. And there is no difficulty at the theoretical level. The issue you are thinking about arises if we are interested in an infinite interval, or the natural numbers.2011-08-05
  • 0
    Thank you for your answer. I'll accept since you answered my question. I should have put an extension to my question asking how to do it. @Michael could you possibly write an answer detailing your method some more, please?2011-08-05
0

It means any value drawn from this probability distribution will be between $0$ and $1$ with probability $1$ (usually called "almost surely").

$f$ is the density function, and [0,1] is the support of $f$.

In general the probability that any value is in $[0,x]$ is $F(x) = \int_0^x f(\phi) \textrm{d}\phi$. $F$ is the repartition function.

Let me know if something is still unclear.

  • 0
    Thank you very much galath for your answer. I accepted MixedMath's answer as he got there first. All of what you said is clear, but what isn't clear is how I would go about picking n values at random from the distribution. Any ideas?2011-08-05
  • 0
    That's what the first comment above is about. If $U$ is uniform in $[0,1]$, $F^{-1}(U)$ is a random variable with density $f$.2011-08-05
  • 0
    As André Nicolas says above, there are a lot of different answers for a specific $f$. Section 3.4 of Knuth's The Art of Computer programming - Seminumerical algorithms is dedicated to that question.2011-08-06