Softanza
StartFrançais
Softanza
Research · narration

stzDataSet: Statistics as a Language of Thought

The stzDataSet class from Softanza's STATS module embeds this cognitive model directly into Haro code, transforming raw numbers into meaningful narratives. This same four-pillar framework extends across all of Softanza's data analytics modules—from statistics to visualization—creating a universal language for understanding data.

by Mansour Ayouni · in the repository since 2026-01-04 · tutorial · area Tables & data

In Softanza, statistics isn't just formulas—it's a way of thinking about data. When a statistician examines data, he doesn't see numbers; he sees questions waiting for answers. His intent shapes which analytical lens he reaches for:

  • Comparison: How do values compare against each other?
  • Composition: What elements make up this whole, and in what proportions?
  • Distribution: How are values spread, shaped, and distorted across their range?
  • Relation: How do variables connect to one another?

Prologue — Data Arrives, Questions Begin

A data analyst opens a file. No theory, no assumptions — just values.

Haro
oSales = new stzDataSet([120, 150, 89, 200, 175, 95, 180])

illustration

From the first line, the dataset already knows it is numeric and usable. The analyst’s first reflex is not "Which formula?" but "What can this data tell me about itself?"

Step 1 — Finding a Typical Value (Mean & Median)

The analyst asks: What value best represents this dataset?

Haro
? oSales.Mean()
#--> 144.14

illustration

The mean is the arithmetic average: add all values and divide by how many there are.

Now a second question: What is the middle value if I sort the data?

Haro
? oSales.Median()
#--> 150

illustration

The median is the central value. When mean and median are close, the data is usually balanced. When they differ, extreme values may be pulling the mean.

Already, the analyst learns something concrete: sales tend to cluster around ~145–150.

Step 2 — Measuring How Spread the Data Is (Standard Deviation)

Next question: Are values tightly grouped or widely spread?

Haro
? oSales.StandardDeviation()
#--> 38.62

illustration

Standard deviation measures how far values typically are from the mean. Here, sales usually differ by about 39 units from the average.

To make this easier to interpret, Softanza also offers a relative measure:

Haro
? oSales.CoefficientOfVariation()
#--> 26.79

illustration

This means variation is about 27% of the average, which is moderate for business data.

Step 3 — Looking at the Data in Chunks (Quartiles & IQR)

The analyst now asks: How is the data distributed from low to high?

Haro
? @@(oSales.Quartiles())
#--> [92, 150, 187.5]

illustration

These are quartiles:

  • Q1 (92): 25% of values are below this
  • Q2 (150): the median
  • Q3 (187.5): 75% of values are below this

The analyst then checks how wide the middle of the data is:

Haro
? oSales.IQR()
#--> 95.5

illustration

The Interquartile Range (IQR) is Q3 − Q1. It represents the spread of the middle 50% of the data — a robust measure that ignores extremes.

Step 4 — Checking Symmetry (Skewness)

Now a practical question: Is the data pulled more to one side?

Haro
? oSales.Skewness()
#--> 0.21

illustration

Skewness measures asymmetry:

  • Near 0 → roughly symmetric
  • Positive → longer tail on the right
  • Negative → longer tail on the left

Here, 0.21 means the distribution is almost symmetric, with a slight pull toward higher values.

Step 5 — Detecting Unusual Values (Outliers)

The analyst wonders: Are some values unusually far from the rest?

Haro
? @@(oSales.Outliers())
#--> []

illustration

No outliers detected. Softanza uses the IQR rule internally and explains the result directly through behavior, not formulas.

Step 6 — Understanding Position with Z-Scores

To compare individual values, the analyst asks: How far is each value from the average?

Haro
? @@(oSales.ZScores())
#--> [-0.63, 0.15, -1.43, 1.45, 0.80, -1.27, 0.93]

illustration

A Z-score tells how many standard deviations a value is away from the mean:

  • 0 → exactly average
  • ±1 → one standard deviation away
  • Large absolute values → unusual observations

Here, none exceed ±2, confirming the absence of extreme values.

Step 7 — Letting Softanza Summarize (Insights & Recommendations)

Instead of interpreting everything manually, the analyst asks the dataset itself:

Haro
? @@NL(oSales.Insights())

illustration

Output:

[
  "Moderate variability detected (CV ≈ 27%).",
  "Distribution is approximately symmetric.",
  "No significant outliers detected."
]

Insights summarize what the data looks like.

The next question is more practical:

What should I do with this information?

That is where recommendations come in.

Haro
? @@NL(oSales.Recommendations())

illustration

Output:

[
  "Data shows acceptable stability; mean-based indicators are reliable.",
  "No outlier treatment required.",
  "Standard statistical methods can be safely applied."
]

While insights describe the situation, recommendations suggest actions or safe analytical choices. They transform statistics from observation into guidance.

Step 8 — Introducing Plans (Why They Exist)

After repeating these steps many times, the analyst realizes something:

“I always do the same reasoning in the same order.”

That is why Plans exist in Softanza.

A Plan is a reusable analysis path that executes concrete steps and explains them.


Step 9 — Running a Built‑in Plan

Haro
oSales.ExecutePlan(:EDA)

illustration

Output:

• Data type: numeric
• Sample size: 7
• Mean: 144.14
• Median: 150
• Std Dev: 38.62
• Quartiles: [92, 150, 187.5]
• Skewness: 0.21
• Outliers: none

This is not abstraction — it is the same concrete steps, executed, ordered, and narrated.

Step 10 — Creating a Personal Plan

The analyst now defines what they care about:

Haro
aBusinessPlan = [
  [:function = "Mean", :description = "Typical sales"],
  [:function = "CoefficientOfVariation", :description = "Stability"],
  [:condition = "ContainsOutliers()",
   :function = "Outliers",
   :description = "Risk events"]
]

oSales.AddPlan(:Business, "Business Overview", "Quick decision view", aBusinessPlan)

oSales.ExecutePlan(:Business)

illustration

Output:

• Typical sales: 144.14
• Stability (CV): 26.79%
• Risk events: none

Plans turn personal reasoning into executable knowledge.

The Softanza Advantage

Feature Softanza (Haro) Python (pandas/scipy) R Julia JavaScript
Natural language methods ✅ Full ⚠️ Partial ⚠️ Partial ❌ Limited ❌ Limited
Auto type detection ✅ Automatic ⚠️ Manual ⚠️ Manual ⚠️ Manual ❌ Manual
Narrative insights ✅ Built-in ❌ None ❌ None ❌ None ❌ None
Analysis plans ✅ Native ❌ None ❌ None ❌ None ❌ None
Adaptive workflows ✅ Yes ❌ Manual ❌ Manual ❌ Manual ❌ Manual
Learning curve ✅ Gentle ⚠️ Steep ⚠️ Steep ⚠️ Steep ⚠️ Moderate
Semantic cache ✅ Automatic ❌ Manual ❌ Manual ❌ Manual ❌ Manual
Domain rules ✅ Extensible ❌ None ❌ None ❌ None ❌ None
Four-pillar model ✅ Native ❌ None ❌ None ❌ None ❌ None

Softanza transforms statistics from computation to conversation:

  1. Self-describing data: Datasets explain themselves through insights
  2. Contextual interpretation: Methods adapt to data type automatically
  3. Narrative layer: Results come with meaning, not just numbers
  4. Guided exploration: Plans suggest next steps based on findings
  5. Learning-friendly: Methods read like natural questions
  6. Unified framework: Same model for statistics and visualization

What in Python takes 14 lines of code to achive:

Python, shown for comparison, not run
import pandas as pd
import scipy.stats as stats

df = pd.DataFrame({'value': data})
print(f"Mean: {df['value'].mean()}")
print(f"Median: {df['value'].median()}")
print(f"Std: {df['value'].std()}")

Q1 = df['value'].quantile(0.25)
Q3 = df['value'].quantile(0.75)
IQR = Q3 - Q1
outliers = df[(df['value'] < Q1 - 1.5*IQR) | (df['value'] > Q3 + 1.5*IQR)]
print(f"Outliers: {len(outliers)}")

skew = stats.skew(df['value'])
kurt = stats.kurtosis(df['value'])
print(f"Skewness: {skew}, Kurtosis: {kurt}")

Softanza can make it in two lines:

Haro
oData = new stzDataSet(data)
oData.ExecutePlan(:EDA)

illustration

The plan executes comprehensive analysis with narrative output, actionable insights, and recommendations—all in one line.

Conclusion: Statistics as Intent

The stzDataSet class reimagines statistics not as formulas to memorize, but as a language of thought embedded in code. It doesn't just calculate—it:

  • Understands data nature through automatic type detection
  • Adapts methods to context based on data characteristics
  • Narrates findings meaningfully through insights and recommendations
  • Guides analytical workflows via intelligent plans
  • Educates through natural language interfaces
  • Unifies statistics and visualization under one cognitive model

The class guides the analyst through seven pragmatic layers that every experienced data analyst applies to statistical work

1. Statistical Primitives (Mean, Median, StdDev)
          ↓
2. Semantic Interpretation (Type detection, validation)
          ↓
3. Distribution Analysis (Quartiles, skewness, outliers)
          ↓
4. Relational Analysis (Correlation, regression)
          ↓
5. Narrative Layer (Insights, recommendations)
          ↓
6. Orchestrated Plans (EDA, Quality, Trends)
          ↓
7. Visualization (Bar, Surface, Histogram, Scatter, using the Softanza Plotting classes)

Each layer builds on the previous, creating a thinking system rather than a calculation tool.

Statistics becomes intent. Code becomes dialogue. Data becomes knowledge. And that transformation—from numbers to narrative, from computation to cognition—is what makes Softanza not just a library, but a way of thinking about data.

Cite

Mansour Ayouni. "stzDataSet: Statistics as a Language of Thought". Softanza narrations, 2026. https://mayouni.github.io/stzsite/en/narrations/stzdatasetdoc.html

Not run: its code touches files, the network, the clock or chance. The article is published as written; its blocks are illustrations. The code of the articles is Haro code. Where an article was written before the language took its present name, the name was changed and nothing else. Genre, area and series read from the file's name, the year from its first commit: derived, until the article carries its own header. The file on GitHub(opens in a new tab)