Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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?

share|improve this question
    
I deleted my answer because I misinterpreted the question. –  anon Aug 5 '11 at 17:41
    
@anon thanks for taking the time to answer anyway. –  Griffin Aug 5 '11 at 19:32
    
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. –  André Nicolas Aug 5 '11 at 21:16
    
@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. –  André Nicolas Aug 6 '11 at 1:48
    
It sounds to me that you need to see Devroye's book. There, he gives a lot of suggestions for generating non-uniform pseudorandom numbers... –  J. M. Aug 7 '11 at 11:01
add comment

2 Answers 2

up vote 0 down vote accepted

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.

share|improve this answer
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. –  Michael Hardy Aug 5 '11 at 17:58
    
@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. –  mixedmath Aug 5 '11 at 18:45
    
@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. –  André Nicolas Aug 5 '11 at 18:51
    
@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. –  André Nicolas Aug 5 '11 at 19:08
    
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? –  Griffin Aug 5 '11 at 19:26
add comment

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.

share|improve this answer
    
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? –  Griffin Aug 5 '11 at 19:30
    
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$. –  galath Aug 5 '11 at 22:05
    
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. –  galath Aug 6 '11 at 8:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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