noisymoon API
Unit root-tests and reaction–diffusion simulation over HTTP
This API lets you call the computations covered in this site’s articles from your own programs.
- Tests: ADF and KPSS tests (matching statsmodels), t-tests (one-sample, two-sample and paired; one- or two-sided; matching scipy), the Shapiro–Wilk normality test (matching R and scipy), and rank tests (Mann–Whitney, Wilcoxon signed-rank and Kruskal–Wallis; matching scipy).
- State space models: Kalman filtering and smoothing (you specify the matrices; missing values are supported), and maximum likelihood estimation of the local level model (matching statsmodels).
- Information: Kullback–Leibler divergence, Fisher information (Cramér–Rao lower bound and standard errors), and distribution fitting with comparison by AIC and BIC.
- Multivariate analysis: principal component analysis (eigenvalues, explained variance ratios, loadings, scores and parallel analysis; matching scikit-learn).
- Simulation: the Gray-Scott reaction–diffusion system. Results are returned as an image (PNG) and a NumPy array (
.npy).
Create an account / issue an API key →
Pricing
Billing uses prepaid credits. Only what you use is deducted from your balance.
| Item | Price |
|---|---|
| ADF / KPSS / t-test / Shapiro–Wilk / Mann–Whitney / Wilcoxon / Kruskal–Wallis / Kalman filter / local level / information / PCA / SEM / growth curves | ¥1 per call |
| Gray-Scott | ¥0.01 per million cell-steps (about ¥6.6 for a 256×256 grid and 10,000 steps) |
| Purchase units | ¥500 / ¥1,000 / ¥5,000 (tax included; credit card) |
- Credits expire 180 days after purchase.
- You are not charged when a computation fails, for example because of invalid input. If a simulation fails, its cost is refunded.
- The “Try it” demos in the articles are free (up to 500 points per series and up to 10 calls per minute).
Usage
1. Issue an API key
Log in with your email address on the Account page, purchase credits and issue a key. Keys are strings starting with nm_ and are shown only once, when they are issued.
2. Call the API
Send the key in the X-API-Key header.
curl -X POST "https://api.noisymoon.jp/v1/tests/adf?lang=en" \
-H "X-API-Key: $NOISYMOON_KEY" \
-d '{"series": [0.12, 0.35, 0.10, 0.44, 0.61, 0.52, 0.80, 0.77, 0.95, 1.10], "regression": "c"}'From Python:
import os, requests
API = "https://api.noisymoon.jp"
H = {"X-API-Key": os.environ["NOISYMOON_KEY"]}
r = requests.post(f"{API}/v1/tests/adf", headers=H, params={"lang": "en"},
json={"series": list(y), "regression": "ct", "autolag": "AIC"})
r.raise_for_status()
res = r.json()
print(res["statistic"], res["pvalue"], res["critical_values"])Simulations take time, so they are accepted as “jobs”; you fetch the results once they have finished.
import io, time, numpy as np
job = requests.post(f"{API}/v1/sim/gray-scott", headers=H,
json={"n": 256, "steps": 10000, "F": 0.0367, "k": 0.0649, "init": "random"}).json()
while True:
st = requests.get(f"{API}/v1/jobs/{job['id']}", headers=H).json()
if st["status"] in ("done", "failed"):
break
time.sleep(2)
v = np.load(io.BytesIO(requests.get(f"{API}/v1/jobs/{job['id']}/v.npy", headers=H).content))3. Response language
By default, error messages and descriptive fields in responses (such as null_hypothesis) are in Japanese. To receive them in English, add the query parameter ?lang=en or send the header Accept-Language: en. If both are present, lang takes precedence. Only the text values change; JSON keys and numbers are the same in either language. Every response carries a Content-Language header (en or ja) indicating the language used.
To use English for every call without adding the parameter each time, set it once on a requests.Session:
s = requests.Session()
s.headers["X-API-Key"] = os.environ["NOISYMOON_KEY"]
s.params = {"lang": "en"}
s.post(f"{API}/v1/tests/shapiro", json={"x": list(a)}).json()The remaining examples on this page omit lang for brevity.
Tools at a glance
For each tool, the table summarizes the data it needs, its assumptions and the values it returns. Detailed explanations and proofs are in the corresponding articles.
| Tool | Required data | Assumptions | Output |
|---|---|---|---|
| ADF test (Japanese) | A single time series (at least 10 points) and the choice of deterministic terms | The null hypothesis is a unit root. Low power; sensitive to structural breaks | Statistic, p-value, selected lag, critical values |
| KPSS test | A single time series; level stationarity or trend stationarity | The null hypothesis is stationarity. Use together with ADF | Statistic, p-value (with a note if outside the table’s range), lag, critical values |
| t-test (Japanese) | Sample x (and y), the null value, one- or two-sided | Normality and independence. Two-sample tests assume equal variances by default (Welch is also available) | t, degrees of freedom, p-value, estimate and standard error, confidence interval |
| Shapiro–Wilk test | A single sample (3–5,000 points) | i.i.d. from a continuous distribution. With large samples, even small departures lead to rejection | W, p-value, sample size, mean and standard deviation |
| Mann–Whitney, Wilcoxon, Kruskal–Wallis | Two samples x, y / one sample or paired x, y / k groups (up to 100,000 points each) | Independence. The null hypothesis is “the distributions are the same” (for Wilcoxon, “symmetric about 0”); these are not-tests of the median. The significance level breaks down when comparing groups with different variances | Statistic, p-value, method used (exact distribution / normal approximation / permutation), effect sizes, Hodges–Lehmann estimate, mean rank for each group |
| Kalman filter (Japanese) | A sequence of observations (missing values allowed), matrices F, H, Q, R, initial values (optional) | Linear and Gaussian; time-invariant matrices | Means and covariances of predictions, filtered and smoothed states; prediction errors; log-likelihood; one-step-ahead forecast |
| Local level (Japanese) | A single time series (at least 3 points; missing values allowed) | A random-walk level plus independent observation noise | Estimates of the two variances, filtered and smoothed level with standard deviations, AIC, one-step-ahead forecast |
| KL divergence (Japanese) | A distribution family and the parameters of two distributions (probability vectors for discrete) | Same family; parameters within their valid ranges | KL(P‖Q), KL(Q‖P), Jeffreys divergence, values in bits |
| Fisher information (Japanese) | A distribution family and either parameter values plus n, or a sample | Regularity conditions; the family is correctly specified | Information matrix, Cramér–Rao lower bound, MLEs and standard errors |
| Distribution fitting (Japanese) | A single sample (at least 3 points) | i.i.d.; continuous and discrete values are not mixed | Per-distribution MLEs, likelihood, AIC, BIC, Akaike weights; the best distribution |
| PCA (Japanese) | A data matrix (2–50 variables; missing values allowed), or a covariance/correlation matrix plus n | Linear relationships; use the correlation matrix if units differ; sensitive to outliers | Eigenvalues, explained variance ratios, eigenvectors, loadings, scores; number of components by the Kaiser criterion and parallel analysis |
| SEM (Japanese) | A model in lavaan syntax, and a data matrix (missing values allowed) or a covariance matrix plus n (plus means for a mean structure) | Multivariate normality (maximum likelihood); the model must be identified; listwise deletion of missing values | Estimates, standard errors, z, p-values, 95% intervals, standardized solution, R², χ² test, CFI, TLI, RMSEA (90% interval), SRMR, AIC, BIC, residual covariances |
| Latent growth curves (Japanese) | One column per time point (3–20 time points; missing values allowed), the time values, the shape (linear, quadratic, latent basis) and time-invariant covariates (optional) | Multivariate normality (maximum likelihood); everyone is measured at the same time points; listwise deletion of missing values | Means, variances and covariances of the growth factors; mean trajectory; shape comparison (χ² difference tests, AIC, BIC); individual factor scores; the same fit indices as SEM |
| Gray-Scott | Grid size, number of steps, coefficients such as F and k | Stability condition of the explicit Euler method, dt·max(Du,Dv) ≤ 0.25 | Image (PNG) and array (.npy) of the v field, summary statistics |
Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /v1/tests/adf |
ADF test |
| POST | /v1/tests/kpss |
KPSS test |
| POST | /v1/tests/ttest-1samp |
One-sample t-test |
| POST | /v1/tests/ttest-2samp |
Two-sample t-test (equal variances / Welch) |
| POST | /v1/tests/ttest-paired |
Paired two-sample t-test |
| POST | /v1/tests/shapiro |
Shapiro–Wilk normality test |
| POST | /v1/tests/mannwhitney |
Mann–Whitney U test |
| POST | /v1/tests/wilcoxon |
Wilcoxon signed-rank test (one-sample, paired) |
| POST | /v1/tests/kruskal |
Kruskal–Wallis test |
| POST | /v1/statespace/kalman |
Kalman filter, smoother and likelihood |
| POST | /v1/statespace/local-level |
Maximum likelihood estimation of the local level model and level smoothing |
| POST | /v1/info/kl |
KL divergence |
| POST | /v1/info/fisher |
Fisher information |
| POST | /v1/info/select-distribution |
Distribution fitting with AIC and BIC |
| POST | /v1/multivariate/pca |
Principal component analysis |
| POST | /v1/sem/fit |
Maximum likelihood estimation of structural equation models (SEM, CFA, latent growth curves) |
| POST | /v1/sem/growth |
Latent growth curves (automatic syntax generation, shape comparison, factor scores) |
| POST | /v1/sim/gray-scott |
Submit a Gray-Scott job (returns 202) |
| GET | /v1/jobs/{id} |
Job status and result summary |
| GET | /v1/jobs/{id}/v.png |
Result image (v field, viridis) |
| GET | /v1/jobs/{id}/v.npy |
Result array (float32, shape (n, n)) |
| GET | /v1/usage |
Usage over the last 30 days and current balance |
| GET | /v1/pricing |
Current prices (no key required) |
ADF test POST /v1/tests/adf
| Parameter | Default | Description |
|---|---|---|
series |
(required) | Array of numbers, 10–100,000 points |
regression |
"c" |
Deterministic terms: "n" (none) / "c" (constant) / "ct" (constant + trend) / "ctt" (+ quadratic trend) |
autolag |
"AIC" |
Lag selection: "AIC" / "BIC" / "t-stat" / null (use maxlag as is) |
maxlag |
\(12(n/100)^{1/4}\) | Maximum lag |
The procedure and defaults are the same as statsmodels’ adfuller. For how the test works, see the ADF test article (Japanese).
KPSS test POST /v1/tests/kpss
| Parameter | Default | Description |
|---|---|---|
series |
(required) | Array of numbers |
regression |
"c" |
"c" (level stationary) / "ct" (trend stationary) |
nlags |
"auto" |
"auto" (Hobijn et al. 1998) / "legacy" / integer |
t-tests POST /v1/tests/ttest-1samp · ttest-2samp · ttest-paired
| Parameter | Default | Description |
|---|---|---|
x |
(required) | Array of numbers (2–100,000 points) |
y |
(required for two-sample and paired) | Array of numbers. For paired tests, the same length as x |
mu0 |
0 |
Null value (the mean for one-sample; the mean of the difference x − y for two-sample and paired) |
alternative |
"two-sided" |
"two-sided" / "greater" / "less" |
equal_var |
true |
Two-sample only. true assumes equal variances (Student; UMP unbiased), false uses Welch |
confidence |
0.95 |
Confidence level of the interval |
The response contains statistic (t), df, pvalue, estimate (the mean or the difference), stderr and confidence_interval (for one-sided tests, one end is null, meaning infinity). The definitions are the same as scipy’s ttest_1samp / ttest_ind / ttest_rel. For the theory, see the t-test article (Japanese).
r = requests.post(f"{API}/v1/tests/ttest-2samp", headers=H,
json={"x": list(a), "y": list(b), "alternative": "greater"}).json()
print(r["statistic"], r["df"], r["pvalue"], r["confidence_interval"])Shapiro–Wilk test POST /v1/tests/shapiro
| Parameter | Default | Description |
|---|---|---|
x |
(required) | Array of numbers (3–5,000 points) |
The response contains statistic (W), pvalue, n, mean and sd. The null hypothesis is “the sample comes from a normal distribution”; the smaller W, the smaller the p-value. The coefficients and p-value use Royston’s (1995) approximation (AS R94) and match R’s shapiro.test and scipy’s shapiro. For n = 3 the exact distribution is used. For the theory, see the Shapiro–Wilk test article.
r = requests.post(f"{API}/v1/tests/shapiro", headers=H, json={"x": list(a)}).json()
print(r["statistic"], r["pvalue"])Rank tests POST /v1/tests/mannwhitney, wilcoxon, kruskal
| Parameter | Default | Description |
|---|---|---|
x, y |
(both required for Mann–Whitney; x required for Wilcoxon) |
Arrays of numbers (1–100,000 points each). For Wilcoxon, passing y tests the differences x − y |
groups |
(required for Kruskal–Wallis) | Array of arrays of numbers (2–100 groups, up to 100,000 points in total). Name the groups with labels |
alternative |
"two-sided" |
"two-sided" / "greater" / "less" (Mann–Whitney and Wilcoxon) |
method |
"auto" |
"auto" / "exact" / "asymptotic". auto chooses by the same rule as scipy |
use_continuity |
true |
Continuity correction for the Mann–Whitney normal approximation |
correction |
false |
Continuity correction for the Wilcoxon normal approximation |
zero_method |
"wilcox" |
Handling of zero differences in Wilcoxon: "wilcox" / "pratt" / "zsplit" |
The response contains statistic, pvalue, method (exact / asymptotic / permutation), effect sizes (prob_superiority, rank_biserial, epsilon_squared) and hodges_lehmann. The statistics and p-values match scipy’s mannwhitneyu / wilcoxon / kruskal. For the theory, see the rank tests article.
r = requests.post(f"{API}/v1/tests/kruskal", headers=H,
json={"groups": [list(a), list(b), list(c)], "labels": ["A", "B", "C"]}).json()
print(r["statistic"], r["pvalue"], [g["mean_rank"] for g in r["groups"]])Kalman filter POST /v1/statespace/kalman
| Parameter | Default | Description |
|---|---|---|
y |
(required) | Array of length T. In one dimension, each element is a number or null; in p dimensions, each time point is an array of length p (individual components may be null) |
F, H, Q, R |
(required) | State transition m×m, observation p×m, state noise covariance m×m, observation noise covariance p×p. A 1×1 matrix may be given as a number |
x0, P0 |
Approximate diffuse initialization | Mean (length m) and covariance (m×m) of the initial state. If both are omitted, P0 = 10⁶ I and the first m periods are excluded from the likelihood |
smooth |
true |
Also compute the smoothed states |
return_cov |
true |
Also return the covariance matrix for each period (set to false when T×m² exceeds 2 million) |
Limits: T ≤ 100,000; m, p ≤ 20. The results match statsmodels’ state space models (relative error 10⁻⁸ with known initial values).
Local level model POST /v1/statespace/local-level
Send just {"y": [...]} (missing values as null) and the API estimates the two variances — observation noise and changes in the level — by maximum likelihood, and returns the filtered and smoothed level with standard deviations, AIC and a one-step-ahead forecast.
r = requests.post(f"{API}/v1/statespace/local-level", headers=H, json={"y": list(y)}).json()
r["params"], r["level"]["smoothed"]Information POST /v1/info/kl · fisher · select-distribution
requests.post(f"{API}/v1/info/kl", headers=H, json={
"family": "gamma", "p": {"shape": 2, "rate": 1}, "q": {"shape": 3, "rate": 1.5}}).json()
requests.post(f"{API}/v1/info/fisher", headers=H, json={"family": "normal", "params": {"mu": 0, "sigma2": 4}, "n": 50}).json()
requests.post(f"{API}/v1/info/fisher", headers=H, json={"family": "gamma", "sample": list(x)}).json() # MLEs and standard errors
requests.post(f"{API}/v1/info/select-distribution", headers=H, json={"x": list(x)}).json()KL families and parameters: normal (mu, sigma), mvnormal (mean, cov), exponential (rate), poisson (lambda), gamma (shape, rate), discrete (p and q as probability vectors). Fisher families and parameters: normal (mu, sigma2), poisson (lambda), binomial (p; trials required), exponential (rate), gamma (shape, rate). Candidates for distribution fitting are normal, lognormal, exponential, gamma and weibull for continuous data, and poisson and negbinom for discrete data (plus binomial if you pass trials). If every value in the sample is a non-negative integer, the discrete candidates are used.
Principal component analysis POST /v1/multivariate/pca
| Parameter | Default | Description |
|---|---|---|
X |
Either this or cov |
Data matrix (rows are observations, columns are variables; missing values as null, and such rows are dropped) |
cov, n |
Either this or X |
Covariance or correlation matrix and the sample size (without n, parallel analysis is skipped) |
names |
x1, x2, … |
Variable names |
scale |
true |
true uses the correlation matrix (standardized, dividing by n−1); false uses the covariance matrix |
n_components |
All | Number of components to return |
parallel_reps, seed |
100, 0 |
Number of parallel-analysis replications (0 to skip) and the random seed |
return_scores |
true |
Return principal component scores |
Structural equation modeling POST /v1/sem/fit
| Parameter | Default | Description |
|---|---|---|
model |
Required | lavaan syntax (=~ measurement, ~ regression, ~~ variances and covariances, ~ 1 intercepts; modifiers: a number = fixed, NA = free, a name = equality constraint, start(x)). Statements are separated by newlines or ; |
names |
Required | Variable names of the columns. Columns not appearing in the model are ignored |
X |
Either this or cov |
Data matrix (rows are observations; a row is dropped if any model variable in it is null) |
cov, n, mean |
Either this or X |
Covariance matrix and sample size (plus means if a mean structure is used) |
rescale_cov |
true |
Treat cov as unbiased (divided by n−1) and multiply it by (n−1)/n for maximum likelihood (the lavaan default) |
type |
"sem" |
"sem", "cfa" or "growth" (growth includes a mean structure, fixes the observed intercepts to 0 and frees the latent means) |
meanstructure |
false |
Estimate a mean structure (intercepts) |
return_scores |
false |
Return factor scores (regression method; only with X) |
The parameters added by default are the same as in lavaan’s sem(), cfa() and growth() (with fixed.x = FALSE): the loading of the first indicator of each factor is fixed to 1, and the variances of all variables are free, as are the covariances among exogenous latent variables, among exogenous observed variables and among the final dependent variables.
Latent growth curves POST /v1/sem/growth
| Parameter | Default | Description |
|---|---|---|
names, X |
Required | Column names and data matrix (cov, mean and n may be used instead, but then factor scores are not returned) |
time_vars |
All columns except covariates |
One column per time point (in time order) |
times |
0, 1, 2, … |
Time values (strictly increasing). The intercept i is the value at time 0 |
shape |
"linear" |
"linear", "quadratic" (4 or more time points) or "latent_basis" (the coefficients of the first two time points are fixed to times and the rest are estimated) |
covariates |
None | Time-invariant covariates. All growth factors are regressed on them |
equal_residuals |
false |
Constrain the residual variances to be equal across time points |
compare_shapes |
true |
Also fit intercept-only, linear, quadratic and latent basis models, and run χ² difference tests on the nested pairs |
return_scores |
true |
Individual factor scores (regression method) |
The syntax field of the response is the generated lavaan syntax; passing it as is to /v1/sem/fit with type: "growth" gives the same results.
Gray-Scott POST /v1/sim/gray-scott
\[ \partial_t u = D_u \nabla^2 u - u v^2 + F(1-u), \qquad \partial_t v = D_v \nabla^2 v + u v^2 - (F+k) v \]
| Parameter | Default | Range |
|---|---|---|
n |
256 | 16–512 (side length of the grid; periodic boundary) |
steps |
10000 | 1–100000 (subject to \(n^2 \times\) steps \(\le 512^2 \times 20000\)) |
F, k |
0.035, 0.065 | 0–0.2 |
Du, Dv |
0.16, 0.08 | 0–1 |
dt |
1.0 | \(dt \cdot \max(D_u, D_v) \le 0.25\) (stability condition of the explicit Euler method) |
seed |
Random | The same value reproduces the same result |
init |
"center" |
"center" (seed at the center) / "random" (seeds at random positions) |
Errors
Errors are returned in the following form (shown here with ?lang=en).
{"error": {"code": "invalid_argument", "message": "series length must be 10–100000"}}| HTTP | code | Meaning |
|---|---|---|
| 400 | invalid_argument / invalid_json |
Invalid input (not charged) |
| 401 | unauthorized |
Missing or invalid key |
| 402 | insufficient_credit |
Insufficient balance |
| 429 | rate_limited / too_many_jobs |
Limit of 60 calls per minute or 3 concurrent jobs reached |
Free demo
You can try these without a key (up to 500 points per series).