Multiple Linear Regression

(Subscript[x, 1])={66,68,42,56};
(Subscript[x, 2])={60,35,51,69};
(Subscript[x, 3])={64,79,62,82};
(Subscript[x, 4])={97,99,64,91};
(Subscript[x, 5])={90,79,87,71};
n[i_]:=Length[(Subscript[x, i])];
Data = Transpose[{Flatten[Table[Table[i,{j,1,n[i]}],{i,1,5}]],Flatten[Table[(Subscript[x, i]),{i,1,5}]]}]

Basic Model

<<ANOVA`

ANOVA[Data]

T = ANOVA[Data,CellMeans -> False]

{{(Subscript[γ, Tr]),(Subscript[SS, Tr]), (Subscript[MS, Tr]),F,P},{(Subscript[γ, E]),(Subscript[SS, E]),(Subscript[MS, E])},{(Subscript[γ, Tot]),(Subscript[SS, Tot])}}=T[[2]][[1]]

T[[2]][[2]]

1.*Variance/@{(Subscript[x, 1]),(Subscript[x, 2]),(Subscript[x, 3]),(Subscript[x, 4]),(Subscript[x, 5])}

Bartlett’s Test for Equality of Variances

k = (Subscript[γ, Tr])+1;
Q = (Subscript[γ, E])Log[(Subscript[MS, E])]-Sum[(n[i]-1)Log[Variance[(Subscript[x, i])]],{i,k}]

h = 1 + (1/(3(k-1)))(Sum[(1/(n[i]-1))-(1/(Subscript[γ, E])),{i,1,k}]);
N[h]

B = (Q/h)

1-CDF[ChiSquareDistribution[k-1],B]

VarianceEquivalenceTest[{(Subscript[x, 1]),(Subscript[x, 2]),(Subscript[x, 3]),(Subscript[x, 4]),(Subscript[x, 5])},{"TestDataTable","Bartlett"}]

Difference of the Means

Y[i_]:=1.*Mean[(Subscript[x, i])];
DataY = Table[Y[i],{i,1,5}]
Max[DataY]
Min[DataY]
TableForm[Table[Round[Y[i]-Y[j],0.001],{j,1,5},{i,1,j}],TableHeadings->{{"1","2","3","4","5"},{"1","2","3","4","5"}}]

Bonferroni’s Test

ANOVA[Data,PostTests-> {Bonferroni},SignificanceLevel-> 0.05]

comparisonwise = Solve[1-(((1-α))^(k(k-1)/2))==0.05,α,Reals]

t = InverseCDF[StudentTDistribution[(Subscript[γ, E])],1-α/2]/.comparisonwise[[1]]
τ[i_,j_]:=t√((Subscript[MS, E])((1/(n[i]))+(1/(n[j]))))
TableForm[Table[Round[τ[i,j],0.001],{j,1,k},{i,1,j}],TableHeadings->{{"1","2","3","4","5"},{"1","2","3","4","5"}}]

Tukey’s HSD Test

(Subscript[r, c])=4.367;
r[i_,j_]:=(Subscript[r, c])√(((Subscript[MS, E])/2)((1/(n[i]))+(1/(n[j]))))
TableForm[Table[Round[r[i,j],0.001],{j,1,k},{i,1,j}],TableHeadings->{{"1","2","3","4","5"},{"1","2","3","4","5"}}]

ANOVA[Data,PostTests->Tukey,CellMeans->False, SignificanceLevel->0.05]

Duncan’s New Multiple Range Test

(Subscript[m, 1])={0.30, 0.64, 0.68, 0.53, 0.78, 0.84};
(Subscript[m, 2])={0.69, 1.08, 1.30, 1.11, 0.51, 0.96};
(Subscript[m, 3])={0.96, 0.93, 1.02, 1.19, 0.89, 1.33};
(Subscript[m, 4])={1.21, 0.96, 1.02, 1.17, 1.28, 1.36};
(Subscript[m, 5])={1.70, 1.16, 0.95, 1.18, 1.56, 1.07};
(Subscript[m, 6])={1.52, 1.34, 1.58, 1.41, 1.39, 1.46};
l[i_]:=Length[(Subscript[m, i])];
data = Transpose[{Flatten[Table[Table[i,{j,1,l[i]}],{i,1,6}]],Flatten[Table[(Subscript[m, i]),{i,1,6}]]}]
y[i_]:=Mean[(Subscript[m, i])];
Datay = Table[y[i],{i,1,6}]

ANOVA[data,PostTests->Duncan,SignificanceLevel->0.25]