Like Tree1Likes
  • 1 Post By swarup

Adaptive Rejection Sampling

This is a discussion on Adaptive Rejection Sampling within the C Programming forums, part of the General Programming Boards category; Hi All, I have written a c-code for for generating samples from joint posterior density using Gibbs sampling technique. I ...

  1. #1
    Registered User
    Join Date
    Aug 2011
    Posts
    1

    Adaptive Rejection Sampling

    Hi All,

    I have written a c-code for for generating samples from joint posterior density using Gibbs sampling technique. I have used Adaptive Rejection sampling (Wild & Gilks (1993)) to generate
    samples from the univariate conditional density. However, the code is working fine for some cases,
    for some cases it is not working. Is anybody aware of the source code for ARS? I can share my code if you can help me to find out the bug in the code.

    Regards,

    swarup.
    Arun Kaushik likes this.

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Post the relevent code sections... also whatever warnings and errors your compiler is coming up with...

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,334
    Is this a "produces the wrong answer" kind of doesn't work, or "crashes with segfault" kind of doesn't work?

    Plus, looking at someone else's code (assuming there is any to find) won't tell you much about how you messed up your code.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    I love these kinds of thread starters. Analogous perhaps to:

    "Doctor, I have a pain - somewhere, sometimes. Can you tell me what's wrong with me, over the phone?"

    Sure thing, let me just check with the Gypsy lady down the block here. . . < lol >

  5. #5
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Adak View Post
    I love these kinds of thread starters. Analogous perhaps to:

    "Doctor, I have a pain - somewhere, sometimes. Can you tell me what's wrong with me, over the phone?"

    Sure thing, let me just check with the Gypsy lady down the block here. . . < lol >

    LOL...

    A guy walks into a doctor's office, hooks his thumb over the edge of the desk and whacks it with a hammer...

    Guy: "Doc, it hurts like he** every time I do this, can you help me?"
    Doc: "Stop doing that."

  6. #6
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,261
    Quote Originally Posted by swarup View Post
    Is anybody aware of the source code for ARS?
    You make it sound like there's only one implementation on the planet.

    Perhaps you mean the algorithm?
    We need a few things to get anywhere at all:
    1. A description of what "not working" means. We have to know what on earth we are looking for.
    2. Some source code containing the bug.
    2. A nice-to-have: List of the compiler warnings that the code produces. Whilst we'll look over the code, most of us won't bother to actually compile it.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  7. #7
    Registered User
    Join Date
    May 2009
    Posts
    2,372
    3 Minutes Googling got me this link
    Adaptive Rejection Sampling

    Tim S.

  8. #8
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,866
    Quote Originally Posted by stahta01 View Post
    3 Minutes Googling got me this link
    Adaptive Rejection Sampling
    Tim S.
    Googling, what's that?
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Uniform sampling
    By Dedalus in forum C Programming
    Replies: 6
    Last Post: 06-29-2009, 04:30 PM
  2. Help with adaptive Huffman theory question
    By tms43 in forum C++ Programming
    Replies: 3
    Last Post: 12-03-2006, 11:24 AM
  3. Sampling rate help
    By cbraddoss in forum C++ Programming
    Replies: 0
    Last Post: 09-16-2005, 09:31 AM
  4. Problem with Monte Carlo(integration by rejection)
    By dionys in forum C Programming
    Replies: 9
    Last Post: 04-07-2004, 09:53 AM
  5. Possible to write adaptive programs?
    By crag2804 in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 06-16-2003, 04:35 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21