# Analysis of Covariance

Analysis of Covariance refers to having both continuous and categorical independent variables in a model. This can be accomplished in MINITAB using the regression command.

Let's try to do an analysis of covariance with TEST4 as the dependent variable, TESTMEAN as the continuous variable, and the person's sex as a categorical variable. We would first have to recode sex to be 1 for males, 0 for females. Type:

`MTB> NAME C12='SEXDUM'`

` MTB> CODE (1)1 (2)0 'SEX' 'SEXDUM'`

Then compute an interaction term:

`MTB> NAME C13='INTERAC'`

` MTB> LET C13='SEXDUM' 'TESTMEAN' `

Then run the regression model:

`MTB> REGRESS 'TEST4' 3 'TESTMEAN' 'SEXDUM' 'INTERAC'`

The regression equation is

`TEST4 = 55.3 + 0.333 TESTMEAN + 8.4 SEXDUM - 0.118 INTERAC`

`Predictor       Coef       Stdev   t-ratio        pConstant       55.32       17.95      3.08    0.007TESTMEAN      0.3330      0.2230      1.49    0.155SEXDUM          8.40       28.12      0.30    0.769INTERAC      -0.1179      0.3552     -0.33    0.744s = 11.05       R-sq = 15.3%     R-sq(adj)= 0.0%Analysis of VarianceSOURCE       DF          SS         MS         F        pRegression    3       353.1      117.7      0.96    0.434Error        16      1952.7      122.0Total        19      2305.8SOURCE       DF      SEQ SSTESTMEAN      1       336.6SEXDUM        1         3.1INTERAC       1        13.4Unusual ObservationsObs.TESTMEAN     TEST4       Fit Stdev.Fit Residual   St.Resid  4       62    100.00     77.06     5.40     22.94      2.38R  19       40     70.00     68.64     9.40      1.36      0.23 XR denotes an obs. with a large st.resid.X denotes an obs. whose X value givesit large influence.`

The p value in the analysis of variance tells us that the overall model is not significant, since .434 is not less than .05. It is also useful to look at the p values for the individual variables. The p value of the interaction term is .74, the p value of the sex term is .76, and the p value of the test mean is .15. Since the interaction effect is not significant, it could be dropped from the model. The regression command could be run again with only the sex and test mean as independent variables, to see if a model without an interaction term might be significant. Notice that the R squared is a rather low 15%, so it is unlikely we will make this model significant by dropping a term.