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 Model_Year
and Cylinders
as factors, and Acceleration
and Displacement
as response variables.
maov
is a manova
object that contains the results of the two-way MANOVA.
Display the fitted MANOVA model coefficients for maov
.
coefs = 5×2
14.9360 228.5164
-0.8342 4.5054
0.6874 -10.0817
1.5827 -115.6528
1.3065 -7.8655
The first and second columns of the matrix coefs
correspond to the car acceleration and car displacement response variables, respectively. Each row corresponds to a term in the MANOVA model, with the first row containing intercept terms.
Display the names of the terms for the fitted coefficients.
ans = 1×5 string
"(Intercept)" "Year_70" "Year_76" "Cylinders_4" "Cylinders_6"
The output shows that the last two rows of coefs
correspond to the terms for number of engine cylinders.
Test the null hypothesis that, for both response variables, the sum of the coefficients corresponding to the number of engine cylinders is zero.
tbl=1×6 table
TestStatistic Value F DFNumerator DFDenominator pValue
_____________ _______ ______ ___________ _____________ __________
"pillai" 0.81715 210.04 2 94 2.0833e-35
The small p-value in the table output indicates that enough evidence exists to conclude that the sum of the engine cylinders coefficients is statistically different from zero.