M3a: HiddenMarkov is the vital package, JSON is hand-rolled

Correct the R dependency: HiddenMarkov (CRAN) for HMM regime
detection (Viterbi, Baum-Welch); JSON I/O for Hub protocol is
hand-rolled, not jsonlite. Everything else uses base R primitives.
This commit is contained in:
Claude 2026-07-18 04:18:33 +00:00
parent 31b29cab32
commit 3da931ecad
No known key found for this signature in database
2 changed files with 13 additions and 9 deletions

View File

@ -75,13 +75,16 @@ else
fi fi
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# R + jsonlite (economy organ: M3a statistical sims) # R + HiddenMarkov (economy organ: M3a statistical sims)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
if command -v Rscript >/dev/null 2>&1 && Rscript -e 'library(jsonlite)' >/dev/null 2>&1; then if command -v Rscript >/dev/null 2>&1 && Rscript -e 'library(HiddenMarkov)' >/dev/null 2>&1; then
log "R + jsonlite already present; skipping." log "R + HiddenMarkov already present; skipping."
else else
log "Installing r-base-core r-cran-jsonlite via apt-get ..." log "Installing r-base-core 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." sudo apt-get install -y r-base-core || die "apt-get install of r-base-core failed."
log "Installing HiddenMarkov from CRAN ..."
Rscript -e 'install.packages("HiddenMarkov", repos="https://cloud.r-project.org", quiet=TRUE)' \
|| die "CRAN install of HiddenMarkov failed."
fi fi
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------

View File

@ -17,10 +17,11 @@ for crypto markets C1.
## 3. Language & location ## 3. Language & location
**R 4.x** (apt `r-base-core`) · `src/economy/sims/statistical/`. Minimal dependencies: **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, `r-base-core` + `HiddenMarkov` (CRAN — Viterbi filter, forward-backward, Baum-Welch). GARCH,
HMM, DCC, copula, jump-diffusion, fBM — are hand-rolled using base R primitives (`optim`, Heston SDE, DCC, copula, jump-diffusion, and fBM are hand-rolled using base R primitives
`fft`, `arima`, matrix ops). No CRAN statistical packages. Fractional Brownian motion via (`optim`, `fft`, `arima`, matrix ops). JSON I/O for the Hub stdin/stdout protocol is
spectral methods (Hosking 1984 / Wood & Chan 1994) uses base R `fft()`. hand-rolled. Fractional Brownian motion via spectral methods (Hosking 1984 / Wood & Chan 1994)
uses base R `fft()`.
## 4. Does / does-not ## 4. Does / does-not
- **Does:** run Monte Carlo price simulations (GBM, Merton jump-diffusion, Heston stochastic - **Does:** run Monte Carlo price simulations (GBM, Merton jump-diffusion, Heston stochastic