Load the carsmall
data set.
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
and Displacement
variables contain data for car acceleration and displacement.
Use the table
function to create a table of factor values from the data in Model_Year
and Cylinders
.
Create a matrix of response variables from Acceleration
and Displacement
.
Perform a two-way MANOVA using the factor values in tbl
and the response variables in 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 Y1
and 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.
Use the barttest
function to determine the dimension of the space spanned by the mean response vectors corresponding to the factor Year
.
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 Year
.