aphalo / ggpmisc

R package ggpmisc is an extension to ggplot2 and the Grammar of Graphics
https://docs.r4photobiology.info/ggpmisc
97 stars 6 forks source link

Confidence intervals for model-fit parameter estimates #23

Open aphalo opened 2 years ago

aphalo commented 2 years ago

Some time ago a request/suggestion for supporting in stat_poly_eq() CIs for the fitted coefficients and other parameter estimates was made. More recently, a pull request at https://github.com/kassambara/ggpubr/pull/418 and comments on it discussed CIs for correlation.

A CI for R2 could be useful in all the _eq statistics and could be obtained with package 'confintr'. For rank correlation CIs for tau and rho can be also computed using functions from 'confintr'. CIs for parameter estimates would be useful in stat_fit_tb() with summary tables. Could be implemented using confint() methods from 'stats', 'lme4' and 'MASS', or intervals() from 'nlme' .

This is a note to myself, for the future, only tentatively assigned to a milestone as most likely CIs will be implemented in stages at different milestones for different statistics. CIs for rho, tau and R^2 seem to be most useful and would help in achieving consistency in the available labels across similar statistics. Those for parameter estimates are in many circumstances more informative than t-values and p-values.

aphalo commented 2 years ago

Based on karl-an comments at https://github.com/kassambara/ggpubr/pull/418 I implemented CIs in stat_correlation() for 'ggpmisc' >= 0.4.8.

aphalo commented 2 years ago

Now CIs for R2 are implemented in stat_poly_eq() for 'ggpmisc' >= 0.4.8.

aphalo commented 2 years ago

Implementation of CIs in stat_fit_tb() will not make to 'ggpmisc' 0.4.8. So, the issue remains open.

aphalo commented 1 year ago

I implemented CI for R2. CIs could be computed for other parameters but how would they be displayed in a plot? Possibly in an inset table. If I implement them, they will not be in stat_poly_eq().