File Exchange

image thumbnail


version 1.16 (5.57 MB) by

Tools for Multivariate Analysis (Statistics Toolbox NOT Required)



View License

MANCOVAN provides a suite of tools for testing for group, group-group interaction, covariate, covariate-covariate interaction, and group-covariate interaction effects in the context of a multivariate response and it does so without using the Statistics Toolbox. Because MANCOVAN represents such a general model, it can be used for ANOVA, ANOVAN, ANCOVA, ANCOVAN, MANOVA, MANOVAN, and MANCOVA as well without loss of power or precision. In addition to MANCOVAN, this suite of tools includes MSTEPWISE for multivariate stepwise regression, MT for t-tests among levels of a group or for the slope of the regression line associated with a covariate, a variety of functions for creating and using custom design matrices, and plenty of examples.

Comments and Ratings (10)

Pavel Voinov

Pavel Voinov

Darren Price

Great, but is there a more detailed explanation of how to use this toolbox. I am trying to make a model with 1 dependent variable, 2 covariates, and 2 groups. I want to design a model that tests the interaction between group and covariate 1, but not covariate 2 (covariate 2 is just a nuisance variable).


Worked it out myself - for anyone else who might be interested the info can be displayed using the 'verbose' option - this only displays in the command window though, so I edited mLHT.m to output an additional stats table with the DoF and p values, I then get mancova.m to add F values to this to create a really condensed but highly useful second stats table...

Great submission, I was wondering if you could tell me what the degrees of freedom are for the ANCOVA? In statistics programs like SPSS it outputs two degrees of freedom, 'treatments and error' or 'withing and between' both of which are required to report the test result. But when I run your MANCOVAN it only outputs one degree of freedom... Sorry in advance if this is a stupid question.

Arnaud Messé

Dear William,
Thanks for providing the MANCOVAN tools, it's a nice work!
In the mT function notes, you said:
"The tests may not always be the right ones in the context of either over-determined or sigma-restricted coding."
Could you argue this comment?
I have trouble to understand the canonical coding used... Because, this does not allow to compute all possible between groups comparisons. Is that correct?
Thanks in advance,

Chris Allen

Dear William Gruner,
Thanks for providing MANCOVA on the exchange server.
I've tried to use MANCOVA for an ANCOVA analysis, but sometimes get an error. The error occurs more frequently the more similar the two groups compared are (running Monte Carlo sim, so I impose the similarity).

The error reads:
??? Error using ==> betainc
X must be in the interval [0,1].

Error in ==> mFCDF at 44
p = betainc(a * x ./ (a * x + b), a/2, b/2);

Error in ==> mLHT at 79
p = 1 - mFCDF(G * T, q * d, D);

Error in ==> mancovan at 236
[ T(i), p(i) ] = mLHT(U, X, X0, M, M0, options);

Possibly you'd be interested in checking it out.
If need be I can also mail you the test data used.

William Gruner

Thanks for the comment! I'm sure others share your concern. We've been refactoring and expanding the feature set very rapidly as our analysis tasks become more demanding, but each new release is both validated against the Matlab Statistics Toolbox and regression tested against earlier versions to make sure that the results remain correct and that the functionality remains backward-compatible. Brace yourself, because there's another update coming soon ;-) After that, I expect things to slow down markedly. Cheers!

Mark Shore

Just a thought that I'm certain has crossed the mind of most people looking at the update history of this submission... with nine(!) updates in 22 days, does the author consider this to be mature software ready for wider dissemination?



Fixed a bug in mStepwise.m that sometimes caused p-values to be returned in sorted order, made the canonical coding of the design matrix described in mG2X.m the default, and added options for sigma-restricted and over-determined coding.


Revision 492 uses a sigma-restricted coding scheme to generate design matrices because the resulting regression coefficients are much easier to interpret. It also includes several improvements to the t-test engine, mT.m.


These tools are now compatible with GNU Octave Version 3.2.2. In addition, the way mStepwise.m removes terms has been improved and a few convenience functions have been added for finding and using model terms.


Removed the temp parent directory from the ZIP file.


This update replaces the single function, MANCOVAN, with a suite of tools that not only implement this model, but also provide multivariate stepwise regression, t-tests, customization of the design matrix, and much more.


Changed ANCOVA to ANCOVAN in the description.


Added options to test for covariate-covariate and group-covariate interactions, an option to print figures to PDF, and a debug mode that interactively displays the full and reduced design matrices associated with each test.


Removed the dependence on the Statistics Toolbox. This means that ANOVA, ANCOVA, ANOVAN, ANCOVAN, MANOVA, MANCOVA, MANOVAN, and MANCOVAN can all be performed with a single function with no dependencies other than Matlab itself.


Added an option to evaluate group-group interactions and added additional figures, verbose output, and comments. Confirmed that the values returned in pANCOVA are identical to those returned by anovan in the absence of covariates.


The Bayesian information criterion and SVD results can now be recovered as part of the output and a myriad of useful publication-quality graphics may now be generated automatically. See the help text for details.


Added an automatic dimensionality-reduction step based on the Bayesian information criterion for cases in which the number of columns of Y exceed the number of rows by a number that causes the test statistic to fail.

MATLAB Release
MATLAB 7.7 (R2008b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video