ggpmisc 0.4.3

Version 0.4.3 contain the bug fix implemented in version 0.4.2-2, which did not make it to CRAN. (See bug listed under 1. in the post ggpmisc 0.4.2.)

New

  1. Add stat_ma_line() and stat_ma_eq() implementing support for major axis (MA), standard major axis (SMA), ranged major axis (RMA) and ordinary least squares (OLS) using function lmodel2() from package ‘lmodel2’.

Documentation web site at http://docs.r4photobiology.info/ggpmisc/ includes all help pages, with output from all examples, vignettes as well as a changelog in HTML format.

NOTE: Version 0.4.3 is on its way to CRAN.

Please raise issues concerning bugs or enhancements to this package through GitHub https://github.com/aphalo/ggpmisc/issues

ggpmisc 0.4.2

During the major updates to 0.4.0 and 0.4.1 some bugs slipped through various tests. Versions 0.4.2, 0.4.2-1 and 0.4.2-2 contain fixes to these bugs. The bug fixed in 0.4.2-2 triggered an error only when R had been built with specific compilers.

Bugs fixed

  1. Error in stat_poly_eq() and stat_quant_eq() under some Linux builds of R, including when used in RStudio Cloud. This bug did not affect Windows.
  2. Failure to find after_stat() when instead of attaching the package with library(ggpmisc) statistics were called using the ggpmisc::<name> notation.
  3. Remove or convert to suggests some dependencies no longer needed after the split of ‘ggpp’.

Documentation web site at http://docs.r4photobiology.info/ggpmisc/ includes all help pages, with output from all examples, vignettes as well as a changelog in HTML format.

NOTE: Version 0.4.2-2 addressing all three bugs was not submitted to CRAN but instead the fix was released in version 0.4.3 now in CRAN.

Please raise issues concerning bugs or enhancements to this package through GitHub https://github.com/aphalo/ggpmisc/issues

ggpmisc 0.4.1

Documentation web site at http://docs.r4photobiology.info/ggpmisc/ includes all help pages, with output from all examples, vignettes as well as a changelog in HTML format.

Overview

This update is special in that it was built with the input of excellent ideas and code contributions from users. I learnt a lot myself and these improvements have made ‘ggpmisc’ more useful in general and for myself. Support for quantile regression is now, I hope, close to its final shape. Support for the new ‘ggplot2’ feature: orientation is implemented in the statistics where it is most useful, and can be also be changed, more intuitively, through the model formula. Of the planned enhancements, implementing support for major axis regression, remains in the to do list. Both stat_poly_eq() and stat_quant_eq() now return additional labels, plus some numeric values to facilitate conditional display. Much of the code used to generate the text labels has been improved, and markdown formatting tested.

The suggestion from Mark Neal of adding support for quantile regression partly addressed in ggpmisc 0.4.0 has lead to additional enhancements in this version. The idea of supporting confidence bands for quantile regression came from Samer Mouksassi who also provided code and examples for different types of quantile regression. Additional suggestions from Mark Neal, Carl and other users have lead to bug fixes as well as to an interface with better defaults for arguments (see issue #1).

Changes compared to ‘ggpmisc’ 0.4.0

Enhancements

  • Support robust regression using rlm and the use of function objects as argument to method in stat_poly_eq().
  • Support in stat_poly_eq() and stat_quant_eq() formula = x ~ y and other models in which the explanatory variable is y in addition to models with x as explanatory variable.
  • stat_poly_eq() and stat_quant_eq() now pass to the geom by default a suitable value as argument to parse depending on output.type (enhancement suggested by Mark Neal in issue #11).
  • stat_poly_eq() and stat_quant_eq() return the coefficient estimates as numeric columns in data when output.type = "numeric"  (problem with coefs.ls reported by cgnolte in issue #12).
  • stat_poly_eq() now supports optional use of lower case for r2 and p-value.
  • Revise stat_poly_eq() and stat_quant_eq() so that by default they keep trailing zeros according to the numbers of significant digits given by coef.digits. A new parameter coef.keep.zeros can be set to FALSE to restore the deletion of trailing zeros. Trailing zeros in the equation will be rendered to the plot only if output.type is other than "expression".
  • Add stat_poly_line(),  a new interface to ggplot2::stat_smooth() accepting formula = x ~ y and other models in which the explanatory variable is y rather than x or setting orientation = "y". In contrast to ggplot2::stat_smooth(), stat_poly_line() has always "lm" as default method.
  • Add stat_quant_line() which is an adaptation of ggplot2::stat_smooth() and ggplot2::stat_quantile() accepting formula = x ~ y and other models in which the explanatory variable is y rather than x or setting orientation = "y" to fit models with x as explanatory variable. This change makes it possible to add to a plot a double quantile regression. stat_quant_line() supports plotting of confidence bands for quantile regression using ggplot2::geom_smooth() to create the plot layer.
  • Add stat_quant_band() which plots quantile regressions for three quantiles as a band plus a line, accepting formula = x ~ y and other models in which the explanatory variable is y rather than x or setting orientation = "y" to fit models with x as explanatory variable.
  • Add support for quantile regression rq, robust regression rlm, and resistant regression lqs and function objects to stat_fit_residuals() and stat_fit_deviations().
  • Support use of stat_fit_residuals() and stat_fit_deviations() with formula = x ~ y and other models in which the explanatory variable is y in addition to models with x as explanatory variable.
  • Add weights to returned values by stat_fit_residuals() and stat_fit_deviations() and add support for the weight aesthetic as input for parameter weights of  model fit functions.

Bugs fixed

  • Fix bug in stat_poly_eq() and stat_quant_eq() resulting in mishandling of formulas using the + 0 notation (reported by orgadish in issue #10).
  • Fix bug in stat_poly_eq() and stat_quant_eq() resulting in bad/non-syntactical character strings for eq.label when output.type was different from its default of "expression".

Documentation web site at http://docs.r4photobiology.info/gginnards/ includes all help pages, with output from all examples, vignettes as well as a changelog in HTML format.

NOTE: The new version of the package is on its way to CRAN.

Please raise issues concerning bugs or enhancements to this package through GitHub https://github.com/aphalo/gginnards/issues

ggpmisc 0.4.0 and ggpp 0.4.0

The main change is the split of package ‘ggpmisc’ into two packages. Starting from this version, package ‘ggpmisc’ focuses only on plot annotations related to model fits and statistical summaries. The new package ‘ggpp’ contains generally useful extensions to the grammar of graphics such as new geometries and position functions. As package ‘ggpmisc’ loads package ‘ggpp’ the migration should have minimal if any impact on users’ code. Package ‘ggpp’ will be most useful to authors of packages that currently import ‘ggpmisc’, including myself. It is good to be aware that the split almost exactly follows the subject matter of the two vignettes previously part of ‘ggpmisc’. When using ‘ggpmisc’, users will notice that some functions have migrated only when consulting the documentation.

‘ggpp’

The package documentation web site at: https://docs.r4photobiology.info/ggpp/ includes a changelog.

Compared to ‘ggpmisc’ 0.3.9, the following changes have been introduced. New justification styles have being implemented to complement position_nudge_center(). They are supported in geom_text_linked(), geom_plot(), geom_table(), geom_grob() and geom_marging_grob(). In the current implementation all rows in data should contain the same hjust or vjust value when using the new types of justification described here, this seems reasonable as they compute the individual justification values from the data. All other justification values, either numeric or character do not have this restriction and can be used as in geoms from ‘ggplot2’. These new features may change in the near future.

  • Rename geom_text_linked().
  • Implement justifications "outward_mean", "inward_mean", "outward_median" and "inward_median" so that outward and inward are with respect to the centroid of the data instead of to the middle of the x or y scales. This should be useful in combination with position_nudge_center().
  • Implement justifications "outward_nnn" and "inward_nnn" so that outward and inward are with respect to the number resulting from applying as.numeric() to the characters that replace nnn. For example strings like "outward_0.5", "inward_3e5" or "outward_-3e-2" are supported. This should be useful when manual tweaking is desired. As special cases "outward_0" and "inward_0" apply justification outward and inward with respect to the origin. This should be useful for biplots used for PCA and similar cases with arrows radiating out of the origin. (The "outward" and "inward" justification implemented in ‘ggplot2’ is relative to the middle of the x or y scales.)
  • Revise compute_npcx() and compute_npcy() to support multiple steps per group (needed in ‘ggpmisc’).
  • Fix problem related to "outward" and "inward" justification of text labels when angle aesthetic takes values < -45 or > 45 degrees. This code change alters how old plots are rendered if text labels have been rotated by more than 45 degrees.
  • [‘ggplot2’, ‘ggrepel’] The problem with angle was a “bug” in ‘ggplot2’ also present in ‘ggrepel’. A pull request for ggplot2::geom_text() has been submitted and merged. This is now in the ‘ggplot2’ 3.3.4 milestone retaining consistent behaviour between ‘ggplot2’, ‘ggrepel’, ‘ggpp’ and ‘ggpmisc’.

Please raise issues concerning bugs or enhancements to this package through GitHub at https://github.com/aphalo/ggpp/issues. Pull requests are also welcome.

‘ggpmisc’

The package documentation web site at: https://docs.r4photobiology.info/ggpmisc/ includes a changelog.

Changes from ‘ggpmisc’ version 0.3.9, the most recent CRAN release, are:

  • Add stat_quant_eq() based on quantile regression as implemented in package ‘quantreg’. (enhancement suggested by Mark Neal)
  • Add n.label and n to the values returned by stat_poly_eq() and stat_quant_eq(). (enhancement suggested by a question from ganidat)
  • Add r.squared, adj.r.squared, p.value and n as numeric to values returned in addition to the corresponding character labels when stat_poly_eq() is called with output.type other than numeric. Similarly for n and rho in the case of stat_quant_eq(). (enhancement suggested by a question from Tiptop)
  • Fix bug in stat_poly_eq() leading to empty returned value when data contains too few observations to fit the model. (reported by ganidat)
  • Add support for quantile regression rq, robust regression rlm, and resistant regression lqs and function objects to stat_fit_deviations().

Please raise issues concerning bugs or enhancements to this package through GitHub at https://github.com/aphalo/ggpmisc/issues. Pull requests are also welcome.

Acknowlegements: I thank Kamil Slowikowski for his contributions of ideas and for his willingness to keep the development of our packages coordinated. This update was done in part to address questions raised and reports of bugs by users, which I thank. The tag [ggpmisc] is in use at stackoverflow for questions related to the use these two packages. I thank Mark Neal for the suggestion that lead to the new statistic stat_quant_eq() and for his help during its testing. I thank Stackoverflow users ganidat and Tiptop for enhancement ideas.

Documentation web sites at https://docs.r4photobiology.info/ggpmisc/ and https://docs.r4photobiology.info/ggpp/ include all help pages, with output from all examples, and vignettes in HTML format. The online vignettes include the output of all code examples, while the vignettes as included in the package, contain the output of only a subset of the code examples so as to keep the documentation at a reasonable size for package distribution.

NOTE: The new package ‘ggpp’ (0.4.0)  is in CRAN and updated ‘ggpmisc’ (0.4.0) is on its way to CRAN. The latest development versions of both packages can be installed from GitHub.

remotes::install_github("aphalo/ggpp")
remotes::install_github("aphalo/ggpmisc")