stats
Description
Examples
Load the fisheriris
data set.
load fisheriris
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 manova
object that contains the results of the one-way MANOVA. Display the corresponding MANOVA table.
s = stats(maov)
s=3×8 table
Source DF TestStatistic Value F DFNumerator DFDenominator pValue
_______ ___ _____________ ______ ______ ___________ _____________ __________
Factor1 2 pillai 1.1919 53.466 8 290 9.7422e-53
Error 147
Total 149
The small p-value for species
indicates that the flower species has a statistically significant effect on at least one of the flower measurements.
Load the carsmall
data set.
load carsmall
The variable 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 Acceleration
, Displacement
, and Weight
variables contain data for car acceleration, displacement, and weight.
Use the table
function to create a table from the data in Model_Year
, Cylinders
, Acceleration
, Displacement
, and Weight
.
tbl = table(Model_Year,Cylinders,Acceleration,Displacement,Weight,VariableNames=["Year" "Cylinders" "Acceleration" "Displacement" "Weight"]);
Perform a two-way MANOVA using the table variables Year
and Cylinders
as factors, and the Acceleration
, Displacement
, and Weight
variables as response variables.
maov = manova(tbl,"Acceleration,Displacement,Weight ~ Cylinders + Year")
maov = 2-way manova Acceleration,Displacement,Weight ~ 1 + Year + Cylinders Source DF TestStatistic Value F DFNumerator DFDenominator pValue _________ __ _____________ _______ ______ ___________ _____________ _________ Year 2 pillai 0.11134 1.8471 6 188 0.092099 Cylinders 2 pillai 0.96154 29.012 6 188 1.891e-24 Error 95 Total 99 Properties, Methods
maov
is a two-way manova
object that contains the results of the two-way MANOVA. The small p-value for Cylinders
indicates that enough evidence exists to conclude that Cylinders
has a statistically significant effect on the mean response vector.
Return the hypothesis and error matrices for the MANOVA model terms.
[~,H,E] = stats(maov)
H=3×2 table
Year Cylinders
___________________________________ __________________________________
33.703 -327.34 3443.7 278.01 -13017 -90619
-327.34 4835.3 -30382 -13017 7.1228e+05 4.9601e+06
3443.7 -30382 3.5753e+05 -90619 4.9601e+06 3.4541e+07
E = 3×3
107 ×
0.0001 -0.0002 0.0021
-0.0002 0.0109 0.0451
0.0021 0.0451 1.3656
The variables in the table H
correspond to the MANOVA model terms of the same name. Each variable contains the hypothesis matrix for its corresponding MANOVA model term. The error matrix E
contains the irreducible error for the MANOVA model. You can use H
and E
to perform hypothesis tests that are not supported by MATLAB® or Statistics and Machine Learning Toolbox™.
Input Arguments
MANOVA results, specified as a manova
object.
The properties of maov
contain the response data and factor values
used by stats
to calculate the statistics in the MANOVA
table.
MANOVA test statistics, specified as maov.TestStatistic
,
"all"
, or one or more of the following values.
Value | Test Name | Equation |
---|---|---|
"pillai" (default) | Pillai's trace | where θi values are the solutions of the characteristic equation Qh – θ(Qh + Qe) = 0. Qh and Qe are, respectively, the hypotheses and the residual sum of squares product matrices. |
"hotelling" | Hotelling-Lawley trace | where λi are the solutions of the characteristic equation |Qh – λQe| = 0. |
"wilks" | Wilk's lambda |
|
"roy" | Roy's maximum root statistic |
|
If you specify testStat
as "all"
,
stats
calculates all the test statistics in the table
above.
Example: TestStatistic
="hotelling"
Data Types: char
| string
| cell
Output Arguments
MANOVA table, returned as a table. In addition to rows for the error and total,
s
contains t rows per model term, where
t is the number of test statistics in
maov.TestStatistic
. The table s
also has the
following columns:
Source
— MANOVA model termDF
— Degrees of freedom for the term inSource
TestStatistic
— Name of the test statistic used to calculate the F-statistic in the columnF
and the p-value in the columnpValue
Value
— Value of the test statistic named inTestStatistic
F
— Value of the F-statistic corresponding to the test statistic named inTestStatistic
DFNumerator
— Degrees of freedom for the numerator of the F-statisticDFDenominator
— Degrees of freedom for the denominator of the F-statisticpValue
— p-value for the F-statistic
Data Types: table
Hypothesis matrices used to compute the F-statistics for the
MANOVA model terms, returned as a table of matrices. Each column of
H
corresponds to a MANOVA model term in
maov.Formula
. For more information about H
,
see Qh in Multivariate Analysis of Variance for Repeated Measures.
Data Types: table
MANOVA model error matrix used to compute the F-statistics for
the MANOVA model terms, returned as a numeric matrix. For more information about
E
, see Qe in Multivariate Analysis of Variance for Repeated Measures.
Data Types: single
| double
Version History
Introduced in R2023b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)