+ Reply to Thread
Results 1 to 7 of 7

Bivariate Poisson VBA

  1. #1
    Registered User
    Join Date
    10-29-2012
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    49

    Bivariate Poisson VBA

    Hi, I'm trying to get Excel to calculate a part of a Bivariate Poisson function (mathematical formula attached as document). I have part of the formula I need, but I can't seem to get the right value using VBA- here is my code so far, but it doesn't look right:

    Please Login or Register  to view this content.
    Can someone help please?
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    07-16-2012
    Location
    Ontario Canada
    MS-Off Ver
    Excel 2010
    Posts
    124

    Re: Bivariate Poisson VBA

    I think it might be because of where your k=0 is placed.
    It should be outside the do until loop shouldnt it?
    You initialize k as 0 then sum until min(x,y)

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-29-2012
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: Bivariate Poisson VBA

    Quote Originally Posted by jason_lee_91 View Post
    I think it might be because of where your k=0 is placed.
    It should be outside the do until loop shouldnt it?
    You initialize k as 0 then sum until min(x,y)

    Please Login or Register  to view this content.
    Hi, that solved my initial problem- however I don't think the values I'm getting are correct. For instance, using the function in my document, pbivpois(0,0) should be 1. However I am getting 0 instead...

  4. #4
    Forum Contributor
    Join Date
    07-16-2012
    Location
    Ontario Canada
    MS-Off Ver
    Excel 2010
    Posts
    124

    Re: Bivariate Poisson VBA

    That is because min(0,0)=0 and the do until loop terminates before the first iteration.
    Try changing it to a Do While <= min(x,y)
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-29-2012
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: Bivariate Poisson VBA

    Quote Originally Posted by jason_lee_91 View Post
    That is because min(0,0)=0 and the do until loop terminates before the first iteration.
    Try changing it to a Do While <= min(x,y)
    Please Login or Register  to view this content.
    Cheers, it seems to work once I move the pbivpois=0 out of the "do while" loop! Thanks a lot for the help. This is the final answer:

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    07-16-2012
    Location
    Ontario Canada
    MS-Off Ver
    Excel 2010
    Posts
    124

    Re: Bivariate Poisson VBA

    Ah!
    Haha I cant believe I moved the k=0 out but forgot to move the pbivpois=0.
    Cool piece of code though.
    Seems like a neat project your working on

  7. #7
    Registered User
    Join Date
    02-24-2015
    Location
    Melbourne, Australia
    MS-Off Ver
    2010
    Posts
    1

    Re: Bivariate Poisson VBA

    Thanks for working through that - I have been playing with Bivariate Poisson for some time and your code is VERY helpful
    Cheers

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Poisson distribution
    By hnasir in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-19-2012, 03:47 PM
  2. Poisson Distribution--Help
    By neocube in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-08-2011, 07:24 AM
  3. modelling bivariate zero-inflated poisson
    By ryusukekenji in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-18-2009, 05:41 PM
  4. Poisson distribution
    By swfc in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-23-2008, 07:02 PM
  5. [SOLVED] Poisson Distribution
    By Capote in forum Excel General
    Replies: 1
    Last Post: 04-02-2006, 11:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1