Bartlett's test for multivariate analysis of variance (MANOVA)
returns the result of a Bartlett's test to determine the minimum number of dimensions needed
by a linear space to contain the mean response vectors of the
d = barttest(
maov. In other words,
barttest calculates the
number of linearly independent mean response vectors. This syntax is supported only when
maov is a one-way
Perform Bartlett's Test for Two-Way MANOVA
carsmall data set.
Model_Year contains data for the year a car was manufactured, and the variable
Cylinders contains data for the number of engine cylinders in the car. The
Displacement variables contain data for car acceleration and displacement.
table function to create a table of factor values from the data in
tbl = table(Model_Year,Cylinders,VariableNames=["Year" "Cylinders"]);
Create a matrix of response variables from
y = [Acceleration Displacement];
Perform a two-way MANOVA using the factor values in
tbl and the response variables in
maov = manova(tbl,y)
maov = 2-way manova Y1,Y2 ~ 1 + Year + Cylinders Source DF TestStatistic Value F DFNumerator DFDenominator pValue _________ __ _____________ ________ ______ ___________ _____________ __________ Year 2 pillai 0.084893 2.1056 4 190 0.081708 Cylinders 2 pillai 0.94174 42.27 4 190 2.5049e-25 Error 95 Total 99 Properties, Methods
maov is a two-way
manova object that contains the results of the two-way MANOVA. The output displays the formula for the MANOVA model and a MANOVA table. In the formula, the car acceleration and displacement are represented by the variables
Y2, respectively. The MANOVA table contains a small p-value corresponding to the
Cylinders term in the MANOVA model. The small p-value indicates that, at the 95% confidence level, enough evidence exists to conclude that
Cylinders has a statistically significant effect on the mean response vector.
Year has a p-value larger than 0.05, which indicates that not enough evidence exists to conclude that
Year has a statistically significant effect on the mean response vector at the 95% confidence level.
barttest function to determine the dimension of the space spanned by the mean response vectors corresponding to the factor
ans = 0
The output shows that the mean response vectors corresponding to
Year span a point, indicating that they are not statistically different from each other. This result is consistent with the large p-value for
Get Statistics for Bartlett's Test
fisheriris data set.
The column vector
species contains iris flowers of three different species: setosa, versicolor, and virginica. The matrix
meas contains four types of measurements for the flower: the length and width of sepals and petals in centimeters.
Perform a one-way MANOVA with
species as the factor and the measurements in
meas as the response variables.
maov = manova(species,meas);
maov is a one-way
manova object that contains the results of the one-way MANOVA.
Perform a Bartlett's test to determine the minimum number of dimensions needed by a linear space to contain the mean response vectors.
maov has three mean response vectors corresponding to the three iris species.
[d,tbl] = barttest(maov)
d = 2
Dimension WilksLambda ChiSquared DF pValue
_________ ___________ __________ __ ___________
0 0.023439 546.12 8 8.8708e-113
1 0.77797 36.53 3 5.7861e-08
Each row of the table output corresponds to a dimension checked by the Bartlett's test. The small p-values in the table indicate that not enough evidence exists to conclude that the mean response vectors are elements of a zero- or one-dimensional space. Three points are guaranteed to be elements of a two-dimensional space, so the Bartlett's test returns
2 as the number of dimensions.
maov — MANOVA results
MANOVA results, specified as a
The properties of
maov contain the response data and factor values
barttest to perform the Bartlett's test.
factor — Factor used to group response data
string scalar | character array
Factor used to group the response data, specified as a string scalar or character array.
factor must be a name in
alpha — Significance level
0.05 (default) | scalar value in the range (0,1)
barttest uses to return
d, specified as a scalar value in the range (0,1). The confidence
d is (1 –
d — Dimension
Dimension of the lowest dimensional linear space containing the response vectors of
maov, returned as a nonnegative integer.
is the number of linearly independent mean response vectors for
tbl — Bartlett's test statistics
Bartlett's test statistics, returned as a table. Each row of
tbl corresponds to a dimension checked by
barttest using the Wilks' lambda test statistic.
tbl has the same number of rows as the minimum of the number of
response variables and the number of values in
factor minus 1.
tbl has the following columns:
Dimension— Dimension checked by the Bartlett's test
WilksLambda— Value of the Wilks' lambda test statistic
ChiSquared— Value of the chi-square test statistic corresponding to the Wilks' lambda test statistic
DF— Degrees of freedom of the chi-square test statistic
pValue— p-value for the chi-square test statistic
Introduced in R2023b