-
-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Looking for a mixed-anova with 3 factors #182
Comments
Hi @romquentin, it's unfortunately not possible right now, see: #136 #179 I personally used rpy2 and from there the R package "afex". See a code snippet below. In that snippet I also install R packages from Python ... but I'd recommend installing them via conda (conda-forge channel) instead. you can also install R in your conda env via conda - it's very convenient that way. But of course if pingouin had that feature, it'd be even nicer :) import rpy2.robjects as ro
import rpy2.robjects.packages as rpackages
from rpy2.robjects import pandas2ri, StrVector
from rpy2.robjects.conversion import localconverter
# install packages
packageNames = ("afex", "emmeans")
utils = rpackages.importr("utils")
utils.chooseCRANmirror(ind=1)
packnames_to_install = [x for x in packageNames if not rpackages.isinstalled(x)]
if len(packnames_to_install) > 0:
utils.install_packages(StrVector(packnames_to_install))
# convert pandas DF ("tmp") to R data.frame
with localconverter(ro.default_converter + pandas2ri.converter):
r_from_pd_df = ro.conversion.py2rpy(tmp)
r_from_pd_df.head()
afex = rpackages.importr("afex")
## see: https://cran.r-project.org/web/packages/afex/afex.pdf
model = afex.aov_ez(
id="subject",
dv="correct_choice",
between=["stopping", "yoked_to"],
within="sampling",
data=r_from_pd_df,
check_contrasts=True, # 3-way interaction is unaffected by this, "True" is recommended
type=3, # using so-called type 3 sums of squares
print_formula=True,
)
print(model) |
Very cool ! Thanks a lot @sappelhoff !! |
Thanks @sappelhoff for the code snippet! I'm leaving this issue open as I'm sure it will benefit other people. For more complex ANOVA models, I also strongly recommend using JASP. I don't have the time to implement such models right now, so unfortunately I don't think it will be implemented in Pingouin in a near future. Thanks, |
Closing this issue but feel free to reopen! |
Hello,
Thanks for the great package !
I am looking for a mixed-anova with 3 factors (2 within, 1 between). Is there a way to do that with pinguoin?
Would you know another python package if not?
Thanks a lot!
Romain
The text was updated successfully, but these errors were encountered: