xset("window",0); xbasc();
xset("font",2,3);
tailles=[121,123,108,118,111,109,114,103,110,115];
poids=[25,22,19,24,19,18,20,15,20,21];
moy_tailles=sum(tailles,"c")/10;
moy_poids=sum(poids,"c")/10;
var_tailles=sum(tailles.*tailles,"c")/10-moy_tailles^2;
var_poids=sum(poids.*poids,"c")/10-moy_poids^2;
covariance=sum(tailles.*poids,"c")/10-moy_tailles*moy_poids;
a_chapeau=covariance/var_tailles;
b_chapeau=moy_poids-a_chapeau*moy_tailles;
V = sum((poids-a_chapeau.*tailles-b_chapeau).^2)/8
abscisses=[80:150];
ordonnees=a_chapeau*abscisses+b_chapeau;
xbasc();
xset("font",2,3);
xbasc();
plotframe([80,10,150,40],[2,14,2,10],[%f,%f],["","Tailles","Poids"]);
plot2d(tailles,poids,-1,"000");
plot2d(abscisses,ordonnees,1,"000");
//x=[120,120,80];y=[10,a_chapeau*120+b_chapeau,a_chapeau*120+b_chapeau];
//plot2d(x,y,2,"000");
t = cdft("T",8,0.95,0.05);
ecart=t*sqrt((V*(11*var_tailles+(abscisses-moy_tailles).^2))/(10*var_tailles));
IPi = ordonnees-ecart;
IPs = ordonnees+ecart;
plot2d(abscisses,IPi,1,"000");
plot2d(abscisses,IPs,1,"000");
abscisses=[100,110,120,130];
ecart=t*sqrt((V*(11*var_tailles+(abscisses-moy_tailles).^2))/(10*var_tailles));
ordonnees=a_chapeau*abscisses+b_chapeau;
IPi = ordonnees-ecart;
IPs = ordonnees+ecart;
for i=1:4,
  plot2d([abscisses(i),abscisses(i)],[IPi(i),IPs(i)],2,"000");
end;





