MATLAB Answers


ANCOVA (aoctool) with 2 or more covariates

Asked by Right Grievous on 25 Nov 2013
Latest activity Commented on by Adam Danz
on 30 Apr 2019
Is there any way to run an ANCOVA in Matlab with more than one covariate? The aoctool function only seems able to accept an IV a DV and one covariate but I have 2, possibly 3 covariates.
I can't seem to find if this is possible using aoctool or if there is another way to do it in Matlab...
As always, any help would be greatly appreciated,


Sign in to comment.

1 Answer

Answer by Right Grievous on 2 Dec 2013
 Accepted Answer

I'll answer my own question... again.
aoctool can't take more than one covariate and there's no way round it. However, there is a file on the file exchange called MANCOVAN which can do all sorts of things - including an ANCOVA with more than one covariate.
That function does not output the stats array required by multcompare though, so really it's a bit of a dead end. Matlab really sucks sometimes.


Show 1 older comment
Use anovan() instead.
anovan() is an n-way analysis of variance allowing for multiple grouping variables. When at least one of those grouping variables are labeled as a continuous variable, an ANCOVA is performed (Matlab calls it ANOCOVA, same thing).
An example of this useage is found here in Matlab's documentation.
Hmm, that's interesting, I didn't know ANOVAN had that functionality.
When multiple grouping variables are marked as continuous do you know if ANOVAN treats them all as covariates? i.e. can you have unlimited covariates using this method?
Here's a demo provided in the Matlab documentation that demonstrates the use of ANOVAN() to perform ANVOAV (matlab uses the accronum ANOCOVA, same thing). And yes, I think you can have multiple covariates by labeling multiple variables as continuous.
190430 085242-Test Differences Between Category Means - MATLAB & Simulink.jpg

Sign in to comment.