R/ch4.man.R

Defines functions ch4.man

Documented in ch4.man

#' @title Manual for Ch4. Functions
#' @description Ch4. Random Variables and Probability Distributions
#' @usage ch4.man(fn = 0)
#' @param fn Function Number (0-14). Default: 0
#' @return None.
#' @examples
#' ch4.man()
#' ch4.man(7:8)
#' @export
ch4.man <- function(fn = 0) {
  if (0 %in% fn) {
    cat("[1] rolldie.sum\tPDF of the Sum of n Dice \n")
    cat("[2] hyp.sample\tPDF of the Number of Successes from Finite Population\n")
    cat("[3] disc.cdf\tCDF of a Discrete Random Variable\n")
    cat("[4] cont.cdf\tCDF of a Continuous Random Variable\n")
    cat("[5] disc.joint2\tJoint PDF of Two Discrete Random Variables\n")
    cat("[6] cont.jcdf\tJoint CDF of Two Continuous Random Variables\n")
    cat("[7] cont.jcdfp\tJoint CDF Plot of Two Continuous Random Variables\n")
    cat("[8] disc.marg2\tMarginal PDF of Two Discrete Random Variables\n")
    cat("[9] cont.marg2\tMarginal PDF Plot of Two Continuous Random Variables\n")
    cat("[10] disc.cond2\tConditional PDF of Discrete Random Variables\n")
    cat("[11] cont.cond2\tConditional PDF Plot of Two Continuous Random Variables\n")
    cat("[12] disc.ind2\tIndependence of Two Discrete Random Variables\n")
    cat("[13] cont.ind2\tIndependence of Two Continuous Random Variables\n")
    cat("[14] cont.trans\tTransforming PDF of a Continuous Random Variable\n")
  }
  if (1 %in% fn) {
    cat("[1] PDF of the Sum of n Dice \n")
    cat("rolldie.sum(n, cex=1)\n")
    cat("[Mandatory Input]--------------------------\n")
    cat("n\t Number of dice\n")
    cat("[Optional Input]--------------------------\n")
    cat("cex\t Text size (default=1)\n")
  }
  if (2 %in% fn) {
    cat("[2] PDF of the Number of Successes from Finite Population\n")
    cat("hyp.sample(npop, ndef, nsamp, cex=0.8, dig=4)\n")
    cat("[Mandatory Input]--------------------------\n")
    cat("npop\t Population size\n")
    cat("ndef\t Number of success items in the population\n")
    cat("nsamp\t Sample size\n")
    cat("[Optional Input]--------------------------\n")
    cat("cex\t Text size (default=0.8)\n")
    cat("dig\t Number of digits below the decimal point (default=4)\n")
  }
  if (3 %in% fn) {
    cat("[3] CDF of a Discrete Random Variable\n")
    cat("disc.cdf(xv, xp, mt, cpt=1.2, cex=1, dig=3)\n")
    cat("[Mandatory Input]--------------------------\n")
    cat("xv\t Vector of values of the discrete random variable\n")
    cat("xp\t Vector of the discrete probability(or frequency)\n")
    cat("[Optional Input]--------------------------\n")
    cat("mt\t Graph Title of the CDF \n")
    cat("cpt\t Text size of the limit points (default=1.2)\n")
    cat("cex\t Text size of the probability (default=1)\n")
    cat("dig\t Number of digits below the decimal point (default=3)\n")
  }
  if (4 %in% fn) {
    cat("[4] CDF of a Continuous Random Variable\n")
    cat("cont.cdf(FUN, low, up, xs, mt, dig=4, pos=\"bottomright\")\n")
    cat("[Mandatory Input]--------------------------\n")
    cat("FUN\t Probability density function\n")
    cat("low\t Lower limit of x-axis\n")
    cat("up \t Upper limit of x-axis\n")
    cat("[Optional Input]--------------------------\n")
    cat("xs\t Specific values of X for displaying the probability\n")
    cat("mt\t Graph Title of the CDF \n")
    cat("dig\t Number of digits below the decimal point (default=4)\n")
    cat("pos\t Legend location (default=\"bottomright\")\n")
  }
  if (5 %in% fn) {
    cat("[5] Joint PDF of Two Discrete Random Variables\n")
    cat("require(scatterplot3d)\n")
    cat("disc.joint2(X, Y, prt=TRUE, plot=FALSE, dig=4, dig2=3, ep=0)\n")
    cat("[Mandatory Input]--------------------------\n")
    cat("X\t Sample space vector of the first random variable\n")
    cat("Y\t Sample space vector of the second random variable\n")
    cat("[Optional Input]--------------------------\n")
    cat("prt\t Logical value for printing the joint frequency and probability (default=TRUE)\n")
    cat("plot\t Logical value for plotting the joint PDF (default=FALSE)\n")
    cat("dig\t Number of digits below the decimal point in the console (default=4)\n")
    cat("dig2\t Number of digits below the decimal point in the graph (default=3)\n")
    cat("ep \t Minimum value for displaying the joint probability (default=0)\n")
  }
  if (6 %in% fn) {
    cat("[6] Joint CDF of Two Continuous Random Variables\n")
    cat("cont.jcdf(FUN, xs, ys, lo1=-Inf, lo2=-Inf)\n")
    cat("[Mandatory Input]--------------------------\n")
    cat("FUN\t Continuous joint PDF function\n")
    cat("xs\t Specific values of X for displaying the cumulative probability\n")
    cat("ys\t Specific values of Y for displaying the cumulative probability\n")
    cat("[Optional Input]--------------------------\n")
    cat("lo1\t Lower limit of X (default=-Inf)\n")
    cat("lo2\t Lower limit of Y (default=-Inf)\n")
  }
  if (7 %in% fn) {
    cat("[7] Joint CDF Plot of Two Continuous Random Variables\n")
    cat("require(scatterplot3d)\n")
    cat("cont.jcdfp(FUN, lo1, up1, lo2, up2, mt)\n")
    cat("[Mandatory Input]--------------------------\n")
    cat("FUN\t Continuous joint PDF function\n")
    cat("lo1\t Lower limit of x-axis\n")
    cat("up1\t Upper limit of x-axis\n")
    cat("lo2\t Lower limit of y-axis\n")
    cat("up2\t Upper limit of y-axis\n")
    cat("[Optional Input]--------------------------\n")
    cat("mt\t Title of the joint PDF plot\n")
  }
  if (8 %in% fn) {
    cat("[8] Marginal PDF of Two Discrete Random Variables\n")
    cat("disc.marg2(tabXY, Xn, Yn, prt=TRUE, plot=FALSE, dig=5, dig2=4)\n")
    cat("[Mandatory Input]--------------------------\n")
    cat("tabXY\t Joint frequency table of two random variables\n")
    cat("[Optional Input]--------------------------\n")
    cat("Xn\t Name of the first random variable (default=\"X\")\n")
    cat("Yn\t Name of the second random variable (default=\"Y\")\n")
    cat("prt\t Logical value for printing the marginal frequency and probability (default=TRUE)\n")
    cat("plot\t Logical value for plotting the marginal PDF (default=FALSE)\n")
    cat("dig\t Number of digits below the decimal point in the console (default=5)\n")
    cat("dig2\t Number of digits below the decimal point in the graph (default=4)\n")
  }
  if (9 %in% fn) {
    cat("[9] Marginal PDF Plot of Two Continuous Random Variables\n")
    cat("cont.marg2(FUN, lo1, up1, lo2, up2, xs, ys)\n")
    cat("[Mandatory Input]--------------------------\n")
    cat("FUN\t Continuous joint PDF function\n")
    cat("lo1\t Lower limit of x-axis\n")
    cat("up1\t Upper limit of x-axis\n")
    cat("lo2\t Lower limit of y-axis\n")
    cat("up2\t Upper limit of y-axis\n")
    cat("[Optional Input]--------------------------\n")
    cat("xs\t Specific value of X for displaying the probability density\n")
    cat("ys\t Specific value of Y for displaying the probability density\n")
  }
  if (10 %in% fn) {
    cat("[10] Conditional PDF of Discrete Random Variables\n")
    cat("disc.cond2(tabXY, Xs, Ys, prt=TRUE, plot=FALSE, dig=5, dig2=4)\n")
    cat("[Mandatory Input]--------------------------\n")
    cat("tabXY\t Joint frequency table of two random variables\n")
    cat("[Mandatory Input (either one of the follows)]\n")
    cat("Xs\t Conditioning value of X\n")
    cat("Ys\t Conditioning value of Y\n")
    cat("[Optional Input]--------------------------\n")
    cat("prt\t Logical value for printing the marginal frequency and probability (default=TRUE)\n")
    cat("plot\t Logical value for plotting the marginal PDF (default=FALSE)\n")
    cat("dig\t Number of digits below the decimal point in the console (default=5)\n")
    cat("dig2\t Number of digits below the decimal point in the graph (default=4)\n")
  }
  if (11 %in% fn) {
    cat("[11] Conditional PDF Plot of Two Continuous Random Variables\n")
    cat("cont.cond2(FUN, xc, yc, xs, ys, lo, up)\n")
    cat("[Mandatory Input]--------------------------\n")
    cat("FUN\t Continuous joint PDF function\n")
    cat("lo\t Lower limit of the conditioned random variable\n")
    cat("up\t Upper limit of the conditioned random variable\n")
    cat("[Mandatory Input (either one of the follows)]\n")
    cat("xc\t Conditioning value of X\n")
    cat("yc\t Conditioning value of Y\n")
    cat("[Optional Input]--------------------------\n")
    cat("xs\t Specific value of X for displaying the density (given yc)\n")
    cat("ys\t Specific value of Y for displaying the density (given xc)\n")
  }
  if (12 %in% fn) {
    cat("[12] Determine Independence of Two Discrete Random Variables\n")
    cat("disc.ind2(X, Y, prt=TRUE)\n")
    cat("[Mandatory Input]--------------------------\n")
    cat("X\t Sample space vector of X\n")
    cat("Y\t Sample space vector of Y\n")
    cat("[Optional Input]--------------------------\n")
    cat("prt\t Logical value for printing detailed output (default=TRUE)\n")
  }
  if (13 %in% fn) {
    cat("[13] Determine Independence of Two Continuous Random Variables\n")
    cat("cont.ind2(FUN, lo1, up1, lo2, up2, n=11, ep = 1E-6, prt=FALSE)\n")
    cat("[Mandatory Input]--------------------------\n")
    cat("FUN\t Continuous joint PDF\n")
    cat("lo1\t Lower limit of X\n")
    cat("up1\t Upper limit of X\n")
    cat("lo2\t Lower limit of Y\n")
    cat("up2\t Upper limit of Y\n")
    cat("[Optional Input]--------------------------\n")
    cat("n \t Number of checking points between lower and upper limit (default=11)\n")
    cat("ep\t Error bound for comparing probablities (default=1E-6)\n")
    cat("prt\t Logical value for printing detailed output (default=FALSE)\n")
  }
  if (14 %in% fn) {
    cat("[14] Transformed PDF of a Continuous Random Variable\n")
    cat("cont.trans(fx, TF, FTF, a, b, lo=0, up=1, plot=FALSE, ...)\n")
    cat("[Mandatory Input]--------------------------\n")
    cat("fx\t PDF of the original random variable\n")
    cat("TF\t List of transform functions (1~8)\n")
    cat("FTF\t List of transformed PDF (1~8)\n")
    cat("a\t Lower limit of the original random variable for calculating P(a<X<b)\n")
    cat("b\t Upper limit of the original random variable for calculating P(a<X<b)\n")
    cat("[Optional Input]--------------------------\n")
    cat("lo\t Lower limit of the original random variable (default=0)\n")
    cat("up\t Upper limit of the original random variable(default=1)\n")
    cat("plot\t Logical value for plotting the PDF (default=FALSE)\n")
    cat("... \t Graphic parameters\n")
  }
}
jhk0530/Rstat documentation built on Dec. 20, 2021, 11:11 p.m.