(*IS- intervaly spolahlivosti, testy hypotez*)
(*Studentovo t rozdelenie - parameter - n - pocet stupnov volnosti(N)*)

st=StudentTDistribution[n]

PDF[st,x]

Manipulate[Plot3D[Beta[a,b],{a,-n,n},{b,-n,n}],{n,1,5}]

densityST[n_,x_]:=PDF[StudentTDistribution[n],x]

Do[gr[i]=Plot
[
densityST[i,t],
{t,-5,5},
PlotRange->All,
PlotStyle->{Hue[0.3*i],Thickness[0.005]},
Axes->{True,False}],
{i,1,20}
]

Show[Table[gr[i],{i,1,5}]]

Manipulate[gr[i]=Plot[
densityST[i,t],{t,-5,5},
PlotRange->All,PlotStyle->{Hue[0.3*i],
Thickness[0.005]},Axes->{False,False}],{i,1,20}]

(*chi kvadrat - rozdelenie kvadratickych foriem*)

chi=ChiSquareDistribution[n]

PDF[chi,x]

Plot[Gamma[t],{t,-3,3}]

Manipulate[Plot[Gamma[t],{t,-n,5}],{n,1,5}]

densityCHI[n_,x_]:=PDF[ChiSquareDistribution[n],x]

Do[grr[i]=Plot
[
densityCHI[i,t],
{t,0,10},
PlotStyle->{Hue[0.3*i],Thickness[0.005]}],
{i,1,20}
]

Show[Table[grr[i],{i,1,20}]]

Manipulate[grr[i]=Plot
[
densityCHI[i,t],
{t,0,10},
PlotStyle->{Hue[0.3*i],Thickness[0.005]}],
{i,1,20}
]

(*jednorozmerny statisticky subor*)

panely={14, 13, 15, 12, 14, 9, 15, 8, 14, 10, 16, 12, 13, 17, 18, 13, 13, 10, 14, 16, 11, 14, 12, 9, 15, 11, 14, 15, 11, 15, 10, 16, 10, 12, 13, 11, 13, 11, 9, 13, 8, 12, 16, 12, 17, 12, 13, 11, 13, 12}

<<StatisticalPlots`

Min[panely]

Max[panely]

pocetnost=BinCounts[panely,{8,19}] (*prikaz BinCounts <a, b) - nemozem dat max, pri najmensom max+1*)

Tally[panely](*vytvori dvojice - tabulka pocetnosti*)

tp=Tally[Sort[panely]]

hodnoty=tp[[All,1]] (*vybere z celeho pola prvy stlpec*)

pocetnost=tp[[All,2]]

tp//TableForm

Needs["BarCharts`"]

Needs["Histograms`"]

BarChart[pocetnost,BarLabels->hodnoty]

(*stlpcovy graf - hodnota a jej pocetnost*)
(*histogram - triedny interval*)

Histogram[panely]

triedy=BinCounts[panely,{7.5,19.5,3}]

p=Table[i,{i,7.5,19.5,3}]

Histogram[triedy,FrequencyData->True,HistogramRange->{7.5,19.5},Ticks->{{9,12,15,18},triedy}(*ticks {{x},{y}}*)]

StemLeafPlot[panely]

StemLeafPlot[panely,ColumnLabels->{desiatky,jednotky}]

StemLeafPlot[panely,IncludeStemCounts->True]

StemLeafPlot[panely,StemExponent->0]

(*Box-Coxove grafy alias Box-Whisker grafy ...*)

BoxWhiskerPlot[panely,BoxOrientation->Horizontal]
(*min, dolny kvantil, median, horny kvantil, max - to su zvisle ciary*)

BoxWhiskerPlot[panely,BoxOrientation->Horizontal,BoxQuantile->0.15]

vybocujuce=Flatten[{panely,25}]

(*vybocujuci prvok HKvartil - NKvartil = RQ vybocujuci , ka nepatri <med-1.5RQ,med+1.5RQ>*)

BoxWhiskerPlot[vybocujuce,BoxOutliers->All,BoxOutlierMarkers->{■}]

(*paretoplot - histogram zoradeny podla pocetnosti + relativna pocetnost?*)

(*Uloha*)
(*simulujte tri mnoziny dat z normalneho rozdelenia (rozne stredne hodnoty a disperzie), urobte graficku a statisticku analyzu, kazda mnozina nech obsahuje 100 dat*)

normal1=RandomReal[NormalDistribution[1,20],100]

normal2=RandomReal[NormalDistribution[2,3],100]

normal3=RandomReal[NormalDistribution[-1,1],100]

BoxWhiskerPlot[normal1,normal2, normal3,BoxOutliers->All,BoxOutlierMarkers->{■}]
Histogram[normal1]

Min[normal1]
Max[normal1]

triedy=BinCounts[normal1,{-50,100,5}]

Histogram[triedy,FrequencyData->True,HistogramRange->{-50,100}]

(* a) zratat charakteristiky, b)vypocitat zadania zo suboru intervaly, c) simulujte data N(2,1) tak, ze n zvacsujeme n = 20 IS poznam sigma = 1, IS nepoznam sigma - nahradim sigma odhadom a odhad bude nase sigma *)

Mean[normal1]

Median[normal1]

Commonest[normal1]

Quartiles[normal1]

Variance[normal1]//N

StandardDeviationMLE[normal1]//N

Skewness[normal1]//N

Kurtosis[normal1]//N