Sunteți pe pagina 1din 14

UNIVERSITATEA DIN BUCUREŞTI

FACULTATEA DE MATEMATICĂ ŞI INFORMATICĂ

Proiect statistică

Neagu Ion Ciprian Pavel Georgiana-Luminiţa

GRUPA 321

2020
Exerciţiul 1

a) Repartiţia logistică
−x+µ
e β 1
f (x) = −x+µ ; F (x) = −x+µ
β(1 + e β )2 1+e β
1 −x+µ 1
F (x) = u ⇔ −x+µ = u ⇔ 1 + e
β =
1+e β u
−x+µ 1 −x + µ 1
⇔e β = −1⇔ = ln( − 1)
u β u
1 1
⇔ −x + µ = βln( − 1) ⇔ −x = βln( − 1) − µ
u u
1
⇔ x = µ − βln( − 1)
u
Simulare algoritm:

Pas 1: Generăm U ∼ U nif (0, 1)


1
Pas 2: Calculăm X = µ − βln( − 1)
u
Concluzii: După ce am generat cele două grafice, am observat că ele sunt
similare. Pentru ambele grafice, x ia valori aproximativ ı̂ntre [-8,8]. Valorile
funcţiilor sunt ı̂ntre [0,0.25]. Punctul de maxim se atinge ı̂n A(0,0.25).

2
3
b) Repartiţia Cauchy
1 1 1 1 x−µ
f (x) = − x−µ 2 ; F (x) = + arctg( )
πσ 1 + ( σ ) 2 π σ
1 1 x−µ
F (x) = u ⇔ + arctg( )=u
2 π σ
x−µ 1 1
⇔ = tg(π(u − )) ⇔ x − µ = σtg(π(u − ))
σ 2 2
1
⇔ x = σtg(π(u − )) + µ
2
Simulare algoritm:

Pas 1: Generăm U ∼ U nif (0, 1)


1
Pas 2: Calculăm X = σtg(π(u − )) + µ
2
Concluzii: După ce am generat cele două grafice, am observat că ele sunt
similare. Din grafice se mai observă şi că ele reprezintă o dreaptă paralelă
cu Oy, ce trece prin x=0.

4
5
Exerciţiul 2

a)
−x2
f (x) ∝ e 2 [sin(6x)2 + 3cos(x)2 sin(4x)2 + 1]
1 −x2
g(x) = √ e 2

Concluzii: Din grafic se observă că graficul lui f este mărginit superior
de graficul lui M · g, unde M a fost obţinut cu ajutorul funcţiei optimise din
R.

6
b)

Simulare algoritm:

Ştiu să generez Y cu densitatea f (x).


Vreau să generez X cu densitatea g(x).
f (x)
Presupunem că există c astfel ı̂ncât ≤ c.
g(x)
f (x) √ √
= 2π[sin(6x)2 + 3cos(x)2 sin(4x)2 + 1] ≤ 2π[1 + 3 + 1] ≤
g(x)√
≤ 5 2π ∼ = 12.5299.

Concluzii: Observăm că M obţinut prin metoda respingerii este mai


mare decât M obţinut folosind optimise: Mmet.resp ∼
= 12.5299 şi Moptimise ∼
=

10.93991 = 10.94. Alegem c=10.94.
Pas 1: Generăm U ∼ U nif (0, 1)şi
√ Y
f (x) 2π[sin(6x)2 + 3cos(x)2 sin(4x)2 + 1]
Pas 2: Dacă U ≤ = ,
c · g(x) 10.94
atunci X = Y , altfel se repetă pas 1.

7
c)
Z ∞
−x2
I= f (x)dx = e 2 [sin(6x)2 + 3cos(x)2 sin(4x)2 + 1] = 3.64
−∞

I=3.64(din R)
1
Alegem c = - const. de normalizare.
I
Construim funcţia normalizată fnorm :
fnorm (x) = c · f (x).
Generăm histograma pentru valorile generate la punctul b) şi graficul
funcţiei fnorm
Concluzii: Cele două grafice sunt asemănătoare deoarece graficul funcţiei
fnorm are aproximativ aceeaşi formă cu histograma.

8
9
Exerciţiul 3

Repartiţia Poisson :
λx


e−λ , x≥0
f (x) = x!
0 , rest

E[X]=θ
Var(X)=θ
1
MIRC= ∂2
−nE[ ∂θ 2 lnfθ (x)]
x
θθ θx 1 1
ln(fθ (x)) = ln(e ) = ln(eθ )+ln( ) = θ+lnθx +ln = θ+xlnθ+ln .
x! x! x! x!
∂ ∂ 1 1
lnfθ (x) = (θ + xlnθ + ln ) = 1 + x .
∂θ ∂θ x! θ
2
∂ ∂ 1 −1
2
lnfθ (x) = (1 + x ) = x( 2 ).
∂θ ∂θ θ θ
2
∂ −1
E[ 2 lnfθ (x)] = E[X( 2 )].
∂θ θ
X∼ Poisson ⇒ E[X]=θ

∂2 −1 −1
E[ 2
lnfθ (x)] = 2 θ =
∂θ θ θ
1 θ
⇒ M IRC = −1 =
−n( θ ) n

Repartiţia exponenţială:

fθ (x) = θe−θx
1
E[X] =
θ
1
V ar(X) = 2
θ

10
lnfθ (x) = ln(θe−θx ) = lnθ + ln(e−θx ) = lnθ + (−θx)
∂ ∂ 1
lnfθ (x) = (lnθ − θx) = − x
∂θ ∂θ θ
2
∂ ∂ 1 −1
2
lnfθ (x) = ( − x) = 2
∂θ ∂θ θ θ
2
∂ −1 −1
E[ 2 lnfθ (x)] = E[ 2 ] = 2
∂θ θ θ
2
1 θ
⇒ M IRC = −1 =
−n( θ2 ) n

11
Exerciţiul 5

a)

Logistică:
µ−x
e β
f (x) = µ−x
β(1 + e β )2
e−(x−µ)
Alegem β =1 ⇒ f (x) =
(1 + e−(x−µ) )2
n n
Y Y e−(xi −µ)
L(µ; x1 , . . . , xn ) = fµ (xi ) = −(xi −µ) )2
i=1 i=1 (1 + e
n n
log(1 + e−(xi −µ) )
X X
l(µ; x1 , . . . , xn ) = log fµ (xi ) = nµ − nX − 2
i=1 i=1

Ca să găsim µ ce maximizează logaritmul funcţiei de verosimilitate, se


rezolvă l0 (µ, xi ) = 0
n
e−(xi −µ)
l0 (µ, xi ) = n − 2
X
−(xi −µ) )
=0
i=1 (1 + e
n
X e−(xi −µ) n
⇒ −(x −µ)
=
i=1 (1 + e ) 2
i

12
13
14

S-ar putea să vă placă și