This vignette documents the probability distributions exported by CausalMixGPD and the corresponding d/p/q/r functions used throughout the package. For a continuous random variable (Y) with parameter scalars (), we use the standard quartet:
Density (PDF): (f(y)), implemented by d*().
Distribution (CDF): (F(y)=(Yy)), implemented by p*().
Quantile: (Q(p) = {y: F(y)p}), implemented by q*().
Random generation: (Y = Q(U)) with (U(0,1)), implemented by r*().
All d*() functions optionally return log-densities via log = TRUE, i.e., (f(y)). This is numerically convenient because likelihoods multiply densities but add log-densities: [ {{i=1}^n f(y_i)}={i=1}^n f(y_i). ]
All p*() functions support lower.tail and log.p: [ (Y>y)=1-F(y),F(y) {1-F(y)}. ]
The exported uppercase NIMBLE kernels are scalar in their first argument, and r*() kernels are implemented for n = 1. For vectorized R usage (including n > 1), use the lowercase wrapper families documented in the *_lowercase help topics.
Code
w <-c(0.60, 0.40)shape <-c(2.0, 5.0)scale <-c(1.0, 2.0)dGammaMix(seq(0.5, 2.0, length.out =5), w = w, shape = shape, scale = scale)
Several kernels are available as finite mixtures. Let (f_j(j)) denote the (j)th component density and let (=(w_1,,w_J)) be mixture weights with (w_j) and ({j=1}^J w_j=1). The mixture density and CDF are
Random generation proceeds by sampling a latent component index (Z()), then sampling (YZ=jf_j(_j)). Mixture quantiles typically require numerical inversion of the mixture CDF.
GPD tails and splicing
The Generalized Pareto Distribution (GPD) is used for tail modeling relative to a threshold (u). In the spliced kernels (the *Gpd functions), a bulk kernel is used below (u) and a GPD tail is attached above (u), with parameters ((u,,)). In code, these are represented by threshold = u, tail_scale = \sigma, and tail_shape = \xi (the standalone GPD functions use scale and shape for () and ()).
Prereqs
Required packages and data for this page are listed in the setup chunks above.
Outputs
This page renders model fits, diagnostics, and summary artifacts generated by package APIs.