bugGNU Octave - Bugs: bug #48472, [octave forge] (statistics)...


bug #48472: [octave forge] (statistics) incorrect results from anovan

Submitter:  Muhali <muhali>
Submitted:  Mon 11 Jul 2016 06:17:00 PM UTC
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Thu 28 Jul 2022 01:34:57 PM UTC, comment #5: 

closing report as work has moved over to patch #10123

Nicholas Jankowski <nrjank>
Group Member
Thu 28 Jul 2022 08:05:28 AM UTC, comment #4: 

Hi Andy,

very good news indeed! I ran the original example and no errors are reported. So it seems this bug can be closed.


Muhali <muhali>
Wed 27 Jul 2022 04:26:06 PM UTC, comment #3: 

Hi Muhali,

I didn't write this function nor have I been involved in maintaining the Statistics package. I came across this bug submission searching the internet and I had a stab fixing it. The 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.)

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

I made the changes on top of a recent patch #10123 at: https://savannah.gnu.org/patch/index.php?10123

Hopefully someone involved in the statistics package will be able to update the package with this patch!



Andrew Penn <acp29>
Fri 01 Sep 2017 09:51:18 AM UTC, comment #2: 

It seems that this bug (swapping of factors) is still present, and I stumbled again over it. This is very misleading. Is the package still maintained?

I also tried to develop a quick fix by re-swapping the factors, but am too uncertain whether that really solves it.

Muhali <muhali>
Wed 13 Jul 2016 10:55:54 AM UTC, comment #1: 

I just noticed the doc mentioning that the function only works for the full model. Default is the linear model, however, which is the one most people would probably choose.

Because of that, all but the full model should be removed from anovan.

Moreover, the function header also mentions (2nd point under TESTING RESULTS) that it gives identical results to Matlab. This is true except for the factors being swapped (very misleading!). So this must be fixed as well.

Muhali <muhali>
Mon 11 Jul 2016 06:17:00 PM UTC, original submission:  

A simple test case like

pkg load statistics

y = randn(100,1) ;
g1 = unidrnd(3, 100, 1) ;
g2 = unidrnd(2, 100, 1) ;
p = anovan(y,[g1,g2])

produces obvious nonsense:

warning: division by zero
warning: called from
    anovan at line 139 column 8
warning: division by zero
warning: division by zero
p =


Muhali <muhali>


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

Attach Files:

No files currently attached


Carbon-Copy List
  • -email is unavailable- added by nrjank (Posted a comment)
  • -email is unavailable- added by acp29 (Posted a comment)
  • -email is unavailable- added by muhali (added maintainer)
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by muhali (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 group members can vote.


    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-07-28 nrjank StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2022-07-28 mmuetzel Dependencies- Depends on patch #10123
    2019-02-26 mtmiller Item GroupNone Matlab Compatibility
        StatusNone Confirmed
        Release4.0.2 dev
    2017-09-01 muhali Carbon-Copy- Added -email is unavailable-
    2017-08-13 jwe Summarystatistics: incorrect results from anovan [octave forge] (statistics) incorrect results from anovan

    Back to the top

    Powered by Savane 3.13-04b1.
    Corresponding source code