← Back to Analytics
Statistical Engine

Algorithmic Rationale

Vyay uses standard statistical algorithms to identify unusual spending patterns, recurring commitments, and frequency spikes directly from your ledger data.

01. Statistical Outliers

Finding outliers is not just listing your largest payments. True outlier detection flags expenses that are abnormally high for that specific merchant or category, while filtering out expected overhead like rent.

MAD

The Math: Median & MAD vs. Mean & StdDev

⚠️ Standard Deviation (Fragile)

Traditional averages (Mean) and Standard Deviations are heavily skewed by extreme spikes. If you buy a ₹15,000 laptop once, your "average" coffee transaction baseline is dragged upward, making smaller spikes (like a ₹1,200 dinner) impossible to detect.

Regular Coffee ₹100
Laptop Purchase ₹15,000
Mean Baseline dragged to ₹3,080
✅ Median Absolute Deviation (Robust)

Vyay uses Median and **MAD** (Median Absolute Deviation). Because the median is the absolute middle value, it is unaffected by extreme outliers. The baseline stays true to your typical behavior, ensuring mid-size spikes are highlighted.

Median Base ₹100
Typical Variance (MAD) ₹15
Surprise Limit (Median + 3*MAD) ₹145

The Z-MAD Formula

Surprise Score = (Transaction Amount - Median) / MAD

If the Surprise Score exceeds 3, the transaction is marked as an anomaly. To avoid mathematical divide-by-zero errors when you pay the exact same amount repeatedly, MAD is floored at a minimum of 5% of the median or 1.

Outlier Pipeline Flowchart

STEP 01 Exclusion

Rent, subscriptions, salaries, transfers, and refunds are filtered out to isolate pure discretionary transactions.

STEP 02 Baseline Routing

If merchant history ≥ 3, we use merchant-specific stats. Otherwise, we route to a global discretionary baseline.

STEP 03 Scoring

The Surprise Score is computed. If score > 3.0, it is qualified as a potential outlier.

STEP 04 Floor & Limit

Transactions under ₹300 are dropped to filter noise. Outliers are then sorted by score and capped.

✅ Flagged

02. Recurring & Subscriptions

Our predictive Fixed Expenses engine evaluates which payments recur monthly, quarterly, or on standard intervals to calculate your monthly overhead and commitments.

RECUR

The Rules of Subscription Matching

01

Phonetic Slugs

Descriptions are normalized to strip out payment numbers, transaction codes, and casing. Netflix.com, NETFLIX, and Netflix App Store all group under the same slug: netflix.

02

Frequency Ratio

We look at how many active calendar months the merchant has appeared in vs the total months in your data. It must occur in at least 2 distinct months to be considered.

03

Amount Volatility

We compute the Coefficient of Variation ($Standard Deviation / Mean$). If the volatility is less than 15%, it matches the strict subscription criteria.

Confidence Scoring Formula Confidence = Max(0, Frequency - Variance * 0.5)

Variance acts as a penalty. A utility bill that fluctuates wildly will have higher variance, resulting in lower confidence, whereas a flat subscription (like Spotify) retains high confidence.

03. Frequency Spikes

A separate detector identifies behavioral frequency shifts. This catches items where no single transaction is large, but you are buying them much more often than your historic baseline.

By comparing the total number of transactions for a merchant slug in the **last 30 days** against their rolling **90-day monthly average**, Vyay flags habits that are scaling up.

For example, ordering food delivery 10 times in the last month when your 90-day average is 3 times a month indicates a **3.3x frequency shift**—even if each meal is relatively inexpensive.

Spike Criteria

  • At least 2 transactions in last 30 days.
  • Active 90-day monthly baseline average > 0.
  • 30-day count > 2x rolling 90-day monthly average.