Learn R Programming

fitPlotR (version 0.1.0)

plot_fitted: Plot Fitted Distribution with Diagnostic Plots

Description

This function produces a 2x2 panel of plots for a fitted distribution: 1. Fitted PDF over histogram of data 2. Fitted CDF vs empirical CDF 3. QQ-plot (Theoretical vs Sample Quantiles) 4. PP-plot (Fitted CDF vs Empirical CDF)

Usage

plot_fitted(
  data,
  pdf_fun,
  cdf_fun,
  par,
  q_fun = NULL,
  xlim = NULL,
  ylim_pdf = NULL,
  ylim_cdf = NULL,
  lwd = 3,
  lty = 2,
  col_pdf = "yellow",
  col_cdf = "red",
  col_qq = "purple",
  col_pp = "darkgreen"
)

Value

NULL (plots are generated as a side effect)

Arguments

data

Numeric vector of observed data.

pdf_fun

Function to compute the PDF; must take (par, x).

cdf_fun

Function to compute the CDF; must take (par, x).

par

Numeric vector of fitted parameters.

q_fun

Optional quantile function; must take (par, p). Default = NULL.

xlim

Numeric vector of length 2 for x-axis limits (default = range of data).

ylim_pdf

Numeric vector for y-axis limits of the PDF plot.

ylim_cdf

Numeric vector for y-axis limits of the CDF plot.

lwd

Line width for curves (default = 3).

lty

Line type for curves (default = 2).

col_pdf

Color for the PDF curve (default = "yellow").

col_cdf

Color for the CDF curve (default = "red").

col_qq

Color for QQ-plot points (default = "purple").

col_pp

Color for PP-plot points (default = "darkgreen").