R/print_Wiener.R

Defines functions print.Diffusion_cdf print.Diffusion_pdf print.Diffusion_deriv

#' @export
print.Diffusion_deriv <- function(x, ...) {
  der <- c("dt", "da", "dv", "dw", "dt0", "dsv", "dsw", "dst0", "grad")
  cll <- as.character(x$call[1])
  fnc <- ifelse(grepl("PDF", cll), "PDF", "CDF")
  der <- ifelse(grepl("dtW", cll), "t", 
                ifelse(grepl("da", cll), "a", 
                       ifelse(grepl("dv", cll), "v", 
                              ifelse(grepl("dw", cll), "w", 
                                     ifelse(grepl("dt0", cll), "t0", 
                                            ifelse(grepl("dsv", cll), "sv", 
                                                   ifelse(grepl("dsw", cll), "sw", 
                                                          ifelse(grepl("st0", cll), "st0", "all params")))))))
  )
  
  grepl("grad", cll)
  cat(paste0("\nPartial derivative of ", fnc, " with respect to ", der, "\n\n"))
  print(x$deriv)
  cat("\n---------------------------\n")
}

#' @export
print.Diffusion_pdf <- function(x, ...) {
  cat(paste0("\nFirst-passage time PDF\n\n"))
  print(x$value)
  cat("\n---------------------------\n")
  cat(paste0("\nLog of first-passage time PDF\n\n"))
  print(x$logvalue)
  cat("\n---------------------------\n\n")
}

#' @export
print.Diffusion_cdf <- function(x, ...) {
  cat(paste0("\nFirst-passage time CDF\n\n"))
  print(x$value)
  cat("\n---------------------------\n")
  cat(paste0("\nLog of first-passage time CDF\n\n"))
  print(x$logvalue)
  cat("\n---------------------------\n\n")
}

Try the WienR package in your browser

Any scripts or data that you put into this service are public.

WienR documentation built on July 9, 2023, 5:16 p.m.