<<"HypothesisTesting`"

(*kontrola soravnosti nastavenia meracieho pristorja*)

data={15.23,15.21,15.19,15.16,15.26,15.22,15.23,15.26,
15.23,15.29}

n=Length[data]

σ=0.03

priemer=Mean[data]

μ0=15.2

T=((priemer-μ0)/σ)(Sqrt[n])

α=0.05

kvantil2=Quantile[NormalDistribution[0,1],(1-(α/2))]

If[Abs[T]<kvantil2,Print["Nezamietam H0"],Print["zamietam H0"]]

kvantil1=Quantile[NormalDistribution[0,1],(1-α)]

?MeanTest

MeanTest[data,μ0,KnownVariance->0.03^2,TwoSided->True]

TwoSidedPValue->0.003162763790364763 (*P hodnotass*)

MeanTest[data,μ0,SignificanceLevel->0.05, KnownVariance->0.03^2,TwoSided->True, FullReport->True]

MeanTest[data,μ0,SignificanceLevel->0.05, KnownVariance->0.03^2,FullReport->True]

T=((priemer-μ0)/σ)(Sqrt[n])

2*CDF[NormalDistribution[0,1],-Abs[T]](*P hodnota*)

NormalPValue[T,TwoSided->True] (*funkcia na vypocet P hodnoty*)

(*nezname σ*)

s=StandardDeviation[data]

T=((priemer-μ0)/s)(Sqrt[n])

Tkvantil=Quantile[StudentTDistribution[n-1],(1-(α/2))]

If[Abs[T]<Tkvantil,Print["Nezamietam H0"],Print["zamietam H0"]]

MeanTest[data,15.2,TwoSided->True]

Phodnota=2*CDF[StudentTDistribution[n-1],-Abs[T]]

StudentTPValue[T,n-1,TwoSided->True]

MeanTest[data,15.2,TwoSided->True,SignificanceLevel->0.05,FullReport->True]

Tkvantil=Quantile[StudentTDistribution[n-1],(1-α)]

MeanTest[data,15.2]

StudentTPValue[T,n-1]

MeanTest[data,15.2,SignificanceLevel->0.05,FullReport->True]

(*testy pre σ a (σ^2)*)

data={51.3, 62.8,51.9, 57, 55.3,52.1,58.4}

s=StandardDeviation[data]

n=Length[data]

σ2=16

T=(((n-1)*s*s)/(σ2))

α=0.05

k2=Quantile[ChiSquareDistribution[n-1],1-(α/2)]

VarianceTest[data,σ2,TwoSided->True]

VarianceTest[data,σ2,TwoSided->True,SignificanceLevel->0.05,FullReport->True]

ChiSquarePValue[T,n-1,TwoSided->True]

(*dvojvyberovy parovy test*)

liekX={0.22,0.16,0.2,0.19,0.13,0.1,0.15}

liekY={0.18,0.14,0.21,0.12,0.13,0.06,0.12}

rozdiel=liekX-liekY

MeanTest[rozdiel,0,TwoSided->True,SignificanceLevel->0.05,FullReport->True]

?MeanDifferenceTest

MeanDifferenceTest[liekX,liekY,0,EqualVariances->True,TwoSided->True]