R/print.quantileplot.R

Defines functions print.quantileplot

Documented in print.quantileplot

#' Print function for \code{quantileplot} objects
#' @description Prints the plot generated by \code{quantileplot}
#' @param x An object of class \code{quantileplot}, which results from a call to the function \code{quantileplot}
#' @param ... Other arguments to \code{print} commands
#' @return Prints the plot generated by \code{quantileplot}
#' @references Lundberg, Ian, Robin C. Lee, and Brandon M. Stewart. 2021. "The quantile plot: A visualization for bivariate population relationships." Working paper.
#' @references Lundberg, Ian, and Brandon M. Stewart. 2020. "Comment: Summarizing income mobility with multiple smooth quantiles instead of parameterized means." Sociological Methodology 50(1):96-111.
#' @references Fasiolo, Matteo, Simon N. Wood, Margaux Zaffran, Raphaƫl Nedellec, and Yannig Goude. 2020. "Fast calibrated additive quantile regression." Journal of the American Statistical Association.
#' @export

print.quantileplot <- function(x, ...) {

  # If there is a lack of convergence, warn the user.
  convergence <- sapply(x$mqgam.out$fit, function(each_fit) each_fit$converged)
  if (any(!convergence)) {
    print("Warning: Convergence not achieved for the following quantile curves.")
    print(names(convergence[!convergence]))
  }

  # Print the plot
  plot(x)
}
ilundberg/quantileplot documentation built on May 23, 2022, 3:12 a.m.