Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Probability density function of a function of a random variable

  1. Sep 25, 2011 #1
    Hello everyone!
    I am stuck in my research with a probability density function problem..
    I have 'Alpha' which is a random variable from 0-180. Alpha has a uniform pdf equal to 1/180.
    Now, 'Phi' is a function of 'Alpha' and the relation is given by,
    Phi = (-0.000001274370471*Alpha^4) + (0.000393888213304*Alpha^3) - (0.037767210716686*Alpha^2) + (1.66089231837634*Alpha) - 5.83257204679921
    I am trying to find the PDF of 'Alpha' but having a hard time in doing that..

    Any help will be greatly appreciated!

    Thanks.
     
  2. jcsd
  3. Sep 25, 2011 #2
    Do you mean the PDF of Phi? I understood you to have said alpha was uniform.
     
  4. Sep 26, 2011 #3
    Oh yes, I meant PDF of Phi...sorry for that typing mistake..I am trying to find the PDF of Phi.
     
  5. Sep 26, 2011 #4

    chiro

    User Avatar
    Science Advisor

    Hey Sameer_1987 and welcome to the forums.

    Before attempting to find an analytic or even piece-wise analytic representation of your PDF, you should try using simulation to get an idea of what the PDF looks like.

    In terms of getting an analytic version of the PDF, your best bet is to use two tools: the first is the transformation theorem that allows you to get the PDF of a transformed variable, and the second tool is the convolution theorem.

    The convolution theorem will be used if you have say two random variables X and Y, then the PDF of P(X + Y < s) is given by taking the convolution of PDF(X) with PDF(Y).

    What you are probably better off doing is to break up your transformation into parts, like changing Phi = (-0.000001274370471*Alpha^4) + (0.000393888213304*Alpha^3) - (0.037767210716686*Alpha^2) + (1.66089231837634*Alpha) - 5.83257204679921 into
    Phi = A + B + C + D + E and using the convolution theorem to get the CDF of the sum of all the variables and hence the PDF using differentiation.

    But before doing anything analytic, do a decent simulation and get a visual idea of what the distribution should look like. I would try 10,000 or 50,000 samples at the minimum which should give at least a rough idea of the distribution. You can do this quite easily in R using the command runif (type "runif" in R to get help for supplying arguments).
     
  6. Sep 26, 2011 #5
    Hi Chiro, Thanks for the reply

    I have only one random variable(i.e Alpha) ? Can I still use the convolution theorem?
    Also, my Alpha is a random variable between 0-180. So I am not sure if I can get a sample of about 10,000.

    Thanks!
     
  7. Sep 26, 2011 #6
    Hi Bacle,
    Oh yes, I meant PDF of Phi...sorry for that typing mistake..I am trying to find the PDF of Phi.
     
  8. Sep 26, 2011 #7

    Stephen Tashi

    User Avatar
    Science Advisor

    No, it doesn't apply.

    Are you saying that Alpha takes only discrete values? 0,1,2...,180? Even if it does, why would that prevent you from taking a sample of 10,000? There's nothing wrong with repeated values in a sample of 10,000.
     
  9. Sep 26, 2011 #8
    Right, I can have 10,000 values or more between 0-180....Thanks!
     
  10. Sep 26, 2011 #9
    Can you tell me how I can find out, what kind of distribution I have?..I mean with the given expression of phi in terms of Alpha(which is a random variable between 0-180), can I find out what kind of distribution will phi have?

    Thank you!
     
  11. Sep 26, 2011 #10

    Stephen Tashi

    User Avatar
    Science Advisor

    Do you understand the basic idea of how to do it?

    Graph the function

    [tex] \Phi(\alpha) = (-0.000001274370471*\alpha^4) + (0.000393888213304*\alpha^3) - (0.037767210716686*\alpha^2) + (1.66089231837634*\alpha) - 5.83257204679921 [/tex]

    on the interval [itex] [0, 180.0] [/itex].

    (I'm sure you're not the first person who encountered this type of problem and people may developed slick ways of handling it. What I describe is what you do if you just put one foot in front of the other. )

    Let [itex] F(y) [/itex] be the cumulative distribution of [itex] \Phi [/itex]. To find a the value of [itex] F(y) [/itex] at particular value of [itex] y [/itex] draw a horizontal line through (0,y) on your graph. Look at the parts of the graph that fall below that line. Look at the points on the horizontal axis that are the [itex] \alpha [/itex] values corresponding to those parts of the graph. In your case, these points on the horizontal axis will form one or more intervals. The value of F(y) is the probabilty that [itex] \alpha [/itex] falls in one of these intervals. Since [itex] \alpha [/itex] is uniformly distributed, you can find the probability by adding up the total length of the intervals and multiplying it by (1/180).

    To find the density of [itex] \Phi [/itex] you would compute (or approximate) the derivative of [itex] F(y) [/itex].

    Now suppose we try to do the above process analytically. To find [itex] F(y) [/itex] we must solve the inequality [itex] \Phi(\alpha) \leq y [/itex]. Since we know the answer will be intervals, it is sufficient to solve the equation [itex] \Phi(\alpha) = y [/itex] in order to find their endpionts. I think this type of equation is called a "quartic" and you can look up a formula for solving it.

    Since you are going to have various cases ( on interval, two intervals), I suspect the function [itex] F(y) [/itex] is not going to be given by a simple algebraic formula. It will probably be defined on several intervals with different formula applied on each of them.
     
  12. Sep 26, 2011 #11
    Thank you Stephen! This should be really helpful.
     
  13. Sep 26, 2011 #12

    chiro

    User Avatar
    Science Advisor

    The reason I suggested convolution is basically so that you break up your polynomial into parts that are easier to deal with and then use convolution on those distributions to get your final CDF and hence your PDF.

    For example you have a polynomial ax^4 + bx^3 and so on. What I suggest is you look at each term separately and then use convolution to get the addition of terms.
     
  14. Sep 27, 2011 #13

    Mute

    User Avatar
    Homework Helper

    I don't think that will work. That convolution theorem requires that the random variables are independent, which is not the case here. It is the same instance of the random variable in all terms of the polynomial.

    The easiest way to do it analytically is what Stephen Tashi suggested, I think. Given [itex]\phi = \Phi(\alpha)[/itex], then if you know the CDF for alpha is [itex]F(\alpha)[/itex], the CDF of phi is just [itex]F(\alpha = \Phi^{-1}(\phi))[/itex]. The trick here, as has been suggested, is that the function [itex]\Phi(\alpha)[/itex] is not 1 to 1, so the inverse function will have different branches, and you will have to stitch them together somehow to get the true distribution function. The numerical simulation will come in handy for trying to stitch the roots together.

    And... it might not be pretty. Solving [itex]\phi = \Phi(\alpha)[/itex] for alpha using wolframalpha gives some ugly-looking roots. Of course, wolframalpha it hasn't simplified the expression much - there are factors with large positive powers and large negative powers that could probably be simplified somewhat. Maybe if I had used mathematica it could be massaged somewhat.
     
  15. Sep 27, 2011 #14
    Hi, Sameer:

    Just a technical point, Re Tashi's comment about finding a solution for a quartic:

    there is no general formula for sorving a quartic; it is

    a result by Galois that there is no general method for an n-th degree equation

    for n>3 , tho I think if you find the Galois group of the polynomial, you may be able

    to find the roots.
     
  16. Sep 27, 2011 #15

    chiro

    User Avatar
    Science Advisor

    I see what you are saying and I agree, but even then inverting a polynomial with the right cuts in the domain is gonna be "interesting" to say the least.

    I still think though that the OP should do some simulation to get a feel of what the distribution looks like. They could use that to verify that the PDF that they calculate is correct. They could even use some kind of interpolation scheme to get an PDF that is a good enough approximation.

    If you are out there OP, let us know how you go.
     
  17. Sep 27, 2011 #16
    Thank you Gentlemen for your inputs! I will work on this and keep you updated.

    Thanks again.
     
  18. Oct 2, 2011 #17

    Hi Stephen,

    By 'y' do you mean 'phi'? I have attached a jpeg file which shows what I have done. I am not sure how to use the 'Alpha' intervals that I have got. Also, I think I can solve the quartic equation using the 'depressing the quartic' method that I read somewhere recently.

    Thanks!
     

    Attached Files:

  19. Oct 2, 2011 #18

    Stephen Tashi

    User Avatar
    Science Advisor

    Phi is a particular function of alpha. Y is an arbitrarily selected value on the vertical axis.

    To find the cumulative density F(y) of Phi, you must find formulae that give an answer for all possible values of y.

    The particular y = 45 that you selected shows that

    [tex] F(45) = \frac{ (95 - 0) + (180 - 175) } { 180 } [/tex]
     
  20. Oct 2, 2011 #19
    Hi Chiro,

    I calculated a histogram of phi in 'R' language using the runif function as,

    Alpha=runif(50000,0,180)

    Phi=(−0.000001274370471*Alpha^4)+(0.000393888213304*Alpha^3)−(0.037767210716686*Alpha^2)+(1.66089231837634*Alpha)−5.83257204679921

    Hist(Phi, breaks=50)

    and got a histogram. I have attached the image of the histogram. I am not sure what kind of distribution that is or which kind of PDF distribution will give the closest answer. But maybe by analytically evaluating the PDF, I will get a more clear picture.


    Thanks
     
  21. Oct 2, 2011 #20
    I think I forgot to attach the histogram image file in the last message.
     

    Attached Files:

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook