1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Binomial sequence and graph display

  1. Jul 13, 2010 #1
    1. The problem statement, all variables and given/known data
    Given a series of 0 and 1 , how can we plot the binomial curve ??
    Example: 00000011100010010100011110

    say,p=0.8 q=0.2, N=26


    2. Relevant equations

    If I apply the classic binomial formula, 26C0 (0.8)^0(0.2)^(26-0) etc.. seems cannot do so.
     
  2. jcsd
  3. Jul 13, 2010 #2

    vela

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Education Advisor

    It's not really clear what you're trying to do. Could you provide more details?
     
  4. Jul 13, 2010 #3
    sorry my question is unclear
    objective: plot a binomial distribution curve by giving a sequence of '0' and '1'

    Example: 00000011100010010100011110

    say,p=0.8 q=0.2, N=26
     
  5. Jul 13, 2010 #4

    vela

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Education Advisor

    What are the 0s and 1s supposed to represent? The result of 26 trials with p=0.8? You can't get a binomial distribution curve from just that.
     
  6. Jul 13, 2010 #5
    like coins flipping
    0=H
    1=T
    p(H)=0.8
    p(T)=0.2
     
  7. Jul 13, 2010 #6

    vela

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Education Advisor

    Can you provide the complete text of the problem? You seem to be leaving out info that might make your question make sense.

    Right now, you're asking something like: given that you rolled a pair of dice and they came up 2 and 4, how can we plot the probability distribution of all the possible outcomes?
     
  8. Jul 13, 2010 #7
    Given a biasd coin and flip 26 times.
    Example: HHHTTTHHHTTTTHHT p(H)=0.8
    How to interpret the sequence using Binomial distribution? and How is the graph looks like?
     
  9. Jul 13, 2010 #8

    vela

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Education Advisor

    What's the probability of getting n heads and m tails in (n+m) trials?
     
  10. Jul 13, 2010 #9
    sorry the question is already posted.
    We can make our assumption as long as it is a biased coin.

    Example: total 26 trials (n+m) and prob. of getting head is 0.8
    does it make sense??
    The main objective is to show that in biased case, the plotted curve is easily be distinguished by just observing the graph
     
  11. Jul 13, 2010 #10

    vela

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Education Advisor

    So are you just asking how to plot the binomial distribution when it's hard to calculate because the numbers are big or small? You don't have an actual sequence of 1s and 0s, right?
     
  12. Jul 13, 2010 #11
    hm..yes we dont have the actual sequence according to the question.

    what is wrong with the question?? The main objective is to plot the graph and see these 2 results (i.e.H or T) has a easy distinguished pattern. If it is the unbiased coin, i.e. p(h)=0.5, the pattern is not easy to distinguish.
     
  13. Jul 13, 2010 #12

    vela

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Education Advisor

    There's nothing wrong with the question; it's the way you asked it. It sounded like you were provided with a random sequence of 26 1s and 0s and wanted to somehow extract the binomial distribution from it.

    Usually, when the numbers get too unwieldy to calculate the binomial distribution directly, you can approximate it by a normal distribution with the same mean and variance.
     
  14. Jul 13, 2010 #13

    vela

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Education Advisor

    Or do you want to generate a bunch of data and try to empirically produce the binomial distribution? If that's the case, just generate a bunch of sets of N ones and zeros randomly, and for each set, count the number of times one appears. Make a histogram of the results, and it should approach a binomial distribution.
     
  15. Jul 13, 2010 #14
    Ok if I take your approach, randomly generate 1 and 0, and would like to plot the histogram, what is the x-axis? y-axis should be the probability,right?
    I use Matlab and run the following

    clear;
    x1=1:102;
    y1 = binopdf(x1,102,0.2);

    x2=1:102;
    y2 = binopdf(x2,102,0.8);

    plot(x1,y1,'+',x2,y2,'ro');

    xlabel('symbols');
    ylabel('probability');
    title('Biased prob. of symbol H and symbol T');
    legend('symbol H','symbol T');

    I got the graph with two distribution with same height (i.e. same probability) and sounds doesn't make sense to me. (see attachment)
     

    Attached Files:

    • HT.jpg
      HT.jpg
      File size:
      12 KB
      Views:
      113
  16. Jul 13, 2010 #15

    vela

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Education Advisor

    Your code doesn't generate any random numbers. The function binopdf is the binomial probability density function.

    You calculated the probability of x heads and, separately, the probability of y tails both out of n trials. Do you see why the probability of x heads is equal to the probability of n-y tails? If you understand that, it should make sense why you got the two curves you did.
     
  17. Jul 13, 2010 #16
    Because the only difference of these 2 curves is the p which can controls the curve position.
    So you mean we cannot do so,right? How can I obtain 2 curves that easily to distinguish the H and T clusters??
     
  18. Jul 13, 2010 #17

    vela

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Education Advisor

    It seems I still have no idea what you're trying to do.
     
  19. Jul 13, 2010 #18
    ok .. if use histogram, we will have only 2 bars, one is shorter than another,right?
     
  20. Jul 13, 2010 #19

    vela

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Education Advisor

    No. What exactly are you trying to do?
     
  21. Jul 13, 2010 #20
    I am thinking what the graph looks like from your reply

    "Or do you want to generate a bunch of data and try to empirically produce the binomial distribution? If that's the case, just generate a bunch of sets of N ones and zeros randomly, and for each set, count the number of times one appears. Make a histogram of the results, and it should approach a binomial distribution. "

    I am trying to plot the graph that you suggested
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook