# Normality Test Engine MCP

> Normality Test Engine runs Jarque-Bera tests and calculates Skewness/Kurtosis coefficients locally. It validates if your data set follows a normal distribution, providing exact p-values and clear pass/fail verdicts for statistical analysis. This is essential pre-screening before running parametric tests like t-tests or ANOVA.

## Overview
- **Category:** developer-tools
- **Price:** Free
- **Tags:** statistics, data-science, normality-test, mathematical-analysis, data-validation

## Description

Listen up. Before you run any serious parametric test—like a t-test or ANOVA—you gotta confirm your data is actually normally distributed. You can't just eyeball that; an LLM doesn't read distributions the way a statistician does, and its guess is usually wrong.

The `test_normality` tool runs an exact Jarque-Bera normality test on numeric data. It guarantees your AI client gets real math, not some hallucination from the model itself. This isn't just guesswork; it’s rigorous statistical pre-screening you need before your analysis makes sense.

The server checks data distribution by computing Skewness and Kurtosis coefficients locally. You input a set of numbers, and the agent spits out definitive math that won't fail on you when you need it most. It gives you the whole picture: whether your dataset follows a normal curve or not.

When you run `test_normality`, your AI client gets much more than just a simple yes/no. You get an exact test statistic, and crucially, the p-value for the Jarque-Bera test. This gives you a clear pass/fail verdict on normality. It’s essential because running those parametric tests—like linear regression or ANOVA—on non-normal data invalidates your results, plain and simple.

The process is straightforward: feed it numeric data. The server calculates the exact Skewness and Kurtosis coefficients for that set. You'll also get the mean and standard deviation values you need to document your work. It’s a complete statistical snapshot.

If the data isn't normal, the test tells you exactly how far off it is, giving you the necessary information to decide if you need to transform the data or switch to non-parametric alternatives. You don't have to guess what kind of analysis you can actually run; this tool narrows that down for you.

You rely on the ability to check the distribution first. The server handles all the complex calculations—the Jarque-Bera test, Skewness, and Kurtosis—and delivers a single, actionable verdict straight up. It’s built to provide reliable results right in your workflow, letting you skip the manual data checks and get straight to conclusions.

## Tools

### test_normality
Runs an exact Jarque-Bera normality test on numeric data, guaranteeing no math hallucinations from the LLM.

## Prompt Examples

**Prompt:** 
```
Check if this residuals array is normally distributed before I run my regression.
```

**Response:** 
```
The Jarque-Bera test returns p = 0.42. We fail to reject the normality hypothesis — your residuals appear normally distributed. Proceed with the regression.
```

**Prompt:** 
```
Is this sensor data normally distributed or should I use a non-parametric test?
```

**Response:** 
```
The data shows significant positive skewness (1.8) and high kurtosis (5.2). The Jarque-Bera p-value is 0.001 — the data is not normally distributed. Use a non-parametric test.
```

**Prompt:** 
```
Run a normality test on the 'Revenue' column before I calculate confidence intervals.
```

**Response:** 
```
Normality test passed (p = 0.61). Skewness is 0.3 and kurtosis is 2.9 — both close to normal parameters. Your confidence intervals will be valid.
```

## Capabilities

### Check Data Distribution
The server runs an exact Jarque-Bera test to determine if numeric data is normally distributed.

## Use Cases

### Checking Model Residuals
You just ran a linear regression, but you don't know if the residuals are normal enough for your confidence intervals. You feed the residuals array into `test_normality`. If the p-value is high, you proceed; otherwise, you switch to non-parametric methods.

### Prepping Sensor Data
A sensor generates stream data that needs statistical validation. Instead of running a full analysis and risking bias, your agent uses `test_normality` first. If the data shows high skewness, it flags the need for data transformation before modeling.

### Validating Financial Metrics
Before calculating confidence intervals on revenue or profit, you must confirm normality. You run `test_normality` on the 'Revenue' column. A passing test (high p-value) confirms that your subsequent financial metrics are valid.

### Comparing Groups
You have two groups of experimental data and need to compare them using ANOVA, but you can't be sure they come from normal distributions. You run `test_normality` on each group dataset separately to verify assumptions before testing.

## Benefits

- Get a definitive pass/fail verdict instantly. The `test_normality` tool returns the Jarque-Bera p-value and explicitly states if you can reject the normality hypothesis.
- Avoid mathematical errors in downstream models. By checking Skewness and Kurtosis first, you ensure your data meets the assumptions required for t-tests or ANOVA.
- Keep your research private. All statistical computations happen locally on your machine; no raw data leaves your environment.
- Get more than just a yes/no answer. The engine provides the exact Mean, Std Dev, Skewness, and Kurtosis coefficients needed for deep reporting.
- Stop guessing about distribution. You get verifiable statistics—the exact test statistic and p-value—that you can trust in published work.

## How It Works

The bottom line is you get verifiable statistical proof that your data meets the assumptions required for advanced mathematical testing.

1. Feed the engine a set of numeric residuals or raw data arrays.
2. The `test_normality` tool executes the Jarque-Bera test and calculates statistical coefficients locally.
3. You receive a definitive p-value, Skewness, Kurtosis values, and an interpretation stating whether the data passes the normality check.

## Frequently Asked Questions

**How does Normality Test Engine handle data privacy?**
The tests run entirely on your local machine, not in the cloud. Your raw research data never leaves your environment. This is key for sensitive datasets.

**Can I use test_normality with non-numeric data?**
No. The tool requires numeric input to calculate statistical coefficients like Skewness and Kurtosis. If your data isn't quantifiable numbers, you need a different analysis approach.

**Is the result from test_normality definitive proof of normality?**
It provides a highly reliable, statistically calculated verdict based on the Jarque-Bera test. However, always remember it's a screening step; deep validation requires domain expertise.

**What is the difference between this and standard statistical software?**
This MCP integrates that functionality into your AI workflow. You get the precision of specialized software (like `simple-statistics`) without leaving your chat or IDE.

**If my dataset contains null or missing values, how does the `test_normality` tool handle it?**
The tool requires a clean array of finite numbers. If you include NaNs (Not a Number) or infinite values, the test will fail and return an explicit error code indicating invalid input data. You must pre-clean your data.

**Can I use `test_normality` with live, streaming sensor feeds?**
No. The server is designed for static analysis of compiled datasets. You must collect the stream data into a complete batch array before passing it to the tool for testing.

**Does `test_normality` check for multivariate normality?**
No, this engine performs a univariate Jarque-Bera test. It analyzes one variable's distribution at a time; you need to run the tool separately on each dimension in your dataset.

**How does `test_normality` ensure accuracy when calculating statistics?**
It uses the specialized `simple-statistics` library, which computes coefficients like Skewness and Kurtosis exactly. This process prevents mathematical guesswork that you might get from generic LLM math functions.

**Is this the Shapiro-Wilk test?**
This engine implements the Jarque-Bera normality test, which uses Skewness and Kurtosis. It is highly effective for medium-to-large samples and avoids the Shapiro-Wilk implementation gaps in JavaScript.

**How many data points do I need?**
The Jarque-Bera test works best with 30 or more samples. For very small samples (n < 20), consider using visual QQ-plot analysis as a complement.

**What does a 'not normal' result mean for my analysis?**
If your data is not normally distributed, parametric tests like t-tests and ANOVA may be unreliable. Consider using non-parametric alternatives like Spearman correlation or Mann-Whitney U tests.