diff --git a/.claude/hooks/install-toolchains.sh b/.claude/hooks/install-toolchains.sh index 2c53c52..bd127b8 100755 --- a/.claude/hooks/install-toolchains.sh +++ b/.claude/hooks/install-toolchains.sh @@ -74,6 +74,16 @@ else log "fpm $(fpm --version 2>&1 | head -1)" fi +# --------------------------------------------------------------------------- +# R + jsonlite (economy organ: M3a statistical sims) +# --------------------------------------------------------------------------- +if command -v Rscript >/dev/null 2>&1 && Rscript -e 'library(jsonlite)' >/dev/null 2>&1; then + log "R + jsonlite already present; skipping." +else + log "Installing r-base-core r-cran-jsonlite via apt-get ..." + sudo apt-get install -y r-base-core r-cran-jsonlite || die "apt-get install of r-base-core/r-cran-jsonlite failed." +fi + # --------------------------------------------------------------------------- # Tcl (economy organ: M3 sim hub) # --------------------------------------------------------------------------- diff --git a/core/docs/plans/M3a-statistical-sims.md b/core/docs/plans/M3a-statistical-sims.md index 0b0b91f..153caeb 100644 --- a/core/docs/plans/M3a-statistical-sims.md +++ b/core/docs/plans/M3a-statistical-sims.md @@ -16,10 +16,11 @@ execution C5 (industry standard since 2001). Jump-diffusion C5 (Merton 1976). Pa for crypto markets C1. ## 3. Language & location -TBD · `src/economy/sims/statistical/`. **R** — native statistical distribution ecosystem, -matrix operations, and time-series libraries (GARCH, ARIMA, HMM) without wrapping external -solvers. Fractional Brownian motion generation uses spectral methods (Hosking 1984, Wood & Chan -1994) or Cholesky decomposition of the covariance matrix. +**R 4.x** (apt `r-base-core`) · `src/economy/sims/statistical/`. Minimal dependencies: +`r-base-core` + `jsonlite` (Hub JSON protocol). All statistical models — GARCH, Heston SDE, +HMM, DCC, copula, jump-diffusion, fBM — are hand-rolled using base R primitives (`optim`, +`fft`, `arima`, matrix ops). No CRAN statistical packages. Fractional Brownian motion via +spectral methods (Hosking 1984 / Wood & Chan 1994) uses base R `fft()`. ## 4. Does / does-not - **Does:** run Monte Carlo price simulations (GBM, Merton jump-diffusion, Heston stochastic