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 from the data in Model_Year
, Cylinders
, Acceleration
, and Displacement
.
Perform a two-way MANOVA using the table variables Year
and Cylinders
as factors, and the Acceleration
and Displacement
variables as response variables.
maov =
2-way manova
Acceleration,Displacement ~ 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 manova
object that contains the results of the two-way MANOVA. The table output shows that the p-value for the MANOVA model term Year
is too large to conclude that Year
has a statistically significant effect on the mean response vector. However, 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.
Create a profile plot of the means for Acceleration
and Displacement
grouped by the combinations of values for Year
and Cylinders
. Use the axes
function to create axes that plot lines in magenta, green, and black.
The profile plot shows that the means for Acceleration
are similar. However, the color coding shows that the means for Displacement
are clustered by their corresponding values in Cylinders
. The top cluster, shown in black, corresponds to cars with eight-cylinder engines. The middle cluster, shown in green, corresponds to cars with six-cylinder engines. The bottom cluster, shown in magenta, corresponds to cars with four-cylinder engines. This result supports the conclusion that Cylinders
has a statistically significant effect on the mean response vector, but Year
does not.