Skip to content
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

Add support for starting with model fits rather than data #22

Open
marcora opened this issue Dec 9, 2024 · 7 comments
Open

Add support for starting with model fits rather than data #22

marcora opened this issue Dec 9, 2024 · 7 comments

Comments

@marcora
Copy link

marcora commented Dec 9, 2024

It would be great if a tidyplots pipeline could also start with a model fit rather than data. This would allow, for example, to display statistical results for more complex experimental designs (e.g., when using multilevel models in the presence of pseudoreplicates). Alternatively, support for passing a emmeans or marginaleffects object to some of the add_* functions could also be a possible solution.

@jbengler
Copy link
Owner

Hi @marcora

Thank you for using tidyplots!

I fear that that the support of data types other than tidy data frames is beyond the scope of tidyplots. I would suggest to try to extract a data frame out of your upstream analysis and use this for plotting.

Best
Jan

@marcora
Copy link
Author

marcora commented Dec 11, 2024

Most model fit objects can be made into tidy data frames, with the original data, model predictions, and statistical details. Packages like broom and insight facilitates that. But I was mainly referring to the fact that tidyplots already support marginal effects calculations with emmeans and it would be nice to have support for more complex experimental designs/models beyond simple tests.

@jbengler
Copy link
Owner

jbengler commented Dec 11, 2024

You are probably referring to the function add_curve_fit(). Right?
This is basically a wrapper around ggplot2::geom_smooth().

It supports a number of choices for the argument method:
https://jbengler.github.io/tidyplots/reference/add_curve_fit.html

However, I have to admit I am not an expert in modeling, so you might have to explain in a little more detail how you would implement the functionality you are looking for.

@marcora
Copy link
Author

marcora commented Dec 12, 2024 via email

@marcora
Copy link
Author

marcora commented Dec 12, 2024 via email

@jbengler
Copy link
Owner

The functionality of add_test_*() and add_curve_fit()is sourced from ggpubr::geom_pwc() and ggplot2::geom_smooth(), respectively.

https://rpkgs.datanovia.com/ggpubr/reference/geom_pwc.html
https://ggplot2.tidyverse.org/reference/geom_smooth.html

Given my limited expertise in data modeling, I do not see myself implementing additional functionality in that direction, which is not covered by these two functions.

If you are aware of additional ggplot2 extensions that provide the functionality you are looking for, let me know and I will have a look at them.

@marcora
Copy link
Author

marcora commented Dec 12, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants