Espartaco

“Is that to say we are against Free Trade? No, we are for Free Trade, because by Free Trade all economical laws, with their most astounding contradictions, will act upon a larger scale, upon the territory of the whole earth; and because from the uniting of all these contradictions in a single group, where they will stand face to face, will result the struggle which will itself eventuate in the emancipation of the proletariat.”

Karl Heinrich Marx · Marx-Engels Collected Works, Vol. VI, p. 290

EnglishEspañol

Tag: Machine Learning

  • Extracting Signals from Noise: How SignalY Tackles Three Hard Problems in Panel Data Analysis

    Extracting Signals from Noise: How SignalY Tackles Three Hard Problems in Panel Data Analysis

    You can also find this library at CRAN and download it directly from R and RStudio.

    The Problem Every Quantitative Researcher Knows

    Imagine you are staring at a spreadsheet with 50 columns and a few hundred rows of macroeconomic indicators. Somewhere inside this matrix, a handful of variables carry the signal you care about. The rest is noise — or worse, confounding variation that masquerades as signal. You need to answer three questions: Which variables actually matter? What is the latent structure driving them? And how persistent are the components you extract?

    If you have worked with panel data for any length of time, you know that these questions are rarely addressed by a single tool. You run a LASSO in one environment, a PCA in another, an ADF test in a third. Each method lives in a different package with different input formats, different assumptions, and different output structures. Stitching the results together is left to you.

    SignalY is an R package that was built to solve exactly this fragmentation problem. Developed by José Mauricio Gómez Julián and released under the MIT license, it provides a unified framework for signal extraction from panel data through multivariate time series analysis. Its design rests on three analytical pillars — column selection, series decomposition, and persistence analysis — that can be used independently or chained together through a single orchestrating function.

    This post walks through the problem SignalY solves, the methods it implements, and why the combination matters for applied econometrics and data science.


    Pillar 1: Which Variables Matter?

    The first challenge in any high-dimensional analysis is selection. When you have dozens of potential predictors, you need a principled way to determine which ones carry structural information and which ones are along for the ride.

    The Horseshoe Prior

    SignalY approaches this problem through Bayesian sparse regression with the Horseshoe prior. The Horseshoe, introduced by Carvalho, Polson, and Scott (2010) and refined for practical variable selection by Piironen and Vehtari (2017), is a global-local shrinkage prior with a distinctive property: it is aggressive around zero (shrinking noise variables strongly toward zero) while maintaining heavy tails (allowing true signals to escape shrinkage). This dual behavior makes it particularly well-suited for sparse problems where you expect only a few variables to matter, but you do not know which ones.

    The math behind this is elegant. Each coefficient βⱼ is given a prior with two layers of shrinkage:

    • A local parameter λⱼ that controls how much each individual coefficient is shrunk.
    • A global parameter τ that governs overall sparsity.

    The result is a shrinkage profile where most coefficients collapse toward zero — the global pull — while a small number of coefficients stand apart, barely affected — the local escape. This is what gives the Horseshoe its name: the prior density looks like the shape of a horseshoe, with a sharp spike at zero and long, flat arms extending outward.

    SignalY’s fit_horseshoe() function estimates this model and provides built-in shrinkage profile diagnostics, so you can visually inspect which variables survived shrinkage and by how much.

    Four Ways to Select Variables

    Fitting a model is one thing; converting the posterior into a concrete variable selection is another. SignalY offers four distinct selection strategies, each with different strengths:

    1. Projection predictive selection (select_by_projection()): This is the most theoretically robust approach. It works by projecting the full posterior onto candidate submodels and selecting the smallest submodel whose predictive distribution is close enough to the full model. The reference is Piironen and Vehtari (2017), and the implementation respects the posterior geometry rather than relying on ad-hoc thresholds.
    2. Credible interval exclusion (select_by_credible_interval()): Selects variables whose posterior credible intervals do not include zero. Intuitive and easy to interpret, though it can be conservative in high-dimensional settings.
    3. Shrinkage-based selection (select_by_shrinkage()): Uses the kappa (shrinkage fraction) parameters to identify variables that escaped shrinkage. This is useful when you want to understand the degree of shrinkage, not just the binary in-or-out question.
    4. Magnitude-based screening (select_by_magnitude()): A straightforward effect-size filter. Useful as a first pass or when you need to combine Bayesian inference with a frequentist-style screening step.

    The fact that SignalY provides all four in a coherent pipeline — not as separate, unrelated functions — is the key design decision. You can run all four and cross-validate the results, or choose the one that best matches your inferential philosophy.

    Beyond Regression: Factor Discovery

    Sometimes the question is not “which of my 50 variables matter?” but rather “what are the few latent factors driving all 50?” SignalY addresses this through two complementary methods:

    • PCA with block bootstrap (pca_bootstrap()): Standard principal component analysis, but with block bootstrap confidence intervals that account for temporal dependence in time series data. It also includes entropy-based topology analysis, which measures the informational content of each component.
    • Dynamic Factor Models (estimate_dfm()): Implements the Bai and Ng (2002) information criteria for automatic determination of the number of static factors, then fits a VAR (Vector Autoregression) on the factor dynamics. This captures not just what the latent factors are, but how they evolve over time.

    Pillar 2: What Is the Underlying Structure?

    Once you know which variables matter (or have constructed a composite signal), the next question is decomposition: what are the trend, cycle, and residual components of your series?

    This is where signal processing meets econometrics, and SignalY implements three methodologically distinct approaches, each with its own strengths.

    Wavelet Decomposition

    filter_wavelet() implements the Maximal Overlap Discrete Wavelet Transform (MODWT) using Daubechies wavelets, following the framework of Percival and Walden (2000).

    Unlike a Fourier transform, which decomposes a signal into infinite sinusoids (losing all time information), a wavelet decomposes a signal into localized, finite-length oscillations at different scales. The MODWT variant is particularly useful for time series because it does not decimate the data (no downsampling), meaning the output length matches the input length at every scale.

    In practice, the wavelet decomposition separates a series into:

    • Detail coefficients (D1, D2, D3, …): capturing oscillations at progressively coarser time scales — high-frequency noise in D1-D2, business-cycle frequencies in D3-D4, and longer cycles in higher levels.
    • Smooth coefficients (S): the low-frequency approximation that captures the trend.

    SignalY includes multi-resolution variance analysis, which tells you how much of the total variance is explained at each scale. This is invaluable for understanding whether your series is dominated by high-frequency noise, medium-term fluctuations, or long-run trends.

    Empirical Mode Decomposition

    filter_emd() implements Empirical Mode Decomposition (Huang et al., 1998), a fundamentally different approach. Where wavelets impose a predetermined basis (Daubechies, Haar, Symmlet, etc.), EMD is fully data-adaptive. It works by iteratively sifting the signal — identifying local extrema, fitting envelopes, and subtracting the mean — until it extracts Intrinsic Mode Functions (IMFs) that satisfy specific oscillatory conditions.

    The key advantage of EMD is that it makes no assumptions about stationarity or linearity. The IMFs are defined by the data itself, not by a mathematical basis. This makes EMD particularly powerful for:

    • Non-stationary signals whose frequency content changes over time.
    • Non-linear oscillations that cannot be captured by fixed-basis decompositions.
    • Signals where the “natural” decomposition is not known a priori.

    The trade-off is that EMD can be sensitive to end effects and mode mixing, though SignalY’s implementation includes standard mitigations.

    HP-GC Bayesian Filter

    filter_hpgc() implements the Grant and Chan (2017) unobserved-components Hodrick-Prescott filter, estimated via MCMC. This is a significant upgrade over the traditional HP filter, which requires you to manually set the smoothing parameter λ (the famous λ = 1600 for quarterly data, or λ = 6.25 for annual data, or any of the other arbitrary rules of thumb floating around the literature).

    The HP-GC approach formulates the decomposition as a Bayesian unobserved-components model:

    • A trend component whose second differences are penalized (this is the smoothness prior, equivalent to the HP penalty).
    • A cycle component modeled as an AR(2) process.
    • The smoothing parameter λ is estimated from the data via MCMC, not fixed by the user.

    This removes one of the most criticized aspects of the classical HP filter — its sensitivity to the arbitrary choice of λ — while preserving its interpretability. The output includes the estimated trend, cycle, and residual, each with full posterior distributions.

    filter_all(): Compare All Three

    A particularly useful design choice is the filter_all() function, which runs all three decomposition methods on the same series and returns the results in a comparable format. This is not just a convenience function; it is an epistemological statement. No single decomposition method is universally correct. By running all three and comparing, you can identify components that are robust across methods (strong signal) versus components that depend on the specific decomposition assumptions (potentially method artifact).


    Pillar 3: How Persistent Is the Signal?

    The third question — what is the persistence regime of your series or its components — is critical for downstream modeling. If your extracted trend is a random walk, that has very different implications than if it is a stationary AR process. If your cycle is near-unit-root, standard mean-reversion models will fail.

    A Comprehensive Unit Root Battery

    test_unit_root() runs four classical tests with complementary null hypotheses:

    TestNull HypothesisKey Feature
    Augmented Dickey-Fuller (ADF)Unit root existsMost widely used; sensitive to lag selection
    Phillips-Perron (PP)Unit root existsNon-parametric correction for serial correlation
    KPSSSeries is stationaryReversed null; useful as cross-check against ADF
    Elliott-Rothenberg-Stock (ERS)Unit root existsPoint optimal test with higher power near unity

    The critical insight is that no single test is definitive. The ADF and PP tests can fail to reject a false unit root (low power near unity). The KPSS test has the opposite null hypothesis, so it can detect stationarity that ADF misses. By running all four and synthesizing the results, SignalY provides a more robust classification than any individual test.

    The automated synthesis follows a standard decision logic:

    • If ADF/PP/ERS reject unit root and KPSS fails to reject stationarity → stationary.
    • If ADF/PP/ERS fail to reject and KPSS rejects → unit root.
    • Mixed results → borderline / near-unit-root, flagged for careful interpretation.

    This automated synthesis is not a black box; the individual test statistics and p-values are all available for inspection. But the synthesis gives you a quick, defensible classification without manually cross-referencing four separate test outputs.


    The Orchestrator: One Call, Full Pipeline

    The signal_analysis() function is the centerpiece of SignalY’s design philosophy. A single call can run the complete analysis pipeline:

    result <- signal_analysis(
    data = data,
    y_formula = Y ~ X1 + X2 + X3,
    methods = c("wavelet", "emd", "pca", "dfm", "unitroot"),
    verbose = TRUE
    )

    This executes:

    1. Column selection (PCA, DFM, optionally Horseshoe).
    2. Series decomposition (Wavelet, EMD).
    3. Persistence analysis (Unit Root Battery).

    …and returns a unified result object with print(), summary(), and plot() methods. The plot() method generates interactive plotly dashboards with filter trends, coefficient profiles, PCA loadings, and DFM factor panels.

    The formula interface (Y ~ X1 + X2 + X3) makes it feel like a standard R regression call, while the methods argument lets you mix and match analytical layers as needed.


    How Well Does It Work?

    The Wiki includes recovery benchmarks on synthetic data with known ground truth. These are worth highlighting because they address the most important question: does this actually work?

    TaskMethodRecovery Metric
    Factor structure (3 latent factors)PCA / DFMr > 0.95, exact factor count
    Sparse variable selection (5 of 50)HorseshoeF1 > 0.85, Precision > 0.90
    Logarithmic trend recoveryEMDr > 0.95 with true trend
    Multi-scale cycle extractionWavelet (D3+D4)r > 0.70 with true cycle
    Stochastic trend + AR(2) cycleHP-GC BayesianTrend r > 0.90, cycle r > 0.50
    Stationarity classificationUnit Root Battery4/4 correct on synthetic data

    A few things stand out:

    • The Horseshoe achieves over 90% precision in a 5-of-50 sparse selection problem. This means that when it says a variable matters, it is almost always right. The F1 score above 0.85 indicates a good balance between precision and recall.
    • Factor recovery is near-perfect (r > 0.95), and the DFM correctly identifies the exact number of latent factors.
    • Wavelet cycle extraction at r > 0.70 and HP-GC cycle extraction at r > 0.50 reflect the inherent difficulty of extracting cyclical components from noisy data. These are realistic numbers, not inflated claims.
    • Unit root classification achieves 100% accuracy on synthetic data with clear-cut cases. Real-world data is messier, but this validates the synthesis logic.

    Who Should Use SignalY?

    SignalY is built for three overlapping communities:

    Economists and econometricians working with panel or multivariate time series data who need to move from raw data to structural inference — identifying relevant variables, extracting latent factors, decomposing signals, and characterizing persistence — without stitching together five different packages.

    Quantitative researchers in finance, macro, or political economy who face high-dimensional predictor sets and need principled Bayesian variable selection rather than stepwise regression or arbitrary LASSO tuning.

    Data scientists working on signal processing problems where the signals are non-stationary, non-linear, or embedded in high-dimensional panels, and where the standard Python signal processing toolkit does not provide the statistical rigor needed for publication-quality inference.


    Getting Started

    Installation is straightforward:

    # From GitHub
    remotes::install_github("IsadoreNabi/SignalY")
    library(SignalY)
    # Minimal workflow
    data <- data.frame(Y = as.vector(Y), X)
    result <- signal_analysis(data = data, y_formula = "Y",
    methods = c("pca", "wavelet", "unitroot"))
    plot(result)

    The package is MIT-licensed, actively maintained (current version 1.1.2), and designed to work with standard R data frames.


    The Bigger Picture

    What makes SignalY interesting is not any single method — the Horseshoe prior, MODWT, EMD, and unit root tests all exist in other packages. The value is in the integration. By placing Bayesian sparse regression, spectral decomposition, and persistence analysis inside a single coherent framework with a unified interface, SignalY enables workflows that are difficult to replicate otherwise:

    • Run a Horseshoe regression to select variables, then decompose the fitted signal with wavelets, then test the stationarity of the extracted components — all without changing packages, data formats, or mental models.
    • Compare wavelet, EMD, and HP-GC decompositions of the same series to identify robust components versus method-dependent artifacts.
    • Use the DFM to discover latent factors, then test each factor’s persistence regime to inform your downstream modeling choices.

    In applied econometrics, the quality of your inference depends on the coherence of your pipeline. SignalY makes that coherence a feature rather than a chore.


    SignalY is developed by José Mauricio Gómez Julián. The source code, documentation, and wiki are available at github.com/IsadoreNabi/SignalY under the MIT License.

  • topologyR: Turning Time Series into Shapes to Test What Your Models Quietly Assume

    topologyR: Turning Time Series into Shapes to Test What Your Models Quietly Assume

    You can also find this library at CRAN and download it directly from R and RStudio.

    There is a habit so embedded in quantitative work that most practitioners never think to question it. You have a time series — quarterly GDP, an EEG channel, a temperature record — and at some point you fit a smooth curve through it, interpolate a missing value, or estimate a “long-run trend.” All of these moves rest on a single, seldom-checked assumption: that the data form one continuous whole, that a single smooth function can legitimately pass through every point.

    But what if they don’t? What if your series is, structurally, two or three disjoint pieces glued together by the calendar — pieces between which no continuous function can travel? In that case, the spline you just fitted is not an approximation of reality; it is a mathematical fiction painted over a fracture.

    topologyR is an R package that lets you check this before you model. It takes a numeric time series, converts it into a graph, converts that graph into a topological space, and then asks the one question that determines whether global continuous methods are even valid: is this space one connected piece, or several?

    It sounds abstract. It is abstract — but the consequence is concrete. The package is the work of José Mauricio Gómez Julián, and it is open-source, with a GitHub repository, a detailed Wiki, and a companion research paper archived on Zenodo. What follows is a tour of what the package does, why it matters, and where it fits in the broader landscape of topological data analysis.


    The Hidden Assumption

    Think about what happens when you impute a missing value in a time series using a cubic spline. The spline assumes that the points on either side of the gap belong to the same continuous process — that the missing value lies somewhere along a smooth bridge between them. If the series has actually undergone a structural break, a regime change, or a discontinuity between those points, the spline will happily produce a number, and that number will be wrong in a way no confidence interval can capture.

    This is not a niche problem. It appears in econometrics (trend estimation across business cycles), in neuroscience (coherence across brain-state transitions), in climatology (warming trends across regime shifts). The methodological error is always the same: assuming continuity without first verifying that continuity is mathematically possible.

    topologyR’s contribution is to make that verification explicit, parameter-free, and exact.


    From Numbers to Shapes: The Pipeline in Three Steps

    The package’s workflow has an elegant, almost architectural logic. You feed it a series of numbers; it returns a topological verdict. Between input and output, three transformations occur.

    Step 1: The Series Becomes a Graph

    The first move is borrowed from network science: the visibility graph. Imagine your time series plotted as a mountain range — each observation is a peak or a valley at a given time. Two points are connected by an edge if you could stand on one and see the other, with no taller peak blocking the line of sight.

    topologyR implements two flavours. The Horizontal Visibility Graph (HVG) connects two points if every point between them is strictly lower than the shorter of the two — a horizontal line of sight. It runs in linear time and captures the skeleton of the series’ ups and downs. The Natural Visibility Graph (NVG) is more generous: it connects two points if every intermediate point lies below the straight line joining them, regardless of the heights of the endpoints. It is denser, richer, and runs in O(n log n) expected time. The NVG always contains the HVG as a subgraph.

    Both are parameter-free. There is no threshold to tune, no bandwidth to select, no ε to agonise over. The graph is determined entirely by the data’s own geometry. This matters enormously: it eliminates the single largest source of arbitrariness in the entire pipeline.

    Step 2: The Graph Becomes a Topology

    Here is where topologyR departs from ordinary network analysis. A graph tells you who is adjacent to whom. A topology tells you something deeper: what the neighbourhood structure of the entire space looks like — which collections of points form coherent open regions, and how those regions combine.

    The construction follows a method introduced by Nada, El Atik, and Atef in 2018. For each vertex v in the graph, you form its closed neighbourhood — the vertex itself plus all its direct neighbours. This family of closed neighbourhoods serves as a subbase. You then close it under finite intersections to obtain a base, and close the base under arbitrary unions to obtain the full topology.

    If those words feel heavy, think of it this way: the subbase is a rough draft of “who belongs with whom.” Intersecting neighbourhoods refines the draft — “the points that both neighbourhoods agree on.” Taking unions completes the picture — “every region that can be assembled from these building blocks.” The result is a genuine topological space, complete with open sets satisfying the standard axioms, sitting on top of your time series like a scaffolding you didn’t know was there.

    Step 3: The Topology Reveals Its Connectivity

    Now comes the decisive question. A topological space is connected if it cannot be split into two non-empty open pieces — if there is no clean fracture running through it. For finite spaces, there is a beautiful theorem, due to McCord (1966) and Stong (1966), that makes this check exact and tractable. The specialization preorder orders the points by how their neighbourhoods nest inside one another, and the connected components of the resulting structure are precisely the topological connected components.

    The crucial practical point: this computation works directly on the base — the refined building blocks — without ever needing to enumerate the full topology (which can be exponentially large). It runs in polynomial time, and the components it returns are exact, not approximate.


    The Decision Rule

    Everything so far converges on a single, actionable verdict. topologyR hands you a connectedness decision, and that decision has a direct methodological consequence:

    • If the induced topology is connected, then your data are consistent with a single continuous process. Global continuous methods — splines, kriging, polynomial interpolation, moving-average imputation, kernel methods — are mathematically supported. You may proceed.
    • If the induced topology is disconnected, then no single continuous function can cover the entire series. Global continuous methods are invalid by construction. You must segment the series along the connected components the package identifies, and model each piece independently — with regime-switching models, component-wise imputation, or finite mixtures.

    This is the package’s value proposition: a reproducible, topology-first workflow that decides, before you touch a model, whether global continuity is a justified assumption or a silent error.

    Global versus Local

    A subtlety worth flagging: the rule depends on what you are trying to learn. Global properties — a secular trend, a Hurst exponent, total neural synchronisation, a centennial warming signal — depend on relationships among all points and require topological connectivity to be valid. Local properties — instantaneous volatility in a small window, point-to-point rates of change, low-order autocorrelation — are defined on restricted neighbourhoods and remain valid within each connected component, regardless of whether the whole series is one piece or several. The package gives you the component structure to make that distinction operational.


    Time Has an Arrow: Directed Topologies and Irreversibility

    So far, the construction has treated the visibility graph as undirected — time flows, but the edges don’t care which way. That discards information. Time series are inherently directional: time runs from past to future, and many real systems are irreversible — they behave differently forwards and backwards. Economic expansions creep upward over years; recessions collapse in quarters. Neurons fire and recover on different timescales. The undirected graph cannot see this asymmetry.

    topologyR’s directed mode fixes this. With directed = TRUE, each visibility edge is oriented from the earlier time point to the later one, producing a directed acyclic graph (a DAG) in which the time index is a natural topological order. From this directed graph, the package extracts two neighbourhood structures: the forward neighbourhood (who can I see ahead of me?) and the backward neighbourhood (who behind me can see me?).

    Applying the Nada construction to each yields two topologies: a forward topology τ⁺ and a backward topology τ⁻. The pair (X, τ⁺, τ⁻) forms what Kelly (1963) called a bitopological space — a set equipped with two topologies rather than one. The divergence between them is a direct, topological measurement of temporal irreversibility.

    Irreversibility Indices

    In a perfectly reversible process — symmetric dynamics, no privileged direction — the two topologies coincide: τ⁺ ≅ τ⁻. They have the same number of connected components, the same base size, the same connectivity. In an irreversible process, they pull apart.

    topologyR quantifies this with several indices. The component irreversibility measures the normalised difference in the number of connected components between the forward and backward topologies: zero means symmetric, one means maximally asymmetric. The base irreversibility does the same for the sizes of the topological bases. The asymmetry direction — the signed difference in component counts — tells you which way the arrow points: a positive value means the forward topology is more connected (fewer components) than the backward one.

    That last point has a concrete physical interpretation. Consider a time series with gradual expansions and abrupt contractions — the classic shape of a business cycle, where GDP creeps up over years and drops in a quarter. During a gradual rise, forward visibility is relatively unobstructed: looking ahead from a point on the upslope, you can see far. After an abrupt drop, backward visibility is blocked: looking back from the trough, the cliff face hides earlier points. This asymmetry means the forward topology should be more connected than the backward topology — fewer forward components, more backward fragmentation. The package predicts, and the data confirm, a positive asymmetry direction for such series.


    The Alexandrov Layer and the Resolution Hierarchy

    There is a third topology lurking in the directed graph, and it is older than the Nada construction by several decades. The Alexandrov topology τ_A, introduced by Alexandrov in 1937, is the topology whose open sets are the upsets of the reachability relation — the sets that, once you enter them, contain everything reachable downstream. For each vertex, its minimal open set is the collection of all vertices reachable from it via directed paths.

    topologyR computes this efficiently: a reverse-order bitset propagation that processes vertices from last to first, OR-ing reachability sets together in O(nm/64) time, reusing the same high-performance bitset infrastructure as the Nada engine.

    The relationship between the Alexandrov and Nada topologies is precise and informative: τ_A is always a subset of the forward Nada topology. The Alexandrov base captures pure order structure — “who can reach whom” — while the Nada intersection closure generates additional sets that are not upsets, catching finer-grained structure. The difference in base sizes, |B_Nada| − |B_A|, tells you exactly how much extra topological information the Nada pipeline extracts beyond the raw ordering. A large gap means the closure operations are doing real work; a small gap means the order structure already tells most of the story.


    Under the Hood: Performance Without Compromise

    Topological enumeration is, in the worst case, exponential — the number of open sets can in principle double with every additional element. This is an inherent mathematical fact, not a software limitation. But topologyR is engineered so that the decision you actually need — connectedness — never requires that enumeration.

    The connectivity computation works on the base alone, via the specialization preorder, in O(n² · ⌈B/64⌉) time. The C++ backend (via Rcpp) represents every subset as a packed array of 64-bit words, so set operations reduce to machine-level bitwise instructions. A compile-time template dispatch selects single-word operations for series up to 64 points, two-word for up to 128, three-word for up to 192 — zero loop overhead, branch-free. Beyond that, a runtime fallback handles arbitrary sample sizes, and OpenMP parallelisation is available where the build supports it.

    The practical upshot: you can run the connectivity decision on series with thousands of points without ever touching the exponential regime. Safety limits (max_base_sets, max_open_sets) cap the intersection and union closures with informative termination flags, so if a computation does hit resource limits, you know exactly where and why — and the connectivity result remains valid as long as the base closure completes.


    A Real-World Test: Reading the Business Cycle

    The paper accompanying the package applies the framework to quarterly U.S. real GDP growth from 1992 to 2024 — 129 observations spanning over three decades. The bitopological analysis recovers a positive asymmetry direction: the forward topology is more connected than the backward one, exactly as predicted for a series with gradual expansions and abrupt contractions.

    The undirected topology partitions the series into six connected components, each corresponding to a distinct macroeconomic regime. Strikingly, the COVID-19 contraction and its rebound — the deepest and fastest swing in the sample — are classified as a single topological episode: one connected component spanning the collapse and recovery, reflecting the fact that the visibility structure treats the V-shaped episode as one structural unit rather than two separate events.

    This is the kind of insight the package is designed to produce: not a forecast, not a parameter estimate, but a structural classification that tells you where the legitimate boundaries in your data lie — and, critically, whether a global model is appropriate at all.


    Where It Sits: Complementary, Not Competing

    It is important to be clear about what topologyR is not. It is not a general-purpose topological data analysis (TDA) engine. Packages like GUDHI, Ripser, TDAstats, and scikit-TDA compute persistent homology — multi-scale features across all dimensions, capturing higher-order structures (loops, voids) via Betti numbers β₁, β₂ and their persistence across scales. That is a richer and harder enterprise.

    topologyR has a narrower and more focused aim: it zeroes in on β₀ — connectedness — for one-dimensional series, using graph-induced topologies, and it turns that single invariant into an actionable decision rule for method selection. Think of it as a pre-model governance tool: a rigorous gatekeeper that runs before you choose your modelling strategy, telling you whether the continuity assumptions your favourite methods require are actually justified by the data’s structure.

    The two approaches are complementary. For early-warning detection, precursor signals, or multi-channel structure, persistent homology is the right tool. For the binary question “can I legitimately fit a global continuous model to this series?”, topologyR gives a direct, interpretable, and mathematically exact answer. A natural hybrid workflow uses topologyR as a pre-test and persistent homology for deeper multi-scale analysis.


    Honest Limitations

    No tool is universal, and topologyR is transparent about its boundaries:

    1. Graph choice matters. HVG and NVG produce different graphs, and therefore potentially different topologies. The NVG, being denser, tends to produce fewer connected components. The package encourages comparing both and interpreting the difference — the gap itself is diagnostic.
    2. Sampling and noise. Sparse sampling can mimic disconnection; minor overlaps can mimic connection. The connectedness verdict should be treated as prima facie evidence, not absolute truth — especially near the boundary.
    3. β₀ only. The approach focuses on connectedness. It will not capture loops, voids, or higher-order patterns that persistent homology can detect. If your question is about cycles or multi-scale structure rather than fragmentation, you need the heavier machinery.
    4. Enumeration is exponential; connectivity is not. This is handled honestly: the connectivity decision is polynomial and scalable; full topology enumeration (needed for pairwise connectedness in the bitopological sense) is capped by safety limits with transparent reporting.

    The Bigger Picture

    What makes topologyR more than a clever technical exercise is its epistemological stance. It transforms a step that is normally a tacit habit — assuming continuity — into an explicit, testable, mathematical procedure. In doing so, it removes arbitrariness from one of the most consequential decisions in applied quantitative work: the choice between global and segmented methods.

    The package’s central theorem — that the Nada construction extends to directed graphs and yields a bitopological space whose asymmetry quantifies irreversibility — is formalised in Lean 4 against Mathlib, so the mathematical foundation is not merely asserted but machine-checked. The implementation is CRAN-compliant, passes R CMD check --as-cran cleanly, and ships with 68 unit tests covering visibility graphs, topology generation, connectivity, directed topology, Alexandrov topology, and bitopological analysis.

    For anyone who works with time series and has ever fitted a spline, run a kriging model, or estimated a trend — which is to say, for most of applied quantitative science — topologyR offers something rare: a way to check, before you model, whether the smoothness you are about to assume is a property of your data or a story you are telling yourself.


    Links and Credits

    The package is authored by José Mauricio Gómez Julián and released under the MIT licence. It requires R ≥ 4.0.0 with Rcpp and ggplot2. The companion paper, “Bitopological Spaces from Directed Graphs: Extending the Nada Construction to Capture Temporal Irreversibility,” develops the full mathematical theory, including the central theorem, the Alexandrov sublayer, specialization preorder, pairwise connectedness, polynomial-time algorithms, and the Lean 4 formalisation.

    If you use topologyR in your research, please cite the repository release.

  • Quantitative Theory of Money or Prices? A Historical, Theoretical, and Econometric Analysis

    Quantitative Theory of Money or Prices? A Historical, Theoretical, and Econometric Analysis

    Does Money Drive Prices, or Do Prices Drive Money?
    Econometrics · Monetary Theory · Machine Learning · Political Economy

    Does Money Drive Prices, or Do Prices Drive Money?

    A 300-year-old debate, four countries, six decades of data, Bayesian statistics, and neural networks — a deep dive into one of the most ambitious monetary studies in recent years

    What you will find in this post
    1. The oldest argument in monetary economics — Hume, Friedman, and why it still matters today
    2. Marx’s forgotten critique — four logical objections that mainstream economics never answered
    3. The role of gold in a post-gold-standard world — why the Fed still dances around the price of gold
    4. A mathematical model for the money-prices relationship — equations explained without the jargon
    5. The data and the methodology — four countries, Bayesian models, neural networks, and random forests
    6. Country-by-country results — what the United States, Canada, the UK, and Brazil each reveal
    7. Why money is never neutral — and what that means for how we think about the economy
    8. Policy implications and open questions — what this means for central banks and for you
    · · ·

    1. The Oldest Argument in Monetary Economics

    There is a question at the heart of economics that sounds deceptively simple: when governments print more money, do prices go up because there is more money chasing the same goods — or does the economy first produce goods at certain prices, and then the amount of money in circulation simply adjusts to match? Put differently: does money cause prices, or do prices cause money?

    This is not an abstract riddle for seminar rooms. The answer determines how central banks set interest rates, whether governments choose austerity or stimulus in a recession, and how we understand inflation. If the quantity of money determines prices, then controlling the money supply is the key to controlling the economy. If prices determine the quantity of money, then the real action is in production, technology, and competition — and monetary policy is, at best, a secondary lever.

    The debate begins with the Scottish philosopher David Hume, writing in the mid-eighteenth century. In his essays on money and trade, Hume proposed what became the foundation of mainstream monetary thought: if you double the quantity of money in an economy while keeping everything else constant, prices will eventually double. Money, in this view, is a veil — it changes the numbers on price tags but does not alter the real productive capacity of the economy. The ratio of money to goods simply adjusts until equilibrium is restored.

    This idea was not without immediate critics. The Scottish economist James Steuart attacked it almost as soon as it appeared (1767). Adam Smith, often considered the father of modern economics, held the opposite view — that prices, not money, are the active variable. But the idea proved remarkably resilient. Over the following two centuries, it was refined into what economists call the Quantity Theory of Money, which reached its most influential modern form in the work of Milton Friedman. For Friedman, Hume was the starting point of all monetary theory. For Robert Lucas, another Nobel laureate, Hume marked the beginning of modern monetary economics.

    But there was always an alternative tradition, running from the classical economists through Karl Marx, that saw the relationship in exactly the opposite direction. A new paper by the Costa Rican economist José Mauricio Gómez Julián, published on arXiv in January 2025, takes this alternative tradition seriously, subjects it to rigorous empirical testing with the most modern tools available — Bayesian statistics, machine learning, deep learning, and ensemble methods — and arrives at conclusions that challenge the mainstream consensus.

    · · ·

    2. Marx’s Forgotten Critique

    When most people hear “Marx” and “money” in the same sentence, they expect ideology. But in his Contribution to the Critique of Political Economy (1859), Marx offered something far more valuable: a meticulous logical dissection of Hume’s reasoning. Gómez Julián’s paper draws on four central aspects of this critique, each of which makes testable claims about the real world.

    First: Money is subordinated to exchange values, not the other way around

    Marx’s fundamental point is that the sphere of circulation (where money changes hands) is ultimately subordinated to the sphere of production (where goods are actually made). This is not just a philosophical claim — it has a concrete implication. The quantity of money in circulation must maintain a certain equilibrium with the quantity of goods and services available for sale. If there is too little money, commercial transactions become difficult — there are not enough means of payment to go around. If there is too much money, sellers can raise prices to absorb the excess.

    But here is the crucial mechanism: if the quantity of money falls below or rises above its “necessary level,” a coercive correction occurs through commodity prices. Prices adjust, and money supply follows — not the other way around. The direction of causation runs from prices to money, mediated by the real commodity foundation of money (in Hume’s and Marx’s time, gold and silver).

    This means that money’s non-neutrality — the fact that changes in the money supply do affect real economic outcomes — is not caused by money determining prices. It is caused by the mediating relationship between prices and the material foundation of money, which creates a feedback loop over time.

    Second: An epistemological critique of Hume’s evidence

    Marx points out that when Hume formulated his theory, he was observing a very specific historical situation: the discovery of American mines and the increase in slave labor, which lowered the extraction cost of gold and silver. Under these conditions, the price of commodities exchanged directly for gold and silver (i.e., exported commodities) did indeed rise. But this rise occurred because gold and silver were functioning as commodities — their production cost had dropped — not because more money was chasing the same goods. The effect on gold as a means of payment (i.e., domestic money) took much longer to materialize. Hume, in Marx’s reading, confused a change in the relative value of a commodity (gold) with a general monetary phenomenon.

    Third: Accounting money vs. means of circulation

    Marx argues that Hume made a fundamental category error: he confused accounting money (the unit in which prices are denominated) with money as a means of circulation (the physical medium of exchange). These are different things with different behaviors. Moreover, Hume failed to consider historical events of his own time that demonstrated the need to account for the exchange value of gold and silver when linking money to prices.

    Fourth: Two critical corollaries

    This is where the theory makes its sharpest predictions. Marx draws two conclusions from his analysis that can be tested empirically:

    Marx’s two testable corollaries
    • Corollary 1: If metallic currency is a symbol of value, then the sum of commodity prices determines the quantity of circulating money. But if the monetary unit is a symbol of value, then the quantity of circulating money is determined by the sum of commodity prices. Marx argues it is the monetary unit — not the metallic currency — that is the symbol of value.
    • Corollary 2: If money derives its value from prices (Marx’s position), then there can be more money in circulation than the sum of commodity prices. But if money determines prices (Hume’s position), then there cannot be more money circulating than the sum of prices. Marx argues that the former is true — and it can be checked against data.

    Gómez Julián checks Corollary 2 directly. “Circulating money” is defined as the monetary aggregate M1 (cash plus checking deposits), and the “sum of commodity prices” is, by definition, nominal GDP. Looking at the statistical systems of the United States, the United Kingdom, Canada, and Brazil, the paper finds that M1 exceeds nominal GDP in multiple years for each country. This is straightforward evidence in favor of Marx’s position. The author also notes that previous work on El Salvador showed M1 consistently below nominal GDP — which might seem to contradict the pattern until one considers El Salvador’s dollarization, which fundamentally changes the monetary dynamics.

    “Marx’s central thesis is that the value of money depends on the purchasing power of the commodity or commodities that underlie it, and this purchasing power, in turn, depends on the general level of prices. Such prices, the market prices, are determined by capitalist competition.” — Gómez Julián, summarizing Marx’s framework

    The value theory question

    One cannot discuss Marx’s monetary theory without addressing the foundation beneath it: the labor theory of value (LTV). Marx argues that market prices oscillate around “prices of production,” which are themselves grounded in the socially necessary labor time required to produce goods. If the LTV is correct, then exchange values have an objective basis in production — and the subordination of money to prices follows naturally.

    The paper acknowledges that these monetary claims stand or fall with the validity of the LTV, but it also notes that the neoclassical alternative — the subjective theory of value based on marginal utility — has its own deep problems. The famous Cambridge Capital Controversy of the 1960s demonstrated that the neoclassical foundations (the so-called “neoclassical parables”) do not provide a coherent scientific explanation of economic phenomena. Even Paul Samuelson, one of the greatest neoclassical economists, admitted that capital aggregation problems can only be resolved by adopting something very close to the labor theory of value. Joan Robinson went further, arguing that capital can be nothing more than “accumulated past labor.” Notably, the Penn World Tables — one of the most important databases in empirical economics — do not use marginal productivity of capital to measure capital remuneration, but instead use the real average internal rate of return, precisely because of the aggregation problem.

    · · ·

    3. The Role of Gold in a Post-Gold-Standard World

    If money is ultimately subordinated to prices, and prices are anchored in the real economy, what gives money its value in the modern era? Since the collapse of the Bretton Woods system in 1971, when President Nixon ended the dollar’s convertibility to gold, most economists have treated modern money as purely “fiduciary” — backed by nothing but government decree and public trust. Gómez Julián argues, with substantial evidence, that this is not the full picture.

    The paper presents three pillars of evidence for gold’s continuing monetary role:

    Gold’s enduring monetary significance
    • Greenspan’s own words: “Gold still represents the ultimate form of payment in the world. Fiat money in extremis is accepted by nobody. Gold is always accepted.” This is not a gold bug’s fantasy — it was stated by the man who chaired the Federal Reserve for nearly two decades.
    • The inverse relationship: Gold and the US dollar consistently move in opposite directions. When gold rises, the dollar tends to fall, and vice versa. This has been documented by multiple financial analysts and is visible in decades of market data.
    • Policy history: After the turbulence of the 1970s (high inflation, debt crises, savings crises), Paul Volcker — who took over as Fed chair in 1979 — formally abandoned the monetarist experiment in 1982 and adopted policies aimed at stabilizing the dollar’s value against gold and other commodities. This was supported by the Plaza Accord (1985) and the Louvre Accord (1987). The result was the “Great Moderation” (1982–2007), a period of unusual macroeconomic stability.

    The paper traces a revealing pattern through subsequent Fed chairs. Greenspan continued Volcker’s gold-aware approach. When Ben Bernanke — an economist who openly declared Friedman as his central intellectual influence — took over in 2006, policies diverged from the gold anchor, and gold price volatility surged to its highest level since the end of Bretton Woods. The dollar declined. Janet Yellen, who succeeded Bernanke in 2014, returned to the Volcker-Greenspan orientation, and gold prices stabilized. Jerome Powell initially followed this path but gradually moved away, declaring in 2019 that tying the dollar to gold would prevent the Fed from maximizing employment.

    Gómez Julián pushes back on Powell’s argument on two grounds. First, periods when the Fed stabilized the dollar around gold showed at least the same level of employment stability as periods when it did not. Second, since Bretton Woods, no country has used the gold standard directly — they have anchored their currencies to the dollar, and the dollar has been anchored (in varying degrees) to gold. So Powell’s claim that “no country uses it” misses the layered structure of the international monetary system.

    The dialectical contradiction of gold

    The paper draws on the Marxist economist Ernest Mandel to explain why the United States both needs and resists the gold standard. The gold standard provides stability — but it also requires contractionary policies during recessions, which can deepen crises and, as the case of Heinrich Brüning’s Germany (1930–1932) showed, can undermine democracy by creating the conditions for fascism. The gold standard also requires a delicate balance between short-term dollar demand (from foreign investors parking reserves) and long-term dollar outflow (from American investments abroad). When this balance tips — as it did in the late 1960s — the result is a monetary crisis.

    “The ‘dollar crisis’ and the search for means of international payment independent both of gold and ‘currency reserves’ reflect clear recognition on the part of big international capital of a contradiction inherent in the present-day capitalist system: the contradiction between the dollar’s role as an ‘international money,’ and its role as an instrument to assure the expansion of the American capitalist economy. To fulfill the first function, a stable money is needed. To fulfill the second function, a flexible money is necessary, i.e., an unstable one. There’s the rub.” — Ernest Mandel, 1968, quoted in the paper

    This dialectical tension — the system needs gold stability but also needs monetary flexibility — explains the recurring oscillation between gold-anchored and gold-detached monetary regimes. The paper describes the current arrangement as a “loose gold standard”: not a formal peg, but a persistent gravitational pull.

    · · ·

    4. A Mathematical Model for the Money-Prices-Gold Relationship

    Gómez Julián formalizes the above arguments into a mathematical model. The basic version is elegant in its simplicity:

    Core equation Qm = λp / λgold · β

    In plain language: the quantity of money in circulation (Qm, measured as M1) is equal to the sum of commodity prices (λp, measured as nominal GDP) divided by the international price of gold (λgold), multiplied by a coefficient (β) that represents the velocity of money circulation (assumed, for simplicity, to equal one).

    This equation encodes several intuitive relationships:

    What the equation says — in words
    • If prices (nominal GDP) rise while gold stays the same, the money supply must increase — more money is needed to express the same goods at higher prices.
    • If the gold price rises while prices stay the same, the money supply decreases — fewer monetary units are needed to express the same sum of prices, because gold is now more valuable per unit.
    • If both prices and gold rise, the effect on money depends on which change is larger — it could go either way.
    • If prices rise and gold falls, money unambiguously increases — both forces push in the same direction.

    The paper works through all eight possible combinations of price and gold movements (both up, both down, one up one down, one fixed one moving, etc.), showing that the model’s predictions are internally consistent. This is not just algebra — it is a stress test of the theory’s logical coherence.

    The model can also be expressed in logarithmic form, which has a practical advantage: when you run a regression on logarithmically transformed variables, the coefficients can be interpreted directly as elasticities — percentage changes. For example, a coefficient of 0.13 means that a 1% increase in prices is associated with a 0.13% increase in the money supply, holding gold constant. This logarithmic transformation also tends to smooth out extreme values in the data, improving statistical performance.

    A more general version of the model simply states that the money supply is a function of both prices and gold, without specifying the exact functional form — leaving the data to reveal the shape of the relationship.

    · · ·

    5. The Data and the Methodology

    Four countries, carefully chosen

    The empirical analysis covers quarterly data from four countries, each chosen for a specific reason:

    Country selection and rationale
    • United States (1959–2022): The most developed Western capitalist economy. Economic laws derived from its study are, to varying degrees, applicable to other capitalist countries. It represents the highest stage of development reached by Western capitalism and serves as a mirror of the future for other economies. 63 years of data — longer than a Kondratieff wave (the long cycles of capitalist dynamics, typically 40–60 years).
    • Canada (1961–2022): Chosen for similar reasons to the UK, but representing the welfare state variant of Western capitalism — a different model from both the US and the UK. 61 years of data.
    • United Kingdom (1986–2022): A major developed capitalist economy with more available data than other candidates like Germany or France. 36 years of data.
    • Brazil (1996–2022): An emerging economy (developing country), chosen to test whether the findings generalize beyond advanced capitalism. Since the study had already been done for El Salvador (an underdeveloped country), verifying the results for Brazil would suggest the patterns are general economic laws of capitalist development. 26 years of data.

    A multi-layered methodological approach

    This is not a paper that runs one regression and calls it a day. The methodology unfolds in several stages, each building on the previous one:

    Stage 1: Pairwise direction analysis. The first question is: for each pair of variables (money-prices, gold-prices, money-gold), which variable best predicts which? This is done using Bayesian simple linear regression, where the direction of the relationship is determined by comparing the Expected Log Pointwise Predictive Density from Leave-One-Out cross-validation (ELPD-LOO) — a rigorous measure of how well a model predicts data it has not seen. Higher (less negative) ELPD-LOO means better predictive performance.

    Stage 2: RESET tests for nonlinearity. Linear models assume straight-line relationships. But what if the real relationship is curved? The paper runs Ramsey’s RESET test with quadratic, cubic, and combined terms, bootstrapped using a Bayesian posterior distribution. This reveals whether linear models are missing important nonlinear patterns — and, if so, what kind of curvature is present.

    Stage 3: Empirical distribution fitting. Before building multivariate models, the paper determines the best-fitting probability distribution for each variable (log-normal, Weibull, Gamma, Normal, etc.) using the maximum goodness-of-fit method, with results selected by the Bayesian Information Criterion (BIC). This is not just a technical exercise — it directly informs how the variables are transformed in later models.

    Stage 4: Bayesian Generalized Linear Models (BGLM). The paper constructs multivariate models using different statistical families (Gamma, Gaussian) and link functions (logarithmic, identity), with gold often transformed into a natural cubic spline (a flexible curve that can capture nonlinear patterns) or fitted as a Weibull random variable. The choice of family, link, and transformation is driven by predictive performance metrics.

    Stage 5: Machine learning and deep learning. Four different ML models are tested individually and in combination:

    Machine learning models used
    • Quantile Random Forest (QRF): An extension of random forests that estimates the entire distribution of the predicted variable, not just its average.
    • Conditional Inference Random Forest: A variant that uses statistical tests to select splitting variables, reducing bias toward variables with many possible splits.
    • Bayesian Regularized Neural Network (BRNN): A neural network that uses Bayesian regularization to prevent overfitting — the model learns to be cautious about its own complexity.
    • Support Vector Machine with Radial Basis Kernel (SVMRadial): A powerful classification/regression method that maps data into higher-dimensional spaces to find optimal decision boundaries.

    Stage 6: Ensemble learning. Finally, the paper tests whether combining multiple models through boosting (a technique where each new model focuses on the errors of the previous ones) produces better predictions than any individual model. The ensemble is structured as a Bayesian Generalized Linear Model with Gaussian family and identity link.

    A critical philosophical point: the paper uses objective Bayesian analysis. This means that all prior information — the starting assumptions the model uses before seeing the data — is derived from empirical analysis of the dataset itself, not from subjective beliefs or assumptions. This approach incorporates what the author calls “epistemological doubt” about parameter estimation, acknowledging that we can never be perfectly certain about any estimated value.

    · · ·

    6. Country-by-Country Results

    United States (1959–2022)

    The pairwise analysis reveals something striking: the simple relationship between M1 and prices is undecidable — both directions fit about equally well by ELPD-LOO. This is already a blow to the simplistic Quantity Theory, which claims a clear causal arrow from money to prices. However, gold is clearly best predicted by prices (not the reverse), and M1 is clearly best predicted by gold (not the reverse). This suggests a chain: prices → gold → money, consistent with Marx’s framework.

    The RESET tests confirm that the relationships are nonlinear. For the M1-prices pair in both directions, all RESET tests yield p-values of zero — meaning the linear models are definitively inadequate. Nonlinearity is everywhere.

    The multivariate model that best fits the data is a BGLM with Gamma family, logarithmic link, and gold transformed into a natural cubic spline with five degrees of freedom. The coefficient on log(prices) is +0.13 — confirming the direct, positive relationship between prices and money supply. The spline coefficients for gold alternate in sign across the five basis functions, confirming the theoretically predicted nonlinear, segment-dependent relationship. The model achieves an MAE of just 0.12 (2.43% of the log(M1) minimum) and an RMSE of 0.21.

    The ensemble model — combining a Bayesian Regularized Neural Network (weight: 0.41) and a Quantile Random Forest (weight: 0.59) — further improves performance: MAE drops to 0.08 on test data, RMSE to 0.25, and the R² reaches 0.985 in training. All coefficients are highly significant (p < 2e-16). The US is the only country where the ensemble outperforms the best individual ML model.

    Canada (1961–2022)

    The pairwise results are cleaner than in the US case: M1 is best predicted by prices, gold is best predicted by prices, and M1 is best predicted by gold. The chain prices → gold → money is clearly visible. RESET tests again confirm pervasive nonlinearity.

    The best multivariate model uses a BGLM with Gamma family, logarithmic link, and gold transformed as a Weibull random variable (shape = 5.88, scale = 6.47). The coefficient on log(prices) is +0.045 — smaller than in the US but still positive and confirming the prices-to-money direction. The Weibull transformation captures the nonlinear gold dynamics in a single parametric term. The model achieves an MAE of 0.23 and RMSE of 0.28.

    Unlike the US, the ensemble did not improve on the best individual ML model. A Quantile Random Forest performed best on its own, achieving a remarkable R² of 0.998 in training and an MAE of just 0.04 on test data. The near-perfect fit suggests that the money-prices-gold relationship in Canada is highly regular and predictable over this period.

    United Kingdom (1986–2022)

    With a shorter sample (36 years), the UK shows a more mixed pattern in pairwise analysis. Notably, the simple relationship between M1 and prices runs in the reverse direction — prices are best predicted by M1, not the other way around. This might seem to support the Quantity Theory, but it only holds in the simple bivariate case. When gold is included in the multivariate model, the direct relationship between prices and money reasserts itself.

    The best multivariate model is a BGLM with Gamma family, logarithmic link, and gold transformed as a natural cubic spline with five degrees of freedom — similar to the US specification. The coefficient on log(prices) is +0.071, and the spline coefficients alternate in sign, as predicted by theory. The model achieves an MAE of 0.06 and RMSE of 0.07 — the tightest fit among the four countries.

    As with Canada, the ensemble did not improve on the best individual model. A Quantile Random Forest again performed best, with R² of 0.993 in training and near-zero RMSE on test data.

    Brazil (1996–2022)

    Brazil, as an emerging economy with a turbulent monetary history, presents the most complex picture. In pairwise analysis, the money-prices relationship again runs in the reverse direction (prices predicted by M1), and the gold-prices relationship is bidirectional. RESET tests show the strongest nonlinearity signals of any country, with many p-values at or near zero.

    The best multivariate model uses a BGLM with Gaussian family (the only country where Gaussian outperformed Gamma), logarithmic link, and gold transformed as a natural cubic spline. The coefficient on log(prices) is +0.05, again confirming the direct relationship. Model performance is solid: MAE of 0.07, RMSE of 0.21.

    Among ML models, a Support Vector Machine with Radial Basis Kernel performed best, achieving R² of 0.991 in training and an MAE of 0.012 on test data. As with Canada and the UK, the ensemble did not improve on this individual model.

    Summary: In all four countries, the multivariate models confirm a positive relationship between prices and money supply, and a nonlinear, segment-dependent relationship between gold and money supply — exactly as the theoretical model predicts.
    · · ·

    7. Why Money Is Never Neutral

    The paper’s central conclusion, stated plainly: money is not neutral at any time horizon — not in the short run, not in the long run, across all four countries studied.

    This is a strong claim, and it contradicts one of the most fundamental assumptions of mainstream economics. The concept of “monetary neutrality” holds that changes in the money supply eventually affect only nominal variables (prices, wages) and leave real variables (output, employment) unchanged. In the long run, the argument goes, the economy returns to its “natural” state regardless of what the central bank does with the money supply.

    Gómez Julián’s results, based on data spanning up to 63 years — longer than a full Kondratieff cycle — provide no support for this proposition. But the paper is careful to explain why money is non-neutral, and the explanation differs from what both mainstream and some heterodox economists might expect.

    Non-neutrality, in this framework, is not caused by the money supply determining prices (the monetarist claim). It is caused by the mediating relationship between prices and the real commodity foundation of money (gold), which determines the money supply. This creates a feedback loop: prices influence gold, gold influences money, and money — through aggregate demand — feeds back into prices. The exchange value of money as a monetary unit is the transmission mechanism.

    Because this feedback is nonlinear (as confirmed by the RESET tests and the spline models across all four countries), and because it operates over time with dynamic lags, the money-prices-gold system constitutes what complexity scientists would call a complex system — a system where small changes can have disproportionate effects, where cause and effect are intertwined, and where linear prediction is fundamentally limited.

    · · ·

    8. Policy Implications and Open Questions

    What this means for policy

    The findings have practical consequences for how we think about monetary policy:

    Policy takeaways
    • The best way to control prices is directly — through industrial policy, competition policy, supply-side interventions, and measures that address the real determinants of production costs. Since prices are ultimately grounded in the sphere of production, intervening there is the most effective approach.
    • But controlling the money supply also works — because the feedback relationship runs in both directions. Contracting M1 can reduce prices, even though the primary direction of causation runs from prices to money. This “theoretically justifies a commonly effective practice in economic policy,” as the author puts it.
    • Friedman’s narrative about the Great Depression is weakened. The Federal Reserve expanded the monetary base during the Depression, yet the Depression happened anyway. During the 2008 crisis, the Fed adopted an aggressive expansionary monetary policy — and it alone was not enough. It had to be accompanied by massive fiscal intervention (the 2009 American Recovery and Reinvestment Act), direct asset purchases, near-zero interest rates, and other measures. As Krugman noted, “The Monetary History thesis has just taken a hit.”
    • The gold standard is not incompatible with employment stability. This challenges the argument, made by Jerome Powell and others, that returning to a gold anchor would sacrifice the Fed’s ability to maximize employment. The historical record shows at least equivalent macroeconomic stability during gold-anchored periods.

    Two open questions for future research

    The paper is transparent about what it does not answer:

    Question 1: In the current loose gold standard, how exactly does the feedback between prices, gold, and the money supply work through specific economic policy instruments? The Fed’s tools — interest rates, quantitative easing, reserve requirements — act as latent variables mediating the gold-money relationship. The paper establishes that this mediation exists but acknowledges that its precise mechanisms require further study.

    Question 2: What are the quantitative and temporal limits of monetary non-neutrality? If too much money enters circulation, commodity prices eventually correct the imbalance through a “coercive correction.” But how large can the distortions become before correction occurs, and how long does the adjustment take? Understanding these limits could illuminate phenomena traditionally attributed to monetary factors — such as the “liquidity trap” — from an entirely new angle.

    A methodological statement

    Beyond its economic findings, the paper is also an argument about method. By combining objective Bayesian statistics with modern machine learning — neural networks, random forests, support vector machines, and boosted ensembles — Gómez Julián demonstrates that the tools of artificial intelligence can serve heterodox economic theory, not just mainstream modeling. Using Bayesian regularized neural networks and gradient-boosted ensembles to test predictions derived from Marx’s nineteenth-century monetary theory is, to put it mildly, unusual. But the results are robust, the fit is strong, and the patterns are consistent across four countries with very different economic structures.

    The paper’s approach to the so-called “transformation problem” — the long-standing debate about how labor values map onto market prices — also deserves attention. By assuming inventory valuation at the cost of reproduction (where the current technological state determines the value of inputs), Gómez Julián shows that the system of equations has a unique solution given the degree of exploitation of labor power, sidestepping a controversy that has occupied Marxist economists for over a century.

    · · ·

    The Takeaway

    Three hundred years after David Hume proposed that money determines prices, and one hundred and sixty-five years after Karl Marx argued the opposite, we still do not have a settled answer. Gómez Julián’s paper does not claim to settle it — but it does something arguably more valuable. It shows, with rigorous data and modern methods across four countries and six decades, that the question itself may be wrongly framed as a binary choice.

    Money and prices, along with gold, form a complex, nonlinear, feedback-driven system in which both directions of causation operate simultaneously. But the relationship is asymmetric: prices hold the upper hand. Money is ultimately subordinated to the real economy — to production, to labor, to the commodities that give currency its value — even as it feeds back into prices through aggregate demand. Money is never neutral, but it is never the master either. It is, in the deepest sense, a dependent variable that nonetheless shapes the system it depends on.

    In an era of quantitative easing debates, cryptocurrency experiments, inflation anxiety, and questions about the very nature of money, this is not just an academic finding. It is a framework for thinking about the monetary world we actually inhabit — one that is messier, more dynamic, and more deeply rooted in material reality than either Hume or Friedman imagined.