Statistics and time series: API index¶
Find an operation by its purpose. Entries link to the complete signature and contract.
HMath.Probability¶
| API | Purpose |
|---|---|
| Distribution | Parameterized probability law. |
| Bernoulli | Declaration and type contract below. |
| Binomial | Declaration and type contract below. |
| NegativeBinomial | Declaration and type contract below. |
| Geometric | Declaration and type contract below. |
| Hypergeometric | Declaration and type contract below. |
| Poisson | Declaration and type contract below. |
| Categorical | Declaration and type contract below. |
| DiscreteUniform | Declaration and type contract below. |
| Uniform | Declaration and type contract below. |
| Normal | Declaration and type contract below. |
| LogNormal | Declaration and type contract below. |
| Exponential | Declaration and type contract below. |
| Gamma | Declaration and type contract below. |
| Beta | Declaration and type contract below. |
| ChiSquare | Declaration and type contract below. |
| StudentT | Declaration and type contract below. |
| FisherF | Declaration and type contract below. |
| Cauchy | Declaration and type contract below. |
| Laplace | Declaration and type contract below. |
| Logistic | Declaration and type contract below. |
| Weibull | Declaration and type contract below. |
| Pareto | Declaration and type contract below. |
| Rayleigh | Declaration and type contract below. |
| Maxwell | Declaration and type contract below. |
| Gumbel | Declaration and type contract below. |
| GeneralizedExtremeValue | Declaration and type contract below. |
| BetaBinomial | Declaration and type contract below. |
| Skellam | Declaration and type contract below. |
| VonMises | Declaration and type contract below. |
| Triangular | Declaration and type contract below. |
| TruncatedNormal | Declaration and type contract below. |
| Mixture | Declaration and type contract below. |
| Empirical | Declaration and type contract below. |
| GaussianKDE | Declaration and type contract below. |
| validateDistribution | Check finite parameters, support ordering, probability normalization, and declared per-family reference budgets. |
| density | Probability mass for discrete families or density for continuous families. |
| logDensity | Log density or mass; zero probability is negative infinity, while an integrable endpoint singularity is positive infinity. |
| cdf | P(X<=x). |
| survival | P(X>x), using direct upper tails for normal, gamma, beta, t, F, binomial and Poisson to avoid cancellation. |
| quantile | Generalized inverse CDF, p in [0,1]; endpoints return mathematical support bounds, including infinities. |
| hazard | Density divided by survival. |
| logLikelihood | Sum of independent observation log probabilities. |
| moments | Mean and population variance. |
| entropy | Shannon or differential entropy in nats. |
| sample | Draw a model sample and updated immutable RNG; specialized gammanormalcount samplers are reused, with inverse-CDF sampling for remaining families. |
| fitNormal | Normal maximum-likelihood fit; variance divides by n. |
| fitExponential | Maximum-likelihood rate for nonnegative observations with strictly positive total. |
| fitBernoulli | Maximum-likelihood probability for nonempty binary observations. |
| fitMLEGrid | Select the maximum-likelihood model from an explicit finite candidate grid; this is grid search, not continuous parameter optimization. |
| fitMAPGrid | Select the maximum log-likelihood plus caller-supplied log prior over a finite model grid. |
| betaBernoulliUpdate | Conjugate Beta prior update from success/failure observations, returning posterior concentrations (alpha,beta). |
| gammaPoissonUpdate | Conjugate Poisson-rate update; arguments and result use Gamma shaperate, deliberately distinct from the Gamma distribution constructor shapescale. |
| normalNormalUpdate | Known-variance conjugate normal mean update. |
| conditionalProbability | Compute P(A|B) from joint P(A intersection B) and strictly positive P(B). |
| bayes | Normalize prior probabilities times observation likelihoods. |
| expectation | Reference expectation under a distribution. |
| goodnessOfFit | Two-sided one-sample Kolmogorov distance against a specified CDF. |
| gaussianKDE | Construct an equal-weight Gaussian kernel density with strictly positive bandwidth and finite nonempty observations. |
| multinomialPMF | Multinomial mass for probabilities summing to one and nonnegative count vector; log-gamma arithmetic avoids factorial overflow. |
| dirichletDensity | Dirichlet density on the strictly positive simplex interior. |
| multivariateNormalLogDensity | Log density for a finite mean/point and symmetric positive-definite covariance, validated by Cholesky. |
| sampleMultivariateNormal | Cholesky-transform independent standard normals; returns a vector and updated state. |
| wishartLogDensity | Wishart log density for real degrees of freedom nu>p-1 and positive-definite p-by-p scale and observation matrices. |
| sampleWishart | Reference Wishart draw as the sum of nu Gaussian outer products; requires integer nu>=p and nu<=100000. |
| Markov | Opaque finite row-stochastic transition matrix. |
| markov | Validate and construct a row-stochastic matrix with 1..1024 states; row sums tolerate absolute error 1e-12. |
| transition | Advance a normalized state-probability row vector by one Markov step. |
| stationary | Stationary probabilities by damped power iteration, with caller iteration budget and positive residual tolerance. |
| HMM | Opaque finite-state categorical-emission hidden Markov model. |
| hmm | Validate initial probabilities, square transition matrix and equally sized categorical-emission rows. |
| forward | Scaled forward returns log likelihood, normalized alpha rows and per-time scaling constants. |
| backward | Scaled backward messages using the same per-time normalizers as forward; terminal message is the all-ones vector. |
| posteriorStates | Posterior state probabilities at each observation time from normalized alpha-beta products. |
| viterbi | Most likely state path and its joint log probability, via max-product dynamic programming in log space. |
| baumWelch | Baum--Welch EM for one observation sequence, pseudocount>=0. |
HMath.Random¶
| API | Purpose |
|---|---|
| Generator | Algorithm variant. |
| PCG32 | Declaration and type contract below. |
| Xoshiro256StarStar | Declaration and type contract below. |
| Xoroshiro128Plus | Declaration and type contract below. |
| MT19937 | Declaration and type contract below. |
| Philox4x32 | Declaration and type contract below. |
| Threefry2x64 | Declaration and type contract below. |
| ChaCha20 | Declaration and type contract below. |
| RNG | Opaque immutable generator state, including any buffered block outputs. |
| seedRNG | Deterministically encode a 64-bit seed. |
| nextWord64 | Produce one word and its successor state. |
| cloneRNG | Copy an immutable state; the copy produces exactly the same future outputs. |
| splitRNG | Create two deterministic child streams by hashing two successive parent words. |
| serializeRNG | Serialize full state, including pending block output, with the versioned hmath-rng-1 prefix. |
| restoreRNG | Parse a versioned full state and validate generator lengths, forbidden zero states, and MT word/index ranges. |
| uniform | Uniform 53-bit real on [0,1), using the most significant random bits. |
| uniformOpen | Uniform 52-bit midpoint real on (0,1), safe as input to logarithms. |
| uniformInt | Unbiased inclusive integer range using 64-bit rejection. |
| sampleN | Run a checked sampler sequentially, returning values and final state. |
| normal | Normal sample with finite mean and strictly positive standard deviation. |
| boxMuller | Standard normal through the polar-coordinate Box--Muller transform, consuming two uniforms. |
| marsagliaNormal | Standard normal through Marsaglia polar disk rejection, with 10000-proposal budget. |
| zigguratNormal | Marsaglia--Tsang 128-layer Ziggurat normal generator. |
| exponential | Exponential sample parameterized by strictly positive rate, via an open-uniform logarithm. |
| gamma | Gamma shape/scale sample using Marsaglia--Tsang rejection and the shape-augmentation identity below shape one; 10000-proposal budget. |
| beta | Beta(a,b) as the ratio of independent gamma variates. |
| poisson | Poisson count by exponential-arrival inversion. |
| binomial | Binomial count from n independent Bernoulli trials. n<=10000000 and p in [0,1]. |
| weighted | Draw an index in proportion to finite nonnegative weights; max scaling handles subnormal or overflowing totals and zero weights are never selected. |
| AliasTable | Opaque Walker alias table with normalized acceptance thresholds and alternative indices. |
| aliasTable | Build a Walker alias table from finite nonnegative weights with positive maximum; max scaling avoids overflow. |
| aliasSample | Draw an index from an already validated alias table, using one uniform integer and one uniform real. |
| reservoir | Algorithm R reservoir over a finite stream, retaining k positions uniformly without replacement. |
| shuffle | Fisher--Yates permutation of list positions. |
| withReplacement | Draw count values independently from a nonempty finite population, preserving duplicates. |
| withoutReplacement | Uniform subset in shuffled order. |
| stratified | One uniform point per equal-width interval of [0,1), in increasing stratum order. |
| importance | Self-normalized importance estimate from values and nonnegative finite importance weights. |
| rejection | Accept proposals with the supplied target/envelope probability in [0,1]; the first argument is a hard proposal budget. |
| inverseTransform | Apply a checked inverse CDF to an open uniform; propagates inverse-domain or nonconvergence errors. |
| metropolisHastings | Symmetric random-walk Metropolis in log density. |
| gibbs | A full Gibbs sweep uses caller-supplied exact conditional samplers in coordinate order. |
| hamiltonianMonteCarlo | Identity-mass HMC with Gaussian momentum, leapfrog count and positive step size, log density and its gradient. |
| monteCarlo | Uniform-[0,1] Monte Carlo integral and estimated standard error from at least two draws. |
| halton | Unshifted Halton point, dimensions 1..16 and zero-based nonnegative point index; index zero is the origin. |
| sobol | Sobol digital net in dimensions 1..8, 32 direction bits. |
| faure | Faure's Pascal digital transform in the least prime base >= dimension. |
| latinHypercube | Random n-by-d Latin hypercube in [0,1), with a separate Fisher--Yates stratum permutation per axis; n>0 and 1<=d<=1024. |
| randomQuality | Mean, population variance, and lag-one correlation; descriptive quality diagnostics, not a cryptographic certification or a replacement for TestU01. |
| entropySeed | Read eight bytes from the operating system entropy device, little endian. |
HMath.Statistics¶
| API | Purpose |
|---|---|
| mean | Arithmetic mean of a finite nonempty list: sum divided by length. |
| variance | Population variance of a finite nonempty list, dividing squared deviations by n (not n-1). |
| standardDeviation | Population standard deviation, sqrt of variance. |
| median | Sort a finite nonempty list and return its middle value, averaging the central pair for even length. |
HMath.Statistics.Advanced¶
| API | Purpose |
|---|---|
| arithmeticMean | Mean of finite nonempty data. |
| weightedMean | Reliability-weighted mean of observations and nonnegative finite weights; weights must have finite positive total. |
| geometricMean | exp(mean(log x)) for strictly positive finite observations. |
| harmonicMean | Reciprocal of the mean reciprocal, for strictly positive finite observations. |
| rms | Root-mean-square with max scaling to avoid squaring overflow. |
| trimmedMean | Discard floor(fraction*n) samples from each sorted tail, with fraction in [0,1/2), then average. |
| winsorizedMean | Replace floor(fraction*n) values at each tail with the nearest retained value, then average. |
| median | Type-7 50th percentile; averages the central pair for an even sample count. |
| modes | All values of maximum multiplicity, sorted ascending; exact floating equality defines ties. |
| quantile | Hyndman--Fan type-7 quantile with linear interpolation and probability p in [0,1]. |
| percentile | Type-7 quantile with percentage in [0,100]. |
| interquartileRange | Type-7 75th percentile minus 25th percentile. |
| medianAbsoluteDeviation | Median absolute deviation from the median, without the normal consistency multiplier. |
| dataRange | Maximum minus minimum; arithmetic overflow is an explicit error. |
| populationVariance | Second population central moment, dividing by n. |
| sampleVariance | Unbiased sample variance, dividing by n-1; requires at least two observations. |
| populationSD | Square root of population variance. |
| sampleSD | Square root of unbiased sample variance. |
| coefficientOfVariation | Population standard deviation divided by absolute mean; rejects zero mean. |
| centralMoment | Population central moment of integer order 0..32; nonfinite intermediate/final arithmetic is rejected. |
| skewness | Uncorrected population third standardized central moment; requires nonconstant observations. |
| kurtosis | Uncorrected population excess kurtosis, subtracting three; requires nonconstant observations. |
| covariance | Covariance of two matching finite data vectors; True selects the n-1 sample correction. |
| correlation | Pearson correlation of matching nonconstant data vectors. |
| covarianceMatrix | Covariance matrix for variables supplied as columns (each list is one variable). |
| spearman | Pearson correlation of average tied ranks; matching nonconstant rank vectors required. |
| kendall | Kendall tau-b with tied-pair correction; quadratic reference implementation. |
| partialCorrelation | Partial correlation of variable indices i,j conditional on every other supplied column, through the inverse sample covariance. |
| autocorrelation | Pearson correlation between overlapping lagged segments; zero<=lag<n-1. |
| crossCorrelation | Pearson correlation of overlapping x_t and y_(t+lag), using their common finite length. |
| movingAverage | Valid-window moving means; window must lie in [1,n], with no endpoint padding. |
| exponentialMovingAverage | EMA with alpha in (0,1], initialized at the first observation. |
| movingVariance | Valid-window population variances with no endpoint padding. |
| Streaming | Opaque Welford accumulator storing an unbounded Integer count, mean and sum of squared deviations. |
| emptyStreaming | Zero-count Welford accumulator. |
| updateStreaming | Add one finite observation by Welford recurrence; nonfinite arithmetic is rejected. |
| combineStreaming | Chan parallel merge of two Welford accumulators; empty accumulators are identities. |
| streamingResult | Return count, mean and variance; True uses n-1 correction and requires at least two samples. |
| histogramND | Histogram edges must increase strictly; intervals are [a,b), with the last interval closed on its right. |
| entropy | Shannon entropy in nats for normalized nonnegative probabilities, with 0*log(0)=0. |
| mutualInformation | Mutual information in nats from a rectangular normalized joint-probability table. |
| klDivergence | KL(P||Q) in nats, including positive infinity when Q is zero on positive P mass. |
| jsDivergence | Equal-mixture Jensen--Shannon divergence in nats, bounded by log 2. |
| zScores | Standardize with population standard deviation; constant samples are rejected. |
| standardError | Unbiased sample standard deviation divided by sqrt n, requiring n>=2. |
| confidenceInterval | Two-sided Student-t confidence interval for a normal population mean with unknown variance; confidence level in (0,1). |
| bootstrap | Seeded nonparametric resampling with replacement. |
| jackknife | Leave-one-out bias-corrected statistic and jackknife standard error; requires n>=2. |
| TestResult | Test statistic, p value clamped to [0,1] after numerical checks, and applicable degrees of freedom. |
| TestResult | Declaration and type contract below. |
| testStatistic | Computed statistic for the selected hypothesis test. |
| pValue | Reported tail probability, clamped to [0,1]; interpret using the test's documented alternative hypothesis. |
| degreesOfFreedom | Distribution degrees-of-freedom parameters in test-specific order (for example numerator then denominator for F tests). |
| oneSampleT | Two-sided one-sample Student t test against a finite null mean; assumes independent normal observations. |
| twoSampleT | Two-sided pooled t test when True, Welch unequal-variance test when False; each group requires n>=2 and positive combined variation. |
| pairedT | Two-sided one-sample t test on paired differences; matching group lengths required. |
| zTest | Two-sided one-sample normal z test with known strictly positive population standard deviation. |
| chiSquareTest | Pearson goodness-of-fit chi-square statistic for observed and positive expected counts; first argument is number of fitted nuisance parameters. |
| varianceFTest | Two-sided normal-population variance-ratio F test, requiring positive sample variances. |
| anova | One-way fixed-effects F test on independent normal groups with common variance; each group requires n>=2. |
| welchAnova | Welch one-way heteroscedastic F test with Satterthwaite denominator degrees of freedom. |
| kruskalWallis | Tie-corrected Kruskal--Wallis H statistic with chi-square asymptotic calibration. |
| mannWhitney | Mann--Whitney U for the first sample; two-sided tie-corrected normal approximation with continuity correction. |
| wilcoxon | Wilcoxon signed-rank test for differences, dropping zeros and using average absolute tied ranks and continuity-corrected normal calibration. |
| kolmogorovSmirnov | Two-sided KS statistic and asymptotic p value against a fully specified continuous distribution. |
| shapiroWilk | Royston's AS R94 coefficients and normal-tail approximation, n=3..5000, uncensored samples. |
| andersonDarling | Anderson--Darling normality test after fitting the sample mean and unbiased sample standard deviation. |
| levene | One-way ANOVA on absolute deviations; True chooses group medians (Brown--Forsythe), False chooses means. |
| bartlett | Bartlett homogeneity-of-variance test, appropriate for normal samples; positive group variances required. |
| fisherExact | Two-sided Fisher exact test on nonnegative 2-by-2 counts (a,b;c,d). |
| permutationTest | Seeded two-sided random-label permutation p value for a caller statistic, with the (b+1)/(B+1) correction. |
| bonferroni | Bonferroni-adjusted p values in original order, capped at one. |
| benjaminiHochberg | Monotone Benjamini--Hochberg FDR-adjusted p values in original order. |
| cohensD | Difference of sample means divided by pooled unbiased standard deviation. |
| etaSquared | One-way ANOVA explained sum of squares divided by total sum of squares. |
| normalTestPower | Exact power under a known-variance two-sided one-sample normal z-test. |
| normalSampleSize | Smallest integer n whose exact known-variance two-sided normal-test power meets the target; hard budget n<=100000000. |
| tukeyOutliers | Zero-based indices outside [Q1-kIQR,Q3+kIQR], with positive multiplier k and type-7 quartiles. |
| grubbs | Two-sided single-outlier Grubbs test, returning candidate index, G statistic and rejection decision at alpha; normality assumption required. |
| masked | Keep True-mask observations, then validate retained values. |
| huberLocation | Huber M location by iteratively reweighted means, scaled by 1.4826*MAD; zero MAD returns the median. |
HMath.TimeSeries¶
| API | Purpose |
|---|---|
| difference | Apply (1-B^lag)^order. |
| autocorrelation | Biased covariance divided by lag-zero covariance, global sample mean. |
| resample | Linear samples require brackets (or an exact timestamp). |
| crossCorrelation | Corr(x_t,y_(t+lag)), global means and full lag-zero energy normalization. |
| Series | Opaque, validated timestamps paired with optional observations. |
| series | Preserve order and missing values; reject duplicate or nonfinite times. |
| regularSeries | Sample times start+i*step. |
| observations | Extract time-ordered (timestamp,Maybe value) observations from a validated Series. |
| seriesValues | Complete-data conversion never silently drops a missing observation. |
| isRegular | Relative spacing tolerance; fewer than three observations are regular. |
| Alignment | Time-series timestamp join policy: Inner intersection or Outer union,with missing values explicit. |
| Inner | Declaration and type contract below. |
| Outer | Declaration and type contract below. |
| LeftAligned | Declaration and type contract below. |
| align | Exact timestamp equality. |
| Fill | Missing-value strategy selecting forward fill,backward fill,or linear interpolation under the checked boundary rules. |
| ForwardFill | Declaration and type contract below. |
| BackwardFill | Declaration and type contract below. |
| LinearFill | Declaration and type contract below. |
| fillMissing | Directional filling leaves the unavailable leading/trailing end missing. |
| Resampling | Series resampling policy selecting bin means,last-bin values,or linear point samples. |
| LinearSamples | Declaration and type contract below. |
| BinMean | Declaration and type contract below. |
| BinLast | Declaration and type contract below. |
| Rolling | Rolling-window statistic selector for mean,variance,standard deviation,minimum,or maximum. |
| MovingMean | Declaration and type contract below. |
| MovingVariance | Declaration and type contract below. |
| MovingSD | Declaration and type contract below. |
| MovingMinimum | Declaration and type contract below. |
| MovingMaximum | Declaration and type contract below. |
| rolling | Full trailing windows only; variance is population variance (ddof=0). |
| exponentialAverage | Recursive EMA, initialized at the first observation; 0<alpha<=1. |
| weightedAverage | Nonnegative chronological weights: first weight multiplies oldest sample. |
| cumulativeReturns | Cumulative simple return relative to the first strictly positive price. |
| logarithmicReturns | Consecutive log returns, using log prices to avoid ratio overflow. |
| durbinLevinson | Levinson recursion for a positive definite Toeplitz covariance. |
| yuleWalker | Biased sample autocovariances with centered data; returns mean separately. |
| partialAutocorrelation | Given maximum lag then samples, compute ACF and Durbin-Levinson partial correlations, returning lag zero (1) followed by requested PACF lags. |
HMath.TimeSeries.Core¶
| API | Purpose |
|---|---|
| Series | Opaque, validated timestamps paired with optional observations. |
| series | Preserve order and missing values; reject duplicate or nonfinite times. |
| regularSeries | Sample times start+i*step. |
| observations | Extract time-ordered (timestamp,Maybe value) observations from a validated Series. |
| seriesValues | Complete-data conversion never silently drops a missing observation. |
| isRegular | Relative spacing tolerance; fewer than three observations are regular. |
| Alignment | Time-series timestamp join policy: Inner intersection or Outer union,with missing values explicit. |
| Inner | Declaration and type contract below. |
| Outer | Declaration and type contract below. |
| LeftAligned | Declaration and type contract below. |
| align | Exact timestamp equality. |
| Fill | Missing-value strategy selecting forward fill,backward fill,or linear interpolation under the checked boundary rules. |
| ForwardFill | Declaration and type contract below. |
| BackwardFill | Declaration and type contract below. |
| LinearFill | Declaration and type contract below. |
| fillMissing | Directional filling leaves the unavailable leading/trailing end missing. |
| Resampling | Series resampling policy selecting bin means,last-bin values,or linear point samples. |
| LinearSamples | Declaration and type contract below. |
| BinMean | Declaration and type contract below. |
| BinLast | Declaration and type contract below. |
| resample | Linear samples require brackets (or an exact timestamp). |
| Rolling | Rolling-window statistic selector for mean,variance,standard deviation,minimum,or maximum. |
| MovingMean | Declaration and type contract below. |
| MovingVariance | Declaration and type contract below. |
| MovingSD | Declaration and type contract below. |
| MovingMinimum | Declaration and type contract below. |
| MovingMaximum | Declaration and type contract below. |
| rolling | Full trailing windows only; variance is population variance (ddof=0). |
| exponentialAverage | Recursive EMA, initialized at the first observation; 0<alpha<=1. |
| weightedAverage | Nonnegative chronological weights: first weight multiplies oldest sample. |
| cumulativeReturns | Cumulative simple return relative to the first strictly positive price. |
| logarithmicReturns | Consecutive log returns, using log prices to avoid ratio overflow. |
| difference | Apply (1-B^lag)^order. |
| autocorrelation | Biased covariance divided by lag-zero covariance, global sample mean. |
| crossCorrelation | Corr(x_t,y_(t+lag)), global means and full lag-zero energy normalization. |
| durbinLevinson | Levinson recursion for a positive definite Toeplitz covariance. |
| yuleWalker | Biased sample autocovariances with centered data; returns mean separately. |
| partialAutocorrelation | Given maximum lag then samples, compute ACF and Durbin-Levinson partial correlations, returning lag zero (1) followed by requested PACF lags. |
| finite | Test whether Double is neither NaN nor infinite. |
| require | Given predicate then message, return Right () or time-series-prefixed Left InvalidArgument. |
| checked | Return list unchanged when every sample is finite; otherwise return Left NonFiniteResult. |
| validate | Given minimum sample count then list, require length between that minimum and 16384 and all finite values. |
| average | Unchecked arithmetic average using per-term division by list length; empty list returns zero by empty sum. |
HMath.TimeSeries.Diagnostics¶
| API | Purpose |
|---|---|
| Deterministic | Stationarity-test deterministic terms: level-only or linear-trend specification. |
| Level | Declaration and type contract below. |
| LinearTrend | Declaration and type contract below. |
| Stationarity | Significance level paired with critical value. |
| Stationarity | Declaration and type contract below. |
| stationarityStatistic | Computed ADF/KPSS stationarity test statistic. |
| stationarityCriticalValues | Significance-level and critical-value pairs for the selected test/deterministic specification. |
| stationarityObservations | Number of effective observations used by the test. |
| stationarityNull | Human-readable null hypothesis, which differs between ADF and KPSS. |
| augmentedDickeyFuller | OLS of delta x_t on x_(t-1), an intercept, optional trend, and explicitly supplied lagged differences. |
| kpss | KPSS leveltrend stationarity with an explicit BartlettNewey--West lag bandwidth. |
| changePoints | Exact quadratic dynamic programming for piecewise-constant least squares, minimizing total within-segment SSE plus penalty per change. |
| cusum | Two-sided Page CUSUM with supplied baseline mean/SD. |
| anomalies | Median/MAD outliers, using the normal-consistency factor 1.4826022185. |
| DTWResult | Dynamic-time-warping accumulated distance and original-series zero-based alignment path. |
| DTWResult | Declaration and type contract below. |
| dtwDistance | Accumulated dynamic-time-warping path cost. |
| dtwPath | Optimal alignment as zero-based index pairs from the two input series. |
| dynamicTimeWarping | Absolute local cost; Sakoe--Chiba radius must include both endpoints. |
| spectrum | One-sided unwindowed periodogram density. |
| ForecastMetric | Prediction-error metric selector; scale/zero-denominator preconditions are checked by the metric function. |
| MAE | Declaration and type contract below. |
| MSE | Declaration and type contract below. |
| RMSE | Declaration and type contract below. |
| MAPE | Declaration and type contract below. |
| SMAPE | Declaration and type contract below. |
| MASE | Declaration and type contract below. |
| forecastError | MAPE and sMAPE are percentages; zero/zero sMAPE contributes zero. |
HMath.TimeSeries.Models¶
| API | Purpose |
|---|---|
| Smoothing | Exponential smoothing: Simple alpha; Holt alpha beta; HoltWinters period alpha beta gamma. |
| Simple | Declaration and type contract below. |
| Holt | Declaration and type contract below. |
| HoltWinters | Declaration and type contract below. |
| smoothForecast | Fitted one-step means and future means. |
| Decomposition | Additive reconstruction is trend+seasonal+remainder at every input index. |
| Decomposition | Declaration and type contract below. |
| trendComponent | Estimated trend values aligned with original observations. |
| seasonalComponent | Estimated seasonal values aligned with original observations. |
| remainderComponent | Residual values after subtracting trend and seasonality. |
| decompose | Classical additive decomposition with local linear trend smoothing and centered phase means. |
| STLConfig | Seasonal period,odd LOESS windows,and inner/robust iteration counts for STL decomposition. |
| STLConfig | Declaration and type contract below. |
| stlPeriod | Positive seasonal cycle length in observations. |
| stlSeasonalWindow | Odd LOESS window for seasonal subseries. |
| stlTrendWindow | Odd LOESS window for trend smoothing. |
| stlLowPassWindow | Odd low-pass LOESS smoothing window. |
| stlInnerIterations | Number of STL seasonal/trend backfitting passes. |
| stlRobustIterations | Number of robust outer reweighting passes; zero disables robust reweighting. |
| stl | Cleveland-style STL reference backfitting: smooth seasonal subseries by degree-one tricube LOESS with one-cycle extrapolation; remove a period, period, three-point moving-average low-pass followed by LOESS, then smooth the deseasonalized trend. |
| defaultSTLConfig | Given seasonal period, construct STL options with seasonal window 7, odd trend window above 2*period, odd low-pass window at/above period, two inner iterations and no robust outer iterations. stl validates the resulting configuration. |
| ARModel | Intercept followed by lag coefficients; observations stored chronologically. |
| fitAR | Given AR order then finite chronological samples, fit intercept and lag coefficients by checked OLS. |
| arCoefficients | Return AR intercept followed by lag-1 through lag-p coefficients. |
| forecastAR | Given horizon in [0,16384] then fitted AR model, recursively forecast future samples from latest observations. |
| SARIMAOrder | Ordinary (p,d,q),seasonal (P,D,Q),and cycle period s. fitSARIMA validates supported order/sample budgets. |
| SARIMAOrder | Declaration and type contract below. |
| arOrder | Ordinary autoregressive order p. |
| differenceOrder | Ordinary differencing order d. |
| maOrder | Ordinary moving-average order q. |
| seasonalAROrder | Seasonal autoregressive order P. |
| seasonalDifferenceOrder | Seasonal differencing order D. |
| seasonalMAOrder | Seasonal moving-average order Q. |
| seasonalPeriod | Seasonal cycle length s used to place seasonal polynomial lags. |
| ARIMAModel | Opaque fitted ARIMA/SARIMA state with differencing,parameters,innovation residuals,and original history for forecasting. |
| fitARIMA | Given optimization options,p,d,q,then finite chronological series, fit nonseasonal ARIMA through fitSARIMA with seasonal orders zero. |
| fitMA | Given optimization options,MA order q,then samples, fit ARIMA(0,0,q). |
| fitARMA | Given optimization options,AR order p,MA order q,then samples, fit ARIMA(p,0,q). |
| fitSARIMA | Parameters are intercept, ordinary AR, ordinary MA, seasonal AR, seasonal MA. |
| arimaParameters | Return fitted intercept,ordinary AR,ordinary MA,seasonal AR,seasonal MA parameters in that order. |
| arimaResiduals | Return fitted innovation residuals in chronological order, on the model's differenced process. |
| arimaInnovationVariance | Return fitted innovation-variance estimate stored in an ARIMA/SARIMA model. |
| forecastARIMA | Given horizon in [0,16384] then fitted ARIMA/SARIMA model, forecast recursively with future innovations set to zero and undo ordinary/seasonal differencing. |
| VARModel | Opaque fitted vector autoregression with intercept/lag coefficients and chronological multivariate history. |
| fitVAR | Given lag order then chronological multivariate rows, fit response-wise OLS with intercept and lag-major features. |
| varCoefficients | Rows are response components, columns are intercept then lag-major predictors. |
| forecastVAR | Given horizon then VAR model, recursively return future multivariate observation rows. |
| kalmanSeries | Reuse the checked Joseph-form linear Kalman update for each complete observation. |