// TD5 Stat apps, Luc Deneire, 2008-2009 // 5.1 [P1,Q1]=cdfnor("PQ",105,100,10); printf('Une proportion de %2.2f \% obtient un QI inferieur a 105 \n',P1*100); [P2,Q2]=cdfnor("PQ",95,100,10); printf('Une proportion de %2.2f \% obtient un QI compris entre 95 et 105 \n',(P1-P2)*100); // Peut etre écrit, en considérant la symétrie de la normale : printf('Une proportion de %2.2f \% obtient un QI compris entre 95 et 105 \n',(P1-Q1)*100); // 90 % de la population : de 5 % (P=0.05,Q=0.95) à 95 % (P:0.95,Q=0.05) QIlow=cdfnor("X",100,10,0.05,0.95); QIhigh=cdfnor("X",100,10,0.95,0.05); printf('90 \% de la population obtient un QI compris entre %2.2f et %2.2f \n',QIlow,QIhigh); [P3,Q3]=cdfnor("PQ",120,100,10); printf('Une proportion de %2.2f \% obtient un QI supérieur a 120 \n',Q3*100); //5.3 function [x_bar_vec,s2_vec]=echant(N,n,k,P) x_bar_vec=zeros(k,1); s2_vec=zeros(k,1); for i=1:k index=N*rand(n,1,"uniform"); echantillon=P(index); x_bar_vec(i)=mean(echantillon); s2_vec(i)=variance(echantillon); end endfunction function plotit(x_bar_vec,s2_vec) clf; subplot(211); histplot(5,x_bar_vec); axes=get("current_axes"); axes.title.text="Histogramme des moyennes"; subplot(212); histplot(5,s2_vec); axes=get("current_axes"); axes.title.text="Histogramme des variances"; endfunction N=1e6; n=10; k=100; P=rand(N,1,"normal"); [x_bar_vec,s2_vec]=echant(N,n,k,P); plotit; pause; [x_bar_vec,s2_vec]=echant(N,25,k,P); plotit; pause; [x_bar_vec,s2_vec]=echant(N,100,k,P); plotit; pause; [x_bar_vec,s2_vec]=echant(N,n,100,P); plotit;