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.
| Operation | Series + series/number | DataList + series/number | Two DataLists |
|---|---|---|---|
Add + | A+B · A+n | L+S · L+n | Unsupported |
Subtract - | A-B · A-n | L-S · L-n | Unsupported |
Multiply * | A*B · A*n | L*S · L*n | Unsupported |
Divide / | A/B · A/n | L/S · L/n | L/R, paired by position |
Percent of % | A%B · A%n | L%S · L%n | Unsupported |
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.
| Capability | Implementation methods | Available on |
|---|---|---|
| Logarithm / exponential | getLog(), getExp() | Series and DataList |
| Difference / log difference | getDiff(), getLogDiff() | Series and DataList |
| Lag / last N observations | getLag(i), getLast(n) | Series and DataList |
| Sine / cosine / hyperbolic tangent | getSin(), getCos(), getTanh() | Series and DataList |
| Base increase | getBaseIncrease() | Series and DataList |
| Absolute value / power / square root | getAbs(), getPow(number), getSqrt() | Series |
| Mean / standard deviation | getMean(), getStdDev() | Series: number; DataList: column matrix |
| Skewness / excess kurtosis | getSkew(), getKurtosis() | Series: number; DataList: column matrix |
| Covariance | getCovVar(other) | Series: pairwise number; DataList: its own covariance matrix |
| Correlation | getCorr(other) | Series: pairwise number |
| Underlying numerical data | getData(), 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:
| Key | Result |
|---|---|
summary | HTML summary statistics |
cumulative | Cumulative series |
diff · logdiff | Difference / log-difference series |
arima | ARIMA analysis slideshow |
logistic | Log/logistic fitted line chart with error |
epicycle | Epicycle 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.
| Key | Result / behavior |
|---|---|
summary | HTML summary table of the member series |
linechart | Line chart of the list |
barchart | Sequence of period bar-chart panels |
animatedbarchart | Animated rolling bar chart |
lastbarchart | Bar chart of the final period after date-range alignment |
daily · weekly · monthly · quarterly · annual | Filter members by frequency; does not aggregate or resample observations |
percent | Filter members recognized as percentage series; does not compute percentages |
series:0 | Extract one series using a zero-based index |
removeseries:0 | Return a list with the indexed series removed |
setfirst:0 | Delegate list ordering to setFirst(index); check the resulting order before paired division |
units:text or unit:text | Filter by units |
namecontains:text | Filter by name text |
endswith:text | Filter by series-code suffix |
binary_split:y:x | Binary split analysis of two members, using zero-based y and x indices |
| A member's series code | Extract 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.