patchGNU Octave - Patches: patch #10123, [octave forge] (statistics) Adding...


patch #10123: [octave forge] (statistics) Adding options to anovan: specify variable names, switch display of anova table on/off

Submitter:  Christian Scholz <coscholz1984>
Submitted:  Sat 16 Oct 2021 08:06:28 PM UTC
Category:  Forge : new feature Priority:  3 - Low
Status:  Done Privacy:  Public
Assigned to:  None Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Tue 02 Aug 2022 06:35:16 PM UTC, comment #7: 

Patch has been merged at We can close this item. Further development on anovan will go over to Github.

Andreas Bertsatos <pr0m1th3as>
Thu 28 Jul 2022 03:14:03 PM UTC, comment #6: 

That would be great Andy!

Additionally, if you could accommodate in your re-implementation the issue of compatibility with output arguments, it will be outstanding, because I am planning to implement the multcompare function before the forthcoming release by the end of September.

multcompare works on the `STATS` output structure created by anova1, anova2, friedman, kruskalwallis, aoctool and anovan. I've already implemented the first 4 functions, so I will try to implement aoctool as well if I get the chance, especially now that you are working on anovan.

I am happy to support with anovan as well in any way I can.

Best regards

Andreas Bertsatos <pr0m1th3as>
Thu 28 Jul 2022 02:17:43 PM UTC, comment #5: 

Hi Andreas,

Yes, I found the Github repo, will fork it and create a pull request after I'm done with the changes (see below). Thanks for pointing out #51879, those changes wouldn't be too difficult to make so I'll include that in my plans.

I also just noticed that when the replication number is not the same (i.e. the sample sizes are unbalanced) this and the previous anovan version doesn't calculate the sums-of-squares correctly.  (None of the test cases have used unbalanced designs so this wasn't picked up). This is not good news because most applications will have unbalanced data and one of the benefits of Matlab's anovan function over the other anova functions is that it can cope with unbalanced data. My plan then is to make anovan use at least one of the sstype conventions for dealing with unbalanced sample sizes. I may rewrite anovan quite significantly to do this because the way anovan is coded is quite complex. I probably won't get this done for a few weeks given my other work committments but I'll see what I can get done before the end of the summer.

Hope this suits you.



Andrew Penn <acp29>
Thu 28 Jul 2022 01:23:05 PM UTC, comment #4: 

Hi Andrew,

could you add the tests you ran at the end of the function as BISTs? It will make things much easier to test it before pushing the changes you made.

There is also bug #51879 which points out the incompatibility in output arguments of anovan between Octave and Matlab.  I've already made matlab compatible versions for anova1 and anova2, but I am currently quite busy at work, so it would be ideal if you could work towards making anovan Matlab compatible, although this might be a non-trivial task.

I will close all other anovan related issues (#51879, #48472, and #61442) so we can continue the discussion on a single thread here.

Andreas Bertsatos <pr0m1th3as>
Wed 27 Jul 2022 05:11:03 PM UTC, comment #3: 

Could you please also change the title to include [octave forge] (statistics) so it is easier to track items related to the statistics package?

Andreas Bertsatos <pr0m1th3as>
Wed 27 Jul 2022 05:08:50 PM UTC, comment #2: 

Hi Andrew,

I recently took over maintenance of the statistics package, which is currently maintained at GitHub. The Mercurial repo has been frozen at the time of last commit before transitioning to GitHub and it is kept for reference to old patches and bugs.

I am trying to close as many bugs as possible including adding a few missing functions before the next release, which I plan by the end of summertime.

Since you are familiar with GitHub, it would be helpful if you could make a pull request with the latest updates in `anovan` function. If not I will make the patch myself in the following days, since I am currently working on the `chi2gof` missing function.

Best regards,


Andreas Bertsatos <pr0m1th3as>
Wed 27 Jul 2022 04:20:58 PM UTC, comment #1: 

Hi Christian,

I didn't write this function nor have I been involved in maintaining the Statistics package. I think your suggestions are great additions. I had a stab at making some further improvements to this function on top of your changes. These changes include:

- fixing the error degrees of freedom bug when modeltype != 'full'
- fixing the bug that required replication in all combinations of factors
- fixing the order of the factors; now they match the input and are consistent with Matlab
- listing the error term sum sq., df and meanSS at the bottom of the ANOVA table
- adding a row at the bottom of the table with the total sum sq. and df
- tabulating p-values in APA style
- fixing the format of the Sum Sq, MeanSS and Fval so the table isn't ugly when numbers become large
- changed slightly the interaction formatting in the table to match Matlab better
- fixed minor issue with Factor listing in Table title

Note that the function still requires numeric or logical IDs for the group matrix (whereas Matlab supports cell arrays of strings etc.)

The above changes address another bug reported previously at:

I will put the above message in response to that bug but will refer to this comment and the attached file here.

I ran some tests including a 3-way ANOVA test but please feel free to test it yourself.

Would someone be able to upload the attached fix to the Statistics package and make a new release? I think it's maintained through Mercurial (?) rather than GitHub - I'm only familiar with the latter.



(file #53475)

Andrew Penn <acp29>
Sat 16 Oct 2021 08:06:28 PM UTC, original submission:  

Suggesting patch for anovan.m (2021-08-12)

- Adding optional parameter to specify names of grouping variables
- Adding optional parameter to switch display of anova table on/off
- Variable default names are changed to X1...XN (default in matlab) instead of A,B,...
- Order of anova table now puts Error at the end and adds sum of 'Total' SSqr and df (default in matlab)

Christian Scholz <coscholz1984>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #53475:  anovan.m added by acp29 (15KiB - application/octet-stream)
file #52109:  anovan.m added by coscholz1984 (14KiB - text/plain)


Carbon-Copy List
  • -email is unavailable- added by nrjank (Updated the item)
  • -email is unavailable- added by pr0m1th3as (Posted a comment)
  • -email is unavailable- added by acp29 (Updated the item)
  • -email is unavailable- added by coscholz1984 (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-08-02 nrjank StatusNone Done
        Open/ClosedOpen Closed
    2022-07-28 nrjank Dependencies- bugs #61442 is dependent
    2022-07-28 mmuetzel Dependencies- bugs #51879 is dependent
    2022-07-28 mmuetzel Dependencies- bugs #48472 is dependent
    2022-07-27 nrjank SummaryAdding options to anovan: specify variable names, switch display of anova table on/off [octave forge] (statistics) Adding options to anovan: specify variable names, switch display of anova table on/off
    2022-07-27 acp29 Attached File- Added anovan.m, #53475
    2021-10-16 coscholz1984 Attached File- Added anovan.m, #52109

    Back to the top

    Powered by Savane 3.13-b921.
    Corresponding source code