You are on page 1of 3

# Alumno: Miguel Moreno Estvez

## a1) Clculo de la desviacin tpica:

>> mu=3.5;
>> sigma=(2-mu)/norminv(0.2,0,1)
sigma =
1.782274424840835
P(0<=X<=6):
>> normcdf(6,mu,sigma)-normcdf(0,mu,sigma)
ans =
0.894869509763923
P(X<=8/X>1):
>> (normcdf(8,mu,sigma)-normcdf(1,mu,sigma))/(1-normcdf(1,mu,sigma))
ans =
0.993707196821013
P90 P20:
>> norminv(0.9,mu,sigma)-norminv(0.2,mu,sigma)
ans =
3.784076579384875
a2) Media de X/(1<=X<=8):
>> integrando=strcat('x.*normpdf(x,',num2str(mu),',',num2str(sigma),')')
integrando =
x.*normpdf(x,3.5,1.7823)
ans =
3.758785906667400

## Clculo mediante la generacin de la muestra:

>> nu=normrnd(mu,sigma,1,20000);
>> indi=find(nu>=1&nu<=8);
>> mean(nu(indi))
ans =
3.754613549508719
Observamos que la media obtenida es similar a la terica.
b1) Rango intercuartlico, calculando previamente el parmetro beta:
>> alfa=3;
>> beta=sqrt(27/(alfa+alfa^2))
beta =
1.500000000000000
>> gaminv(0.75,alfa,beta)-gaminv(0.25,alfa,beta)
ans =
3.289653963648061
Curtosis=

^4

3:

>> integrando=strcat('x.^3.*gampdf(x,',num2str(alfa),',',num2str(beta),')')
integrando =
x.^3.*gampdf(x,3,1.5)
>> fplot(integrando,[-50,50])
m3 =
2.024999997288331e+02
>> integrando=strcat('x.^4.*gampdf(x,',num2str(alfa),',',num2str(beta),')')
integrando =
x.^4.*gampdf(x,3,1.5)
m4 =
1.822499985968398e+03
>> mu4=m4-4*m3*(alfa*beta)+6*27*(alfa*beta)^2-3*(alfa*beta)^4
mu4 =
2.278124908494028e+02
>> curtosis=(mu4/(alfa*beta^2)^2)-3
curtosis =
1.999999799163848
P(<=10/>=5):
>> (gamcdf(10,alfa,beta)-gamcdf(5,alfa,beta))/(1-gamcdf(5,alfa,beta))
ans =
0.892176357186394

## b2) P(21+2>8) y clculo de su intervalo de confianza al 95%:

>> N=10000;
>> E1=gamrnd(alfa,beta,1,N);
>> E2=gamrnd(alfa,beta,1,N);
>> Es=2*E1+E2;
>> indi=find(Es>8);
>> Na=length(indi);
>> p=Na/N
p=
0.832600000000000
>> z=norminv(0.975)
z=
1.959963984540054
>> [p-z*sqrt(p*(1-p)/N) p+z*sqrt(p*(1-p)/N)]
ans =
0.825282815240805 0.839917184759195