z90=1.645;
z95=1.960;
z99=2.576;

μ=1.0; σ=1.0; n=5;
x=RandomVariate[NormalDistribution[μ,σ],n]
t90=2.132;
t95=2.776;
t99=4.604;
m=Mean[x]
s2=Variance[x];
s=Sqrt[s2]

x190=m-σ*z90/Sqrt[n];
x290=m+σ*z90/Sqrt[n];
y190=m-s*t90/Sqrt[n];
y290=m+s*t90/Sqrt[n];
x195=m-σ*z95/Sqrt[n];
x295=m+σ*z95/Sqrt[n];
y195=m-s*t95/Sqrt[n];
y295=m+s*t95/Sqrt[n];
x199=m-σ*z99/Sqrt[n];
x299=m+σ*z99/Sqrt[n];
y199=m-s*t99/Sqrt[n];
y299=m+s*t99/Sqrt[n];
Print["I normale 90 = ",x190,"   ",x290]
Print["I normale 95 = ",x195,"   ",x295]
Print["I normale 99 = ",x199,"   ",x299]
Print["I Student 90 = ",y190,"   ",y290]
Print["I Student 95 = ",y195,"   ",y295]
Print["I Student 99 = ",y199,"   ",y299]

μ=1.0; σ=1.0; n=30;
x=RandomVariate[NormalDistribution[μ,σ],n]
t90=1.699;
t95=2.045;
t99=2.756;
m=Mean[x]
s2=Variance[x];
s=Sqrt[s2]

x190=m-σ*z90/Sqrt[n];
x290=m+σ*z90/Sqrt[n];
y190=m-s*t90/Sqrt[n];
y290=m+s*t90/Sqrt[n];
x195=m-σ*z95/Sqrt[n];
x295=m+σ*z95/Sqrt[n];
y195=m-s*t95/Sqrt[n];
y295=m+s*t95/Sqrt[n];
x199=m-σ*z99/Sqrt[n];
x299=m+σ*z99/Sqrt[n];
y199=m-s*t99/Sqrt[n];
y299=m+s*t99/Sqrt[n];
Print["I normale 90 = ",x190,"   ",x290]
Print["I normale 95 = ",x195,"   ",x295]
Print["I normale 99 = ",x199,"   ",x299]
Print["I Student 90 = ",y190,"   ",y290]
Print["I Student 95 = ",y195,"   ",y295]
Print["I Student 99 = ",y199,"   ",y299]

μ=1.0; σ=0.2; n=5;
x=RandomVariate[NormalDistribution[μ,σ],n]
t90=2.132;
t95=2.776;
t99=4.604;
m=Mean[x]
s2=Variance[x];
s=Sqrt[s2]

x190=m-σ*z90/Sqrt[n];
x290=m+σ*z90/Sqrt[n];
y190=m-s*t90/Sqrt[n];
y290=m+s*t90/Sqrt[n];
x195=m-σ*z95/Sqrt[n];
x295=m+σ*z95/Sqrt[n];
y195=m-s*t95/Sqrt[n];
y295=m+s*t95/Sqrt[n];
x199=m-σ*z99/Sqrt[n];
x299=m+σ*z99/Sqrt[n];
y199=m-s*t99/Sqrt[n];
y299=m+s*t99/Sqrt[n];
Print["I normale 90 = ",x190,"   ",x290]
Print["I normale 95 = ",x195,"   ",x295]
Print["I normale 99 = ",x199,"   ",x299]
Print["I Student 90 = ",y190,"   ",y290]
Print["I Student 95 = ",y195,"   ",y295]
Print["I Student 99 = ",y199,"   ",y299]

μ=1.0; σ=0.2; n=30;
x=RandomVariate[NormalDistribution[μ,σ],n]
t90=1.699;
t95=2.045;
t99=2.756;
m=Mean[x]
s2=Variance[x];
s=Sqrt[s2]

x190=m-σ*z90/Sqrt[n];
x290=m+σ*z90/Sqrt[n];
y190=m-s*t90/Sqrt[n];
y290=m+s*t90/Sqrt[n];
x195=m-σ*z95/Sqrt[n];
x295=m+σ*z95/Sqrt[n];
y195=m-s*t95/Sqrt[n];
y295=m+s*t95/Sqrt[n];
x199=m-σ*z99/Sqrt[n];
x299=m+σ*z99/Sqrt[n];
y199=m-s*t99/Sqrt[n];
y299=m+s*t99/Sqrt[n];
Print["I normale 90 = ",x190,"   ",x290]
Print["I normale 95 = ",x195,"   ",x295]
Print["I normale 99 = ",x199,"   ",x299]
Print["I Student 90 = ",y190,"   ",y290]
Print["I Student 95 = ",y195,"   ",y295]
Print["I Student 99 = ",y199,"   ",y299]

(* Abbigliamento *)

Clear[x]

x={20,45,22,31,28,27,24,22,32,30,18,19,20,32,24,23,28,21,32,29};
n=Length[x]
m=Mean[x]//N
s2=Variance[x];
s=Sqrt[s2]//N

t90=1.729;
t95=2.093;
t99=2.861;

y190=m-s*t90/Sqrt[n];
y290=m+s*t90/Sqrt[n];
y195=m-s*t95/Sqrt[n];
y295=m+s*t95/Sqrt[n];
y199=m-s*t99/Sqrt[n];
y299=m+s*t99/Sqrt[n];
Print["I Student 90 = ",y190,"   ",y290]
Print["I Student 95 = ",y195,"   ",y295]
Print["I Student 99 = ",y199,"   ",y299]