Bivariate Gaussian Generator

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • grabonlee
    New Member
    • Jul 2007
    • 8

    #1

    Bivariate Gaussian Generator

    Hi

    Please can anyone write a code to generate random numbers of array length 2 from setMean and setCovariance?
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by grabonlee
    Hi

    Please can anyone write a code to generate random numbers of array length 2 from setMean and setCovariance?
    What is a random number of 'array length 2'?

    kind regards,

    Jos

    Comment

    • grabonlee
      New Member
      • Jul 2007
      • 8

      #3
      Originally posted by JosAH
      What is a random number of 'array length 2'?

      kind regards,

      Jos
      The class Random generates random numbers from a gaussian distribution that is one dimensional(uni variate). My problem is how to generate bivariate random numbers from Mean(1.0,1.0) and Covariance(1.0, 0.0,0.0,1.0)

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Originally posted by grabonlee
        The class Random generates random numbers from a gaussian distribution that is one dimensional(uni variate). My problem is how to generate bivariate random numbers from Mean(1.0,1.0) and Covariance(1.0, 0.0,0.0,1.0)
        Do you know the algorithms for this?

        Here's a good start.

        Comment

        • JosAH
          Recognized Expert MVP
          • Mar 2007
          • 11453

          #5
          From my paper copy of Abramowitz and Stegun (page 953):

          Let { X1, X2 } be a pair of independent N(0,1) deviates. Then deviates
          { X1, rho*X1+(1-rho^2)^1/2*X2 } represent a pair of deviates from a bivariate
          normal distribution with m=0, s=1, correlation coefficient rho.

          There is a N(0,1) pseudo random number generator available, so there you go.

          kind regards,

          Jos

          Comment

          • r035198x
            MVP
            • Sep 2006
            • 13225

            #6
            Originally posted by JosAH
            From my paper copy of Abramowitz and Stegun (page 953):

            Let { X1, X2 } be a pair of independent N(0,1) deviates. Then deviates
            { X1, rho*X1+(1-rho^2)^1/2*X2 } represent a pair of deviates from a bivariate
            normal distribution with m=0, s=1, correlation coefficient rho.

            There is a N(0,1) pseudo random number generator available, so there you go.

            kind regards,

            Jos
            How I could have used such a book in my 2nd year project (Discrete event simulation).

            Comment

            • JosAH
              Recognized Expert MVP
              • Mar 2007
              • 11453

              #7
              Originally posted by r035198x
              How I could have used such a book in my 2nd year project (Discrete event simulation).
              It's quite an old (and famous!) book: it was first printed in 1964; I bought my
              copy ten years later. I guess the current edition is the 10th or 11th edition.

              Go to that link I supplied: it's a full scan of more than 1000 pages; ready for
              downloading. (better late than never ;-)

              kind regards,

              Jos

              Comment

              • r035198x
                MVP
                • Sep 2006
                • 13225

                #8
                Originally posted by JosAH
                It's quite an old (and famous!) book: it was first printed in 1964; I bought my
                copy ten years later. I guess the current edition is the 10th or 11th edition.

                Go to that link I supplied: it's a full scan of more than 1000 pages; ready for
                downloading. (better late than never ;-)

                kind regards,

                Jos
                Yep I've got the download link, I'm downloading it now. I really should have known about that book.

                Comment

                • grabonlee
                  New Member
                  • Jul 2007
                  • 8

                  #9
                  Originally posted by r035198x
                  Do you know the algorithms for this?

                  Here's a good start.
                  Hi
                  the link you sent is for matlab.
                  I want to write a class that wraps up a random number generator given the following instance methods;

                  void setMean(float,f loat)
                  void setCovariance(f loat,float,floa t)
                  float[] generateRandom( )

                  Comment

                  • JosAH
                    Recognized Expert MVP
                    • Mar 2007
                    • 11453

                    #10
                    Originally posted by grabonlee
                    Hi
                    the link you sent is for matlab.
                    I want to write a class that wraps up a random number generator given the following instance methods;

                    void setMean(float,f loat)
                    void setCovariance(f loat,float,floa t)
                    float[] generateRandom( )
                    Did you read my reply for starters? Next: google shows quite some results on
                    "bivariate normal distribution".

                    kind regards,

                    Jos

                    Comment

                    • r035198x
                      MVP
                      • Sep 2006
                      • 13225

                      #11
                      Originally posted by grabonlee
                      Hi
                      the link you sent is for matlab.
                      I want to write a class that wraps up a random number generator given the following instance methods;

                      void setMean(float,f loat)
                      void setCovariance(f loat,float,floa t)
                      float[] generateRandom( )
                      And again :
                      Quote=You
                      "My problem is how to generate bivariate random numbers from Mean(1.0,1.0) and Covariance(1.0, 0.0,0.0,1.0)"

                      The link teaches (not states) how to generate random numbers using a computer program.

                      Comment

                      Working...