<<"LinearRegression`"

<<"MultivariateStatistics`"

data={{-20,323},{0,327},{20,340},{50,364},{100,386}}

n=Length[data]

g1=ListPlot[data,PlotStyle->PointSize[Large]]

teplota=Table[data[[j,1]],{j,1,n}]

rychlost=Table[data[[j,2]],{j,1,n}]

r=Correlation[teplota, rychlost]//N

(*korelacny koeficient je velky, ma zmysel pocitat lin. regresiu*)

Regress[data , {x},x]

Regress[data , {x},x,BasisNames->{"konstanta","smernica"}]

Regress[data ,{ x},x,ConfidenceLevel->0.99,RegressionReport->ParameterCITable]

Regress[data ,{ x},x,IncludeConstant->False]
 (*warning je vporiadku*)

priamka=Regress[data ,{ x},x,RegressionReport->{BestFit}] (*vyjde mi rovno ta priamka*)

parametre=Regress[data ,{ x},x,RegressionReport->{BestFitParameters}]

Regress[data ,{ x},x,RegressionReport->{ANOVATable}]

Regress[data ,{ x},x,RegressionReport->{ParameterCITable}]

Regress[data ,{ x},x,RegressionReport->{FitResiduals}]

Regress[data ,{ x},x,RegressionReport->{PredictedResponse}]

Regress[data ,{ x},x,RegressionReport->{SinglePredictionCITable}]

func=Fit[data,{1,x},x]

f1=Regress[data,{x},x,RegressionReport->{BestFit}]

g2=Plot[BestFit/.f1,{x,-20,100}]

Show[g1,g2]

BestFit/.f1/.x->70

BestFit/.f1/.x->110

rezy=Regress[data,x,x,RegressionReport->{FitResiduals}]

g1=ListPlot[data,PlotStyle->PointSize[Large]];
g2=Plot[BestFit/.f1,{x,-20,110}];

Show[g1,g2]

data2={2.1299,2.1532,2.1611,2.151,2.1282,2.0807,2.0266,1.9594,1.8759,1.7723}(*data su dane ekvidistantne,m stac i jednorozmerny subor*)

g1=ListPlot[data2,PlotStyle->PointSize[Large],PlotStyle->Hue[0.03]]

Regress[data2,{x,(x^2)},x]

f2=Regress[data2,{x,(x^2)},x,RegressionReport->{BestFit}]

g2=Plot[BestFit/.f2,{x,0,10}]

Show[g1,g2]

Regress[data2,{x,(x^2)},x,IncludeConstant->False]

data3={{0,100000},{270,96974},{840,90263},{1452,83553},{2116,76842},{3203,66842}}

g1=ListPlot[data3,PlotStyle->PointSize[Large],PlotStyle->{Hue[0.03]}]

upravene=Table[{data3[[i,1]],Log[data3[[i,2]]]//N},{i,1,6}]

Regress[upravene,{x},x]

koeficienty=Regress[upravene,{x},x,RegressionReport->{BestFitParameters}]

parametre=BestFitParameters/.koeficienty

b=parametre[[2]]

a=Exp[parametre[[1]]]

g2=Plot[a*Exp[b*t],{t,1,3250}]

Show[g1,g2]