Binomial Distribution when mean and variance is given
Show older comments
How do i plot a Binomial Distribution when i have been given its mean and variance for example like mean = 3, variance = 3 or 0.5,2.......these values dont satisfy the conditions for mean and variance which are mean should lie between 0 and 1 and variance should be less than mean(mean - 1)...But these are the values i have to find the binomial distribution for...this is code i have written....
mu = 3;
var = 3;
alpha = (((1-mu)/var)-1/mu).*mu^2;
beta = alpha((1/mu) - 1);
X = 0:0.01:1;
Y = betapdf(X,alpha,beta);
%plot(X,Y,'LineWidth',1);
xlabel('Thetha');
hold on
mu2 = 0.5;
var2 =2 ;
alpha2 = (((1-mu2)/var2)-1/mu2).*mu2^2;
beta2 = alpha2((1/mu2) - 1);
X2 = 0:0.01:1;
Y2 = betapdf(X2,alpha2,beta2);
plot(X2,Y2,'LineWidth',1);
hold off;
Accepted Answer
More Answers (0)
Categories
Find more on Noncentral t Distribution in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!