You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mostly a wrapper around formulas, pandas crosstabs and statistical tests.
formula interface to pandas might not be so easy if patsy does different preprocessing, eg convert bool to dummy. For simple cases (2x2 or 2xk) it might be easier to just use numpy after patsy.
update Nov 2015 #2418 PR merged contingency table support
I'm coding only very specific cases in numpy for statsmodels, like 2-sample and k-sample comparisons, or specific kxk tables, for interrater cohens and fleiss kappa for example.
We can use pandas as a hard dependency in a function. Whether we do is mainly a pragmatic decision. interaction plots are mostly pandas.
However, I think I would also add a second entrance to the class that takes a contingency table directly. That will be convenient for many cases when users already have the contingency table.
It also depends on how general a solution this should be, for simpler cases going through pandas might not be necessary.
Also, we don't have any code yet that goes from formula to a pandas dataframe. Interaction_plot and similar functions take 2 factor levels directly as arrays. I don't have enough experience with this part to see what would be a good way to connect this, especially how much processing patsy will do when we use a formula. ( issue #878 ), If users already hand in a dataframe, then it might be easier just to get the terms from the parsed formula and use pandas directly - just guessing.
Since you mentioned it again, I browsed pyvttbl again. I think the results look nice and it would be useful to get something similar, however in a more numpy/pandas/scipy/statsmodels style.
Activity
jankatins commentedon Jun 19, 2013
for a numpy only pivot table (and therefore generation of a contingency table): http://www.mail-archive.com/[email protected]/msg03989.html
Also interesting: http://pyvttbl.googlecode.com/hg/doc/_build/html/ChiSquare2way.html
Sounds like a nice job for an afternoon off :-)
josef-pkt commentedon Jun 19, 2013
I wouldn't go that way anymore
http://pandas.pydata.org/pandas-docs/dev/reshaping.html#pivot-tables-and-cross-tabulations
for a general solution.
I'm coding only very specific cases in numpy for statsmodels, like 2-sample and k-sample comparisons, or specific kxk tables, for interrater cohens and fleiss kappa for example.
josef-pkt commentedon Jun 19, 2013
I didn't read carefully enough
my last comment referred to the numpy mailing list, not to pyvttbl
we would still like to integrate parts of pyvttbl using pandas dataframes
jankatins commentedon Jun 20, 2013
So more or less like that:
This would mean that pandas is a hard dependency on that method. I thought that statsmodels should work without pandas?
josef-pkt commentedon Jun 20, 2013
We can use pandas as a hard dependency in a function. Whether we do is mainly a pragmatic decision. interaction plots are mostly pandas.
However, I think I would also add a second entrance to the class that takes a contingency table directly. That will be convenient for many cases when users already have the contingency table.
It also depends on how general a solution this should be, for simpler cases going through pandas might not be necessary.
Also, we don't have any code yet that goes from formula to a pandas dataframe. Interaction_plot and similar functions take 2 factor levels directly as arrays. I don't have enough experience with this part to see what would be a good way to connect this, especially how much processing patsy will do when we use a formula. ( issue #878 ), If users already hand in a dataframe, then it might be easier just to get the terms from the parsed formula and use pandas directly - just guessing.
Since you mentioned it again, I browsed pyvttbl again. I think the results look nice and it would be useful to get something similar, however in a more numpy/pandas/scipy/statsmodels style.
josef-pkt commentedon Nov 24, 2015
much of this has been added with PR #2418 for contingency tables
more statistical tests and confidence intervals especially exact methods should become available with
#2605 #2624
loglinear analysis works with Poisson, experimental notebook https://github.com/josef-pkt/misc/tree/loglinear/notebooks (with examples from Agresti books and online references)
As application oriented reference http://wwwn.cdc.gov/epiinfo/user-guide/classic-analysis/How-to-Display-Statistics-and-Records-Use-the-TABLES-Command.html
http://wwwn.cdc.gov/epiinfo/user-guide/StatCalc/How-to-Analysis-of-Single-and-Stratified-Tables.html
(for epidemiologic analysis)