JumpDiffSim is an R package that implements the Merton (1976) and Kou (2002) jump-diffusion models through a unified S4 object-oriented interface. It provides exact compound-Poisson asset price simulation, maximum-likelihood parameter estimation with Hessian-based standard errors, Wald-type confidence intervals, theoretical moment calculations, and publication-quality diagnostic plots — all designed to run entirely offline without any dependency on live market data.
Installation
Install the development version from GitHub:
# install.packages("devtools") devtools::install_github("kennedy2244/JumpDiffSim")
Install a specific release version:
devtools::install_github("kennedy2244/JumpDiffSim@v0.1.0")
Quick Start
The core workflow is three steps: create a model → simulate paths → fit to data.
library(JumpDiffSim) # ── Step 1: Create a Merton model object ───────────────────── m <- MertonModel( mu = 0.05, # drift sigma = 0.20, # diffusion volatility lambda = 1.00, # average jumps per year mu_j = -0.10, # mean log-jump size sigma_j = 0.15 # std dev of log-jumps ) show(m) #> Merton Jump-Diffusion Model #> --------------------------- #> mu : 0.0500 #> sigma : 0.2000 #> lambda : 1.0000 #> mu_j : -0.1000 #> sigma_j : 0.1500 # ── Step 2: Simulate 200 asset price paths ─────────────────── sim <- simulateMerton(m, n = 200, T_ = 1, steps = 252, seed = 42) plts <- diagnosticPlots(sim) print(plts$fan_chart) # path quantile fan (5/25/50/75/95th percentiles) print(plts$density) # empirical return density vs Normal print(plts$acf_sq) # ACF of squared log-returns # ── Step 3: Fit model to synthetic data via MLE ────────────── ret <- jdSampleData("merton", n = 500, seed = 42) fit <- fitMerton(ret) print(fit) #> Merton MLE Fit Result #> --------------------- #> Converged : TRUE #> Log-lik : 487.2341 #> Estimates (SE): #> mu : 0.0489 (0.0021) #> sigma : 0.1987 (0.0045) #> lambda : 0.9823 (0.1234) #> mu_j : -0.0998 (0.0187) #> sigma_j : 0.1502 (0.0134) confint(fit) #> 2.5 % 97.5 % #> mu 0.044710 0.053090 #> sigma 0.189896 0.207504 #> lambda 0.740434 1.224166 #> mu_j -0.136443 -0.063157 #> sigma_j 0.123890 0.176510
Parameters
| Parameter | Symbol | Description |
|---|---|---|
mu |