Discussion:
[pystatsmodels] Looking for help with getting a statsmodels MANOVA to work
Alicia Morrison
2018-12-08 23:19:53 UTC
Permalink
Hi -

I'm trying to do a MANOVA in python with four classes (A,B,C,D) for the
endogenous variable and about 9 exogenous variables.
I've gotten this far, but I can't make heads or tails of the statsmodels
website to figure out exactly how to fit the model and get results.
Everything I've tried generates errors.

endog, exog = np.asarray(pre_post[feats_list]),
np.asarray(pre_post[features])
man = sm.MANOVA(endog,exog)

I'd be grateful if anyone has an example to provide or could point me in
the right direction to figure out the correct syntax. This doesn't seem to
be an especially popular topic and I've had real difficulty finding
resources to help.

Many thanks.
j***@gmail.com
2018-12-08 23:53:56 UTC
Permalink
Post by Alicia Morrison
Hi -
I'm trying to do a MANOVA in python with four classes (A,B,C,D) for the
endogenous variable and about 9 exogenous variables.
I've gotten this far, but I can't make heads or tails of the statsmodels
website to figure out exactly how to fit the model and get results.
Everything I've tried generates errors.
endog, exog = np.asarray(pre_post[feats_list]),
np.asarray(pre_post[features])
man = sm.MANOVA(endog,exog)
I'd be grateful if anyone has an example to provide or could point me in
the right direction to figure out the correct syntax. This doesn't seem to
be an especially popular topic and I've had real difficulty finding
resources to help.
I have not looked at this in some time.

A brief search for github issues indicates that it does not work without
formulas
https://github.com/statsmodels/statsmodels/issues/4903

You can also check the unit tests for examples, that's what I usually need
to do when there is no ready notebook.
https://github.com/statsmodels/statsmodels/blob/master/statsmodels/multivariate/tests/test_manova.py


Try the formula interface and if there are still problems, then I try to
remember and figure out how this was supposed to work.
The PRs for adding MANOVA are
https://github.com/statsmodels/statsmodels/pull/3327 and
https://github.com/statsmodels/statsmodels/pull/3291

The code is set up for non-formula hypothesis testing, but doesn't have a
good way to specify the contrast/restriction matrices without formulas.

Josef
Post by Alicia Morrison
Many thanks.
Loading...