data1 = {5,6,11,13,20,21,22,22,25,26,27,31,34,37,37,41,42,44,49,50};

data2 = {6,7,6,8,13,20,21,23,15,20,22,17,30,31,33,14,39,31,39,41};

korelacnykoeficient=Correlation[data1,data2]//N

T=(korelacnykoeficient/(Sqrt[1-(korelacnykoeficient^2)]))*(Sqrt[Length[data1]-2])

Testkorelacie[data1_,data2_,alpha_]:=
Module[{α},α=alpha;Print[Style["Test nulaovsti korelacneho koeficienta.",16,Bold]];
r=Correlation[data1,data2];n=Length[data1];
Print[Style["------------------------------",16,Bold]];
Print["korelacny koeficient na hodnotu: ",r];uu=((Abs[r]*(Sqrt[n-2]))/(1-(r^2)));
Print["testovacia statistika na hodnotu: ",uu];
uuu=Quantile[StudentTDistribution[n-2],1-(α/2)];
Print["kvantil Studentovho T rozdelenia je : ",uuu];
Print[Style["-------------------------------",16,Bold]];
Print[Style["Zaver",16,Bold]];Print[Style["----------------------------------",16,Bold]];
If[((Abs[r]*(Sqrt[n-2]))/(1-(r^2)))>uuu,Print["zamietam H0, korelacny koeficient nie je nulovy"],Print["nezamietam H0"]]]

Testkorelacie[data1,data2,0.05]

data3={18.6,27.6,27.5,25,24.5,26.8,29.7,26.5};
data4 ={18.58,27.37,27.27,24.64,24.1,26.33,29.33,26.63};

korelacnykoeficient2=Correlation[data3,data4]//N
T=(korelacnykoeficient2/(Sqrt[1-(korelacnykoeficient2^2)]))*(Sqrt[Length[data3]-2])
Testkorelacie[data3,data4,0.05]

data5={5.6,5.9,5.9,5.7,5.8,5.7,6,5.5,5.7,5.5};
data6={6.2,5.7,5.6,6,6.3,5.8,5.7,6,6,5.8};

korelacnykoeficient3=Correlation[data5,data6]//N
T=(korelacnykoeficient3/(Sqrt[1-(korelacnykoeficient3^2)]))*(Sqrt[Length[data5]-2])
Testkorelacie[data5,data6,0.05]

data7={18,19,20,21,22,22,25,26,26,26,27,28,29,30,31,33};
data8={26,23,29,27,31,25,22,32,32,33,38,29,36,37,41,42};

korelacnykoeficient4=Correlation[data7,data8]//N
T=(korelacnykoeficient4/(Sqrt[1-(korelacnykoeficient4^2)]))*(Sqrt[Length[data7]-2])
Testkorelacie[data7,data8,0.05]

(*dvojvyberovy test NEDOKONCENE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*)

dvojvyberovy[data1_,data2_,alpha_]:=
Module[{α},α=alpha;Print[Style["Dvojvyberovy t-test, nerovnake rozptyly",16,Bold]];
Print[Style["********************************************************",16,Bold]];
m=Length[data1];
T=((Mean[data1]-Mean[data2])/\[Placeholder])]
r=Correlation[data1,data2];
Print[Style["------------------------------",16,Bold]];
Print["korelacny koeficient na hodnotu: ",r];uu=((Abs[r]*(Sqrt[n-2]))/(1-(r^2)));
Print["testovacia statistika na hodnotu: ",uu];
uuu=Quantile[StudentTDistribution[n-2],1-(α/2)];
Print["kvantil Studentovho T rozdelenia je : ",uuu];
Print[Style["-------------------------------",16,Bold]];
Print[Style["Zaver",16,Bold]];Print[Style["----------------------------------",16,Bold]];
If[((Abs[r]*(Sqrt[n-2]))/(1-(r^2)))>uuu,Print["zamietam H0, korelacny koeficient nie je nulovy"],Print["nezamietam H0"]]]