rogerlew / pyvttbl

Automatically exported from code.google.com/p/pyvttbl
10 stars 8 forks source link

KeyError: 'dfe_gg' line 1885 when running anova {on a missing record?} #17

Open zethdubois opened 5 months ago

zethdubois commented 5 months ago
File [~/projects/fatr/venv/lib/python3.10/site-packages/pyvttbl/stats/_anova.py:1607](http://localhost:8888/lab/workspaces/auto-6/tree/venv/lib/python3.10/site-packages/pyvttbl/stats/_anova.py#line=1606), in Anova.__str__(self)
   1604     s.append(self._between_str())
   1606 if len(self.wfactors)!=0 and len(self.bfactors)!=0:
-> 1607     s.append(self._mixed_str())
   1609 s.append(self._summary_str(factors))
   1610 return ''.join(s)

File [~/projects/fatr/venv/lib/python3.10/site-packages/pyvttbl/stats/_anova.py:1885](http://localhost:8888/lab/workspaces/auto-6/tree/venv/lib/python3.10/site-packages/pyvttbl/stats/_anova.py#line=1884), in Anova._mixed_str(self)
   1879     error.append([src,'Sphericity Assumed',
   1880     r['sse'],' - ',r['dfe'],r['mse'],
   1881     '','','','','','','',''])
   1883 if sphericity_test_filter is None or sphericity_test_filter == 'gg':
   1884     error.append([(src, '')[sphericity_test_filter is None], 'Greenhouse-Geisser',
-> 1885     r['sse'],r['eps_gg'],r['dfe_gg'],r['mse_gg'],
   1886     '','','','','','','',''])
   1888 if sphericity_test_filter is None or sphericity_test_filter == 'hf':
   1889     error.append([(src, '')[sphericity_test_filter is None], 'Huynh-Feldt',
   1890     r['sse'],r['eps_hf'],r['dfe_hf'],r['mse_hf'],
   1891     '','','','','','','',''])

KeyError: 'dfe_gg'
zethdubois commented 5 months ago

User is there no way to keep my dataframe intact, and have the anova disregard the missing column records?

Python Robot

  1. Custom Handling within the ANOVA Function:

If you're comfortable with programming and the source code of the ANOVA function you're using is accessible (as it might be in open-source packages), you could potentially modify the function to ignore rows with missing values in the calculation. This would involve identifying where the function processes the input data and inserting logic to exclude missing values from the relevant computations.