Sei sulla pagina 1di 37

# Proiect Probabilitati si Statistici

Birca Andreea
January 29, 2016
Grupa 254
Profesor coordonator: Canepa Cristina

REPARTITII DISCRETE

1.1. Binomiala
Variabila aleatoare X are o repartitie binomiala de parametrii n si p daca
functia sa de probabilitate este data de probabilitatea pn (x) din schema urnei
lui Bernoulli, adica f (x) = Cnx px q nx ,p (0, 1), n N , p+q=1. Deci:


x
X:
Cnx px q nx
Media: M(x)=np
Dispersia: D(x)=npq

Cdf :
x=[0:0.1:10];
a=binocdf(x,10,0.2);
b=binocdf(x,10,0.3);
c=binocdf(x,10,0.4);
plot(x,a,r,x,b,g,x,c,b)
hold on
grid on
legend(Bi(10,0.2),Bi(10,0.3),Bi(10,0.4))
title(Functia de repartitie binomiala)

Pdf :
x=0:10;
a=binopdf(x,10,0.2);
b=binopdf(x,10,0.3);
c=binopdf(x,10,0.4);
plot(x,a,*,x,b,+,x,c,o)
title(Repartitia binomiala)
legend(Bi(10,2/10),Bi(10,3/10),Bi(10,4/10))

p=

2
10 , n

= 10 :

2 3 4 103
3
) (5)
=
P (x = 3) = C10
( 10

1179648
5859375

= 0.201

Pdf Cfd :
x=[0:0.1:10];
a=binocdf(x,10,0.2);
plot(x,a,r)
hold on
grid on
y=0:10;
b=binopdf(y,10,0.2);
plot(y,b,+)
title(PDF CDF)

legend(CDF,PDF)

Histograma :
a=binornd(10,0.2,1,1000);
b=binornd(10,0.3,1,1000);
c=binornd(10,0.4,1,1000);
hist(a)
hold on
hist(b)
h=findobj(gca,Type,patch);
set(h(1),FaceColor,r,EdgeColor,w)
set(h(2),FaceColor,b,EdgeColor,w)
hold on
hist(c)
title(Histograma Binomiala)
legend(Bi(10,2/10),Bi(10,3/10),Bi(10,4/10))

1.2. Poisson

## O variabila aleatoare X are repartitie Poisson daca functia sa de probabilitate

x
este de forma f (x) = e x! , x N , > 0.

X:

Media: M(x)=
Dispersia: D(x)=
Cdf :
x=[0:0.1:10];
a=poisscdf(x,3);
b=poisscdf(x,6);
plot(x,a,b,x,b,r)
hold on
grid on
title(Functia de repartitie Poisson)
legend(lambda=3,lambda=6)

x
x!

Pdf :
x=0:10;
y=poisspdf(x,3);
z=poisspdf(x,6);
plot(x,y,+,x,z,*)
title(Repartitia Poisson)
legend(3,6)

=3:
3 1
P (x = 1) = e 31! =

3
e3

= 0.1507

Pdf Cfd :
x=[0:0.1:10];
a=poisscdf(x,3);
plot(x,a,r)
hold on
grid on
y=0:10;
b=poisspdf(y,3);
plot(y,b,+)
title(PDF CDF)
legend(CDF,PDF)

Histograma :
a=poissrnd(3,1,1000);
b=poissrnd(6,1,1000);
c=poissrnd(10,1,1000);
subplot(1,2,1);
hist(a)
hold on
hist(b)
h=findobj(gca,Type,patch);
set(h(1),FaceColor,r,EdgeColor,w)
set(h(2),FaceColor,b,EdgeColor,w)
hold on
hist(c)
title(Histograma Poisson)
legend(3,6,10)

1.3. Geometrica
Numim variabila aleatoare geometrica cu parametrul p (0, 1) variabila
aleatoare X reprezentnd numarul de incercari efectuate intr-un sir de
experimente Bernoulli independente, cu acelasi parametru p, pna la aparitia
primului succes, adica X= numarul incercari efectuate pana la prima aparitie
a succesului. f (x) = q x1 p, x N, p [0, 1], p + q = 1


1 2 3 4 ...
X:
p1 p2 p3 p4 ...
Media: p1
Dispersia:

1p
p2

Cdf :
x = [1:0.1:10];
y1 = geocdf(x,0.1);
y2 = geocdf(x,0.25);
y3 = geocdf(x,0.75);
plot(x,y1,r)
hold on
plot(x,y2,b)
plot(x,y3,g)
legend(p = 0.1,p = 0.25,p = 0.75)
title(Functia de repartitie Geometrica)

10

Pdf :
x = [1:10];
y1 = geopdf(x,0.1);
y2 = geopdf(x,0.25);
y3 = geopdf(x,0.75);
figure;
plot(x,y1,*)
hold on
plot(x,y2,ro)
plot(x,y3,b+)
legend(p = 0.1,p = 0.25,p = 0.75)
title(Repartitia Geometrica)

## p = 0.75, q = 0.25 : P (x = 6) = 0.255 0.75 = 0.0001

Pdf Cfd :
x = [1:0.1:10];
y1 = geocdf(x,0.1);
plot(x,y1,r)
hold on
grid on
y = [1:10];
y1 = geopdf(y,0.1);
plot(y,y1,*)
hold on
title(PDF CDF)
legend(CDF,PDF)
11

Histograma : a=geornd(0.1,1,1000);
b=geornd(0.25,1,1000);
c=geornd(0.75,1,1000);
subplot(1,2,1);
hist(a)
hold on
hist(b)
h=findobj(gca,Type,patch);
set(h(1),FaceColor,r,EdgeColor,w)
set(h(2),FaceColor,b,EdgeColor,w)
hold on
hist(c)
title(Histograma Geometrica)
legend(p=0.1,p=0.25,p=0.75)

12

13

1.4. Hipergeometrica
Variabila aleatoare X are repartitie hipergeometrica daca functia sa de
probabilitate este data de probabilitatea Pn (X) din schema urnei cu bila
nerevenita (Aceasta schema presupunea ca dintr-o urna cu N bile, din care a
erau albe si b erau negre, se extrag n bile. Pn este probabilitatea ca din cele n
bile extrase x sa fie albe.). Deci
f (x) =

nx
Cax CN
a
,x
n
CN

(0, K, n), 0 a N, 0 n N
x
X:

nx
Cax CN
a
n
CN

Media: M (x) = np p = Na
n
Dispersia: D(x) = npq N
N 1
Cdf :
x=[0:0.1:10];
a=hygecdf(x,10,5,2);
b=hygecdf(x,10,5,3);
c=hygecdf(x,10,5,4);
plot(x,a,b,x,b,g,x,c,r)
hold on
grid on
title(Functia de repartitie Hipergeometrica)
legend(m=2,m=3,m=4)

14

Pdf :
x=0:10;
a=hygepdf(x,10,5,2);
b=hygepdf(x,10,5,3);
c=hygepdf(x,10,5,4);
plot(x,a,o,x,b,*,x,c,+)
title(Repartitia Hipergeometrica) legend(m=2,m=3,m=4)

N = 10, a = 5, n = 2 :
C 1 C 21

P (x = 1) = 5 C 2105 =
10
Pdf Cfd :
x=[0:0.1:10];
a=hygecdf(x,10,5,2);
plot(x,a,b)
hold on
grid on
x=0:10;
a=hygepdf(x,10,5,2);
plot(x,a,o);
hold on
title(PDF CDF)
legend(CDF,PDF)

5
9

= 0.55

15

Histograma :
a=hygernd(10,5,2,1,1000);
b=hygernd(10,5,3,1,1000);
c=hygernd(10,5,4,1,1000);
hist(a)
hold on
hist(b)
h=findobj(gca,Type,patch);
set(h(1),FaceColor,r,EdgeColor,w)
set(h(2),FaceColor,b,EdgeColor,w)
hold on
hist(c)
title(Histograma Hipergeometrica)
legend(m=2,m=3,m=4)

16

17

REPARTITII CONTINUE

2.1. Uniforma
O variabil aleatoare X , continua, are repartitie uniforma daca functia sa de
1
probabilitate este de forma f (x) = ba
, x (a, b)
a+b
2
2
Dispersia: (ab)
12

Media:

Cdf :
x=[0:1:10]
a=unifcdf(x,4,6);
b=unifcdf(x,4,7);
c=unifcdf(x,4,8);
plot(x,a,r,x,b,g,x,c,b)
title(Functia de repartitie uniforma)
legend(a=4,b=6,a=4,b=7,a=4,b=8)

18

Pdf :
x=[0:1:10]
a=unifpdf(x,4,6);
b=unifpdf(x,4,7);
c=unifpdf(x,4,8);
plot(x,a,o,x,b,*,x,c,+)
legend(a=4,b=6,a=4,b=7,a=4,b=8)
title(Repartitia Uniforma)

a = 4, b = 8 :
1
P (x = 4) = 84
= 0.25
Pdf Cfd :
x=[0:1:10]
y=unifcdf(x,1,4);
plot(x,y,r)
hold on
grid on
y=[0:1:10]
a=unifpdf(y,1,4);
plot(y,a,o);
hold on
title(PDF CDF)
legend(CDF,PDF)

19

Histograma
x=unifrnd(4,6,1,1000);
y=unifrnd(4,7,1,1000);
z=unifrnd(4,8,1,1000);
hist(a)
hold on
hist(b)
h=findobj(gca,Type,patch);
set(h(1),FaceColor,r,EdgeColor,w)
set(h(2),FaceColor,b,EdgeColor,w)
hold on
hist(c)
title(Histograma Uniforma)
legend(a=4,b=6,a=4,b=7,a=4,b=8)

20

21

2.2. Exponentiala
Fie X : [0; ) o variabila aleatoare avand functia de repartitie
f (x) = 1 ex , > 0
Cdf :
x=[0:0.1:20];
y=expcdf(x,2.3);
z=expcdf(x,2.6);
t=expcdf(x,4.6);
plot(x,y,r,x,z,y,x,t,b)
legend(lambda=2.3,lambda=2.6,lambda=4.6)
title(Functia de repartitie Exponentiala)

Pdf :
x=[1:1.5:35];
y=exppdf(x,2.6);
z=exppdf(x,3.6);
t=exppdf(x,4.6);
plot(x,y,o,x,z,*,x,t,+)
legend(lambda=2.6,lambda=3.6,lambda=4.6)
title(Repartitia Exponentiala)

22

Pdf Cfd :
x=[0:0.1:20];
y=expcdf(x,4);
plot(x,y,r)
hold on
grid on
x1=[1:1.5:35];
y1=exppdf(x1,4);
plot(x1,y1,+)
hold on
title(PDF CDF)
legend(CDF,PDF)

23

Histograma Exponentiala
x=[0:0.2:20];
a=exprnd(2.6,1,1000);
b=exprnd(3.6,1,1000);
c=exprnd(4.6,1,1000);
h1=histogram(a)
hold on
h2=histogram(b)
hold on
h3=histogram(c)
h1.Normalization = probability;
h1.BinWidth = 0.25;
h2.Normalization = probability;
h2.BinWidth = 0.25;
h3.Normalization = probability;
h3.BinWidth = 0.25;
title(Histograma Exponentiala)
legend(lambda=2.6,lambda=3.6,lambda=4.6)

24

25

2.3. Normala
O variabila aleatoare X are o repartitie normala daca functia sa de
probabilitate este de forma f (x) =

1 xm
1 e 2 ( )
2

Media : M (x) = m
Dispersia : D(x) = 2
Cdf :
x=[-20:0.1:20];
y=normcdf(x,-5,2.3);
z=normcdf(x,-2,2.3)
t=normcdf(x,2,2.3);
plot(x,y,r,x,z,g,x,t,b,x,z,y)
legend(m=-5,m=-2,m=2)
title(Functia de repartitie Normala)

26

, unde m R, > 0

Pdf :
x=[-20:1:20];
y=normpdf(x,-5,2.3);
z=normpdf(x,-2,2.3)
t=normpdf(x,2,2.3);
plot(x,y,o,x,z,*,x,t,+) legend(mu=-5,mu=-2,mu=2)
title(Repartitie Normala)

Pdf Cfd :
x=[-20:0.1:20];
y=normcdf(x,0,4);
plot(x,y,r)
hold on
grid on
x1=[-20:1:20];
y1=normpdf(x1,-5,2.3);
plot(x1,y1,o)
hold on
title(PDF CDF)
legend(CDF,PDF)

27

Histograma Normala
x=normrnd(-5,2.3,1,1000);
y=normrnd(-2,2.3,1,1000);
z=normrnd(2,2.3,1,1000);
h1=histogram(x)
hold on
h2=histogram(y)
hold on
h3=histogram(z)
h1.Normalization = probability;
h1.BinWidth = 0.25;
h2.Normalization = probability;
h2.BinWidth = 0.25;
h3.Normalization = probability;
h3.BinWidth = 0.25;
legend(m=-5,m=-2,m=2)
title(Histograma Normala)

28

29

2.4.Gamma
O variabila aleatoare X are repartitie Gamma daca functia sa de repartitie
este de forma:

1
a x
b ,x > 0
(a+1)ba+1 x e
f (x) =
0, x 0
unde
Z
(a + 1) =

## xa ex dx, a > 1, b > 0.

Cdf :
x=[0:0.1:30];
y=gamcdf(x,6,4);
z=gamcdf(x,9,5);
plot(x,y,g,x,z,b)
legend(a=6,b=4,a=9,b=5) title(Functia de repartitie Gamma)

Pdf :
x=[0:1:30];
y=gampdf(x,6,4);
z=gamdf(x,9,5);
plot(x,y,+,x,z,o)
legend(a=6,b=4,a=9,b=5) title(Repartitia Gamma)

30

Pdf Cfd :
x=[0:0.1:30];
y=gamcdf(x,6,4);
plot(x,y,r)
hold on
grid on
x1=[0:1:30];
y1=gampdf(x1,6,4);
plot(x1,y1,o)
hold on
title(PDF CDF)
legend(CDF,PDF)

31

Histograma Gamma
d=gamrnd(6,4,1,1000);
e=gamrnd(9,5,1,1000);
f=gamrnd(13,6,1,1000);
hist(f)
hold on
hist(e)
h=findobj(gca,Type,patch);
set(h(1),FaceColor,r,EdgeColor,w)
set(h(2),FaceColor,b,EdgeColor,w)
hold on
hist(d)
title(Histograma Gamma)
legend(a=6,b=4,a=9,b=5,a=13,b=6)

32

33

2.5. Beta
O variabila aleatoare X are repartitie Beta daca densitatea sa de probabilitate
este de forma:
(
b1
1
a1
(1 x) , x [0, 1], a > 0, b > 0
(a,b) x
f (x, a, b) =
0, x (, 0) (1, )
Z
(a, b) =

b1

xa1 (1 x)

0
a
Media: M (x) = a+b
Dispersia: D(x) = (a+b)2ab
(a+b+1)

Cdf :
x=[0:0.1:10];
a=betacdf(x,2,2);
b=betacdf(x,6,6);
plot(x,a,g,x,b,r)
legend(a=2,b=2,a=6,b=6)
title(Functia de repartitie Beta)

34

dx

Pdf :
x=[0:0.2:10];
a=betapdf(x,2,2);
b=betapdf(x,6,6);
plot(x,a,o,x,b,*)
legend(a=2,b=2,a=6,b=6)
title(Repartitia Beta)

Pdf Cfd :
x1=[0:0.1:10];
y1=betacdf(x1,2,2);
plot(x1,y1,r)
hold on
grid on
x=[0:0.2:10];
a=betapdf(x,2,2);
plot(x,a,o)
hold on
title(PDF CDF)
legend(CDF,PDF)

35

Histograma Beta
b=betarnd(2,2,1,1000);
c=betarnd(6,6,1,1000);
d=betarnd(9,7,1,1000);
hold on
hist(b)
hist(c)
h=findobj(gca,Type,patch);
set(h(1),FaceColor,r,EdgeColor,w)
set(h(2),FaceColor,b,EdgeColor,w)
grid on
hist(d)
title(Histograma Beta)
legend(a=2,b=2,a=6,b=6,a=9,b=7)

36

37