RainbowStats · Command reference

OPERATOR

Calculate directly with series and lists of series. Build spreads, ratios, percentages and scaled comparisons with ordinary expressions.

Call: OPERATOR() · No arguments · Returns an HTML guide

1. Arithmetic at a glance

In this guide, A, B and S are series; n is a number; L and R are DataLists.

OperationSeries + series/number DataList + series/numberTwo DataLists
Add +A+B · A+nL+S · L+nUnsupported
Subtract -A-B · A-nL-S · L-nUnsupported
Multiply *A*B · A*nL*S · L*nUnsupported
Divide /A/B · A/nL/S · L/nL/R, paired by position
Percent of %A%B · A%nL%S · L%nUnsupported

Series arithmetic returns a series. DataList arithmetic returns a DataList, applying the calculation to each member series.

Put the DataList on the left. Write L*S and L+S. Do not reverse them to S*L or S+L. Operand type determines which implementation handles the expression.

Two-list division: lists must contain the same number of series. The first numerator is divided by the first denominator, the second by the second, and so on. Check their order: there is no matching by country, series name or code.

2. Ratios, percentages and useful formulas

A/B divides A by B. A%B expresses A as a percentage of B. The percent operator means percent of; it is not modulo/remainder and does not mean percentage change over time.

Use RainbowStats' built-in handling of series units and scaling. Do not insert guessed million/billion conversion factors or multiply a percent-of result by 100 again.

Spread=A-B
Ratio=A/B
Share=A%B
Scaled=A/1000
Adjusted=L-A
Shares=L%A
PairwiseRatios=L/R
EXTRACT(Shares,"lastbarchart")

These examples assume the named variables already exist. For a list of country numerators and one common denominator, use L%A. For one denominator per country, first check list order and size, then use L/R. Pairwise percentage arithmetic can use (L/R)*100 when the resulting ratios require conversion to percentages.

Choose the economic meaning: subtract two percent-rate series to obtain a spread in percentage points; percent of answers a different question. Use parentheses for compound formulas and check units, frequencies and dates.

3. Transformations and statistics

The wrappers implement the capabilities below. Java method names identify the implementation; discover the corresponding registered command and its arguments before writing a script.

CapabilityImplementation methodsAvailable on
Logarithm / exponentialgetLog(), getExp()Series and DataList
Difference / log differencegetDiff(), getLogDiff()Series and DataList
Lag / last N observationsgetLag(i), getLast(n)Series and DataList
Sine / cosine / hyperbolic tangentgetSin(), getCos(), getTanh()Series and DataList
Base increasegetBaseIncrease()Series and DataList
Absolute value / power / square rootgetAbs(), getPow(number), getSqrt()Series
Mean / standard deviationgetMean(), getStdDev()Series: number; DataList: column matrix
Skewness / excess kurtosisgetSkew(), getKurtosis()Series: number; DataList: column matrix
CovariancegetCovVar(other)Series: pairwise number; DataList: its own covariance matrix
CorrelationgetCorr(other)Series: pairwise number
Underlying numerical datagetData(), getDataMatrix()Series / DataList respectively, returning a matrix

A DataList transformation operates on its member series. Its scalar summaries return one matrix row per series, in list order. The DataList covariance method ignores its supplied operand and returns the covariance matrix of its own members.

Arithmetic delegates to the underlying series methods. This reference does not promise automatic resampling or a particular missing-data rule. Check observation dates and deliberately convert frequencies where needed.

4. Extract from a series

Use EXTRACT(A,"key"), with one of these keys:

KeyResult
summaryHTML summary statistics
cumulativeCumulative series
diff · logdiffDifference / log-difference series
arimaARIMA analysis slideshow
logisticLog/logistic fitted line chart with error
epicycleEpicycle visualization using the recommended cycle

Each key is a separate choice; do not pass a dot-separated list.

5. Extract from a DataList

Use EXTRACT(L,"key"). Keys are case-insensitive.

KeyResult / behavior
summaryHTML summary table of the member series
linechartLine chart of the list
barchartSequence of period bar-chart panels
animatedbarchartAnimated rolling bar chart
lastbarchartBar chart of the final period after date-range alignment
daily · weekly · monthly · quarterly · annualFilter members by frequency; does not aggregate or resample observations
percentFilter members recognized as percentage series; does not compute percentages
series:0Extract one series using a zero-based index
removeseries:0Return a list with the indexed series removed
setfirst:0Delegate list ordering to setFirst(index); check the resulting order before paired division
units:text or unit:textFilter by units
namecontains:textFilter by name text
endswith:textFilter by series-code suffix
binary_split:y:xBinary split analysis of two members, using zero-based y and x indices
A member's series codeExtract that member series
EXTRACT(L,"summary")
EXTRACT(L,"series:0")
EXTRACT(L,"monthly")
EXTRACT(L,"namecontains:unemployment")
EXTRACT(L,"binary_split:0:1")
EXTRACT(L,"linechart")

Implementation notes: the supplied class advertises fredcode without implementing a dedicated handler. Its slideshow extraction currently falls through to barchart. Use the explicit keys above. Use nonnegative indices smaller than the list size.

For MCP assistants

Use direct arithmetic to compose analyses. Keep a DataList on the left, check the operand types and verify list order before paired division. Prefer % for percent-of calculations. Consult the registered command descriptions for transformations and frequency conversion. The command description contains these rules so they are available during command discovery as well as in this guide.