Binomial sequence and graph display

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
19 replies · 4K views
physics.alex
Messages
28
Reaction score
0

Homework Statement


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


Homework Equations



If I apply the classic binomial formula, 26C0 (0.8)^0(0.2)^(26-0) etc.. seems cannot do so.
 
Physics news on Phys.org
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
 
like coins flipping
0=H
1=T
p(H)=0.8
p(T)=0.2
 
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?
 
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?
 
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
 
hm..yes we don't 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.
 
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.
 
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.
 
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)
 

Attachments

  • HT.jpg
    HT.jpg
    12 KB · Views: 394
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.
 
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??
 
ok .. if use histogram, we will have only 2 bars, one is shorter than another,right?
 
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