Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.1 - Português

Change language to:
English - Français - 日本語 - Русский

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

Ajuda do Scilab >> Estatística > Cumulated Distribution Functions > binomial

binomial

probabilidades de distribuição binomial

Seqüência de Chamamento

pr = binomial(p, n)

Parâmetros

pr

vetor linha com n+1 componentes

p

número real em [0,1]

n

um inteiro >= 1

Descrição

pr=binomial(p,n) retorna o vetor de probabilidade binomial, i.e. pr(k+1) é a probabilidade de k successos em n tentativas independentes de Bernoulli com probabilidade de sucesso p. Em outras palavras : pr(k+1) = probability(X=k) ,com X uma variável aleatória, segundo a distribuição B(n,p) , e numericamente :

pr(k+1) = p^k (1-p)^(n-k) n!/[k!(n-k)!]

Exemplos

// primeiro exemplo
n=10;p=0.3; clf(); plot2d3(0:n,binomial(p,n));

// segundo exemplo
n=50;p=0.4;
mea=n*p; sigma=sqrt(n*p*(1-p));
x=( (0:n)-mea )/sigma;
clf()
plot2d(x, sigma*binomial(p,n));
deff('y=Gauss(x)','y=1/sqrt(2*%pi)*exp(-(x.^2)/2)')
plot2d(x, Gauss(x), style=2);

// pela fórmula binomial (cuidado, se n for grande)
function pr=binomial2(p, n)
x=poly(0,'x');pr=coeff((1-p+x)^n).*horner(x^(0:n),p);
endfunction
p=1/3;n=5;
binomial(p,n)-binomial2(p,n)

// pela função gama: gamma(n+1)=n! (cuidado, se n for grande)
p=1/3;n=5;
Cnks=gamma(n+1)./(gamma(1:n+1).*gamma(n+1:-1:1));
x=poly(0,'x');
pr=Cnks.*horner(x.^(0:n).*(1-x)^(n:-1:0),p);
pr-binomial(p,n)

Ver Também

  • cdfbin — cumulative distribution function Binomial distribution
  • grand — Random numbers
Report an issue
<< Cumulated Distribution Functions Cumulated Distribution Functions cdfbet >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Jan 03 14:35:25 CET 2022