Function reference
This reference describes every time-series operation (Technical Specification 2.11). Each operation can be chosen in the analysis workspace (operations menu), used in the formula language and in the Excel add-in. The reference is generated from the running system, so it always matches the current version.
How to read: in the syntax “s” is a time series and parameters in square brackets are optional (their default applies). Parameters can be given by position or by name, e.g. change(s, kind="log").
Frequency conversion
Converting monthly, quarterly, annual and other data to another frequency. Worked examples in the user guide →
Convert frequency
TS 2.11.2convert(s, to, [method], [partial])
· operation key convert
Converts the series to another frequency. To a lower frequency (e.g. monthly → quarterly) the values of each period are aggregated. 'Automatic' (default) follows the kind of indicator: flows such as GDP, exports or budget revenue are summed, end-of-period stocks such as debt take the last value, and rates, indices, prices and indicators of unknown kind are averaged; the method applied is shown in the series history. The method can also be chosen: average, sum (flows such as GDP or exports), last value (end-of-period stocks such as debt), first value, maximum or minimum. To a higher frequency (e.g. annual → quarterly) the values are interpolated linearly or with a cubic spline (each value placed at the end of its period), repeated (constant) or distributed equally so that sums are preserved (distribute). Choosing sum, average or last when converting to a higher frequency distributes, repeats or interpolates respectively. Incomplete periods at the start or end are dropped unless 'Include incomplete periods' is ticked. Weeks belong to the month, quarter or year that contains their Thursday (ISO 8601).
| Parameter | Meaning | Type | Default |
|---|---|---|---|
to required |
Target frequency
Allowed values: A – Annual; S – Semi-annual; Q – Quarterly; M – Monthly; W – Weekly; D – Daily
|
frequency (A, S, Q, M, W, D) | — |
method |
Method
Allowed values: auto – Automatic (by the kind of indicator); average – Average; sum – Sum (flows); last – Last value (end-of-period stocks); first – First value; max – Maximum; min – Minimum; linear – Linear interpolation; cubic – Cubic spline interpolation; constant – Repeat the value (constant); distribute – Distribute equally (keeps sums)
|
choice from a list | auto |
partial |
Include incomplete periods Aggregate periods with missing sub-periods from the available values |
yes / no | No |
convert(s1, "Q", "average")convert(s1, "A", "sum")convert(s1, "M", "linear")
Weighted average
Building a weighted average of several series. Worked examples in the user guide →
Weighted average
TS 2.11.3 several serieswavg(s1, s2, …, weights, [normalize])
· operation key weighted_average
Weighted average of several series of the same frequency: Σ wᵢ·sᵢ / Σ wᵢ (weights in the order of the series). With 'Normalise weights' switched off the weighted sum Σ wᵢ·sᵢ is returned. A period is missing if any of the series is missing in it.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
weights required |
Weights (one per series) e.g. 0.6, 0.4 |
list of numbers, e.g. [0.6, 0.4] | — |
normalize |
Normalise weights to sum to 1 | yes / no | Yes |
wavg(s1, s2, weights=[0.6, 0.4])wavg(s1, s2, s3, weights=[1, 2, 1], normalize=false)
Lag and lead
Shifting a series along the time axis (lag and lead operators). Worked examples in the user guide →
Lag
TS 2.11.4lag(s, [n])
· operation key lag
Moves the series n periods later in time: the value at period t equals the original value at t − n (the whole series is kept and ends n periods later). A negative n works as a lead.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
n |
Number of periods
≥ -10000, ≤ 10000 |
integer | 1 |
lag(s1, 1)lag(s1, 4)
Lead
TS 2.11.4lead(s, [n])
· operation key lead
Moves the series n periods earlier in time: the value at period t equals the original value at t + n. A negative n works as a lag.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
n |
Number of periods
≥ -10000, ≤ 10000 |
integer | 1 |
lead(s1, 1)lead(s1, 12)
Comparing periods
Comparing different periods of the same series. Worked examples in the user guide →
Shift by years
TS 2.11.5shiftyears(s, [years])
· operation key shift_years
Moves the whole series n years forward on the time axis (backwards if n is negative), so that different years of the same series can be overlaid in one chart or table, e.g. this year's monthly path against last year's (shift_years(s, 1)).
| Parameter | Meaning | Type | Default |
|---|---|---|---|
years |
Years
≥ -200, ≤ 200 |
integer | 1 |
shiftyears(s1, 1)shiftyears(s1, -1)
Period selection
Restricting a series to a chosen period. Worked examples in the user guide →
Select period
TS 2.11.5window(s, [start], [end])
· operation key window
Keeps only the observations from the start to the end period (inclusive); either bound may be left empty. Combined with Shift by years and statistics it compares different periods of the same series. Periods may be written as 2008, 2008-S1, 2008-Q1, 2008-03, 2008-W10 or 2008-03-15; a year selects all its quarters, months or days.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
start |
Start period e.g. 2008-Q1 |
period (e.g. 2019-Q4) | automatic |
end |
End period e.g. 2012-Q4 |
period (e.g. 2019-Q4) | automatic |
window(s1, "2008-Q1", "2012-Q4")window(s1, "2015")
Aggregation
Rolling and cumulative sums, averages and aggregates of several series. Worked examples in the user guide →
Cumulative
TS 2.11.6cumulative(s, [func], [reset])
· operation key cumulative
Accumulates the values over time: cumulative sum, product, running maximum, minimum or average. With restart 'every year' the accumulation starts again each calendar year (year-to-date). A missing value interrupts a sum, product or average (until the next year when restarting yearly); fill gaps first if needed.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
func |
Function
Allowed values: sum – Sum; product – Product; max – Maximum; min – Minimum; mean – Average
|
choice from a list | sum |
reset |
Start again
Allowed values: none – Never; year – Every year (year-to-date)
|
choice from a list | none |
cumulative(s1, "sum")cumulative(s1, "sum", "year")
Maximum of series
TS 2.11.6 several seriesmax(s1, s2, …)
· operation key max_series
Largest value of several series of the same frequency in each period (missing if any series is missing in that period).
max(s1, s2)
Average of series
TS 2.11.6 several seriesmean(s1, s2, …, [skipna])
· operation key mean_series
Simple (unweighted) average of several series of the same frequency, period by period. By default a period is missing if any series is missing; with 'Ignore missing values' the available values are averaged.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
skipna |
Ignore missing values Use the available series when some are missing in a period |
yes / no | No |
mean(s1, s2)mean(s1, s2, s3, skipna=true)
Minimum of series
TS 2.11.6 several seriesmin(s1, s2, …)
· operation key min_series
Smallest value of several series of the same frequency in each period (missing if any series is missing in that period).
min(s1, s2)
Rolling window
TS 2.11.6rolling(s, [window], [func], [min_periods])
· operation key rolling
At each period aggregates the last n observations (trailing window): moving average, moving sum, minimum, maximum, median or standard deviation, e.g. the 12-month moving sum of monthly exports. By default the full window must have values.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
window |
Window length (periods)
≥ 1, ≤ 10000 |
integer | 4 |
func |
Function
Allowed values: mean – Average; sum – Sum; min – Minimum; max – Maximum; median – Median; std – Standard deviation
|
choice from a list | mean |
min_periods |
Minimum observations in window Empty = the full window ≥ 1 |
integer | automatic |
rolling(s1, 12, "sum")rolling(s1, 4)rolling(s1, 12, "std")
Sum of series
TS 2.11.6 several seriessum(s1, s2, …, [skipna])
· operation key sum_series
Adds several series of the same frequency period by period (e.g. the sum of regional or sectoral components). By default a period is missing if any series is missing; with 'Ignore missing values' the available values are added.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
skipna |
Ignore missing values Use the available series when some are missing in a period |
yes / no | No |
sum(s1, s2, s3)sum(s1, s2, skipna=true)
Year to date
TS 2.11.6ytd(s, [func])
· operation key ytd
Cumulative sum or average from the beginning of each calendar year, e.g. budget revenue since January. A year whose earlier periods are missing has no year-to-date values.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
func |
Function
Allowed values: sum – Sum; mean – Average
|
choice from a list | sum |
ytd(s1, "sum")ytd(s1, "mean")
Changes
Absolute, percentage and logarithmic changes, including changes relative to a reference point. Worked examples in the user guide →
Change
TS 2.11.7change(s, [kind], [horizon], [n], [annualize])
· operation key change
Change over a chosen horizon: absolute (x_t − x_{t−k}), percentage (100·(x_t / x_{t−k} − 1)), logarithmic (ln x_t − ln x_{t−k}), logarithmic × 100 or ratio (x_t / x_{t−k}). The horizon is the previous period, a month, a quarter, a year or a custom number of periods; k = n × horizon. 'Annualise' expresses the change as an annual rate (compounded for percentage changes and ratios). For daily data the previous observation is used, and month/quarter/year horizons use the last observation on or before the same date.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
kind |
Type of change
Allowed values: abs – Absolute; pct – Percentage (%); log – Logarithmic (Δln); log_pct – Logarithmic × 100; ratio – Ratio
|
choice from a list | pct |
horizon |
Compared with
Allowed values: period – Previous period; month – Month earlier; quarter – Quarter earlier; year – Year earlier (same period); custom – n periods earlier
|
choice from a list | period |
n |
Number of horizons n k = n × horizon ≥ 1, ≤ 10000 |
integer | 1 |
annualize |
Annualise Express the change as an annual rate |
yes / no | No |
change(s1, "pct", "year")change(s1, "abs", "period")change(s1, "log_pct", "quarter", 1, true)
Change from reference period
TS 2.11.7changeref(s, ref, [kind])
· operation key change_ref
Change of every value relative to the value at a chosen reference period, e.g. 2019-Q4 as the pre-pandemic level: percentage, absolute, ratio or logarithmic. If the reference is a longer period than the data (e.g. a year for quarterly data), its average is used.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
ref required |
Reference period e.g. 2019-Q4 or 2019 |
period (e.g. 2019-Q4) | — |
kind |
Type of change
Allowed values: pct – Percentage (%); abs – Absolute; ratio – Ratio; log – Logarithmic (Δln)
|
choice from a list | pct |
changeref(s1, "2019-Q4", "pct")changeref(s1, "2019", "abs")
Difference
TS 2.11.7diff(s, [n])
· operation key diff
Absolute change from n periods earlier: x_t − x_{t−n} (for daily data: n observations earlier).
| Parameter | Meaning | Type | Default |
|---|---|---|---|
n |
Number of periods
≥ 1, ≤ 10000 |
integer | 1 |
diff(s1)diff(s1, 4)
Logarithmic change
TS 2.11.7logdiff(s, [n], [scale])
· operation key log_diff
Logarithmic change scale·(ln x_t − ln x_{t−n}); with the default scale 100 it approximates the percentage change. Zero or negative values give empty results.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
n |
Number of periods
≥ 1, ≤ 10000 |
integer | 1 |
scale |
Scale factor | number | 100.0 |
logdiff(s1)logdiff(s1, 12)logdiff(s1, 1, 1)
Month-on-month change, %
TS 2.11.7mom(s)
· operation key pct_mom
Percentage change from the previous month: 100·(x_t / x_{t−1} − 1). Monthly data only.
mom(s1)
Quarter-on-quarter change, %
TS 2.11.7qoq(s, [annualize])
· operation key pct_qoq
Percentage change from the previous quarter; for monthly data the change from three months earlier. Optionally annualised: 100·((x_t / x_{t−1})⁴ − 1).
| Parameter | Meaning | Type | Default |
|---|---|---|---|
annualize |
Annualise Express the change as an annual rate |
yes / no | No |
qoq(s1)qoq(s1, true)
Year-on-year change, %
TS 2.11.7yoy(s)
· operation key pct_yoy
Percentage change from the same period of the previous year: 100·(x_t / x_{t−p} − 1), where p is the number of periods per year. Works for every frequency; daily data are compared with the last observation on or before the same date a year earlier.
yoy(s1)
Indices
Converting values into an index with a chosen base period. Worked examples in the user guide →
Convert to index
TS 2.11.8rebase(s, base_start, [base_end], [value])
· operation key rebase
Converts the values into an index: value · x_t / (average of x over the base period), e.g. 2015 = 100. The base can be a single period (2015, 2015-Q1) or a range from start to end.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
base_start required |
Base period (start) e.g. 2015 |
period (e.g. 2019-Q4) | — |
base_end |
Base period end (optional) | period (e.g. 2019-Q4) | automatic |
value |
Index value in the base period | number | 100.0 |
rebase(s1, "2015")rebase(s1, "2015", "", 100)rebase(s1, "2019-Q1", "2019-Q4", 1)
Trend
Extracting the trend of a series. Worked examples in the user guide →
Trend
TS 2.11.9trend(s, [method], [lam], [window])
· operation key trend
Estimates the trend of the series: a linear, quadratic or log-linear (exponential) time trend fitted by least squares, the Hodrick–Prescott filter (λ by frequency: annual 100, quarterly 1600, monthly 129 600) or a centred moving average (2×12 for monthly and 2×4 for quarterly data by default).
| Parameter | Meaning | Type | Default |
|---|---|---|---|
method |
Method
Allowed values: linear – Linear time trend; quadratic – Quadratic time trend; loglinear – Log-linear (exponential) trend; hp – Hodrick–Prescott filter; moving_average – Centred moving average
|
choice from a list | hp |
lam |
Smoothing parameter λ Empty = by frequency (annual 100, quarterly 1600, monthly 129 600) ≥ 0 |
number | automatic |
window |
Moving-average length Empty = one year of periods ≥ 1, ≤ 10000 |
integer | automatic |
trend(s1, "hp")trend(s1, "linear")trend(s1, "moving_average", window=12)
Cyclical component
Extracting the cyclical component of a series. Worked examples in the user guide →
Cyclical component
TS 2.11.10cycle(s, [method], [lam], [low], [high], [k], [output])
· operation key cycle
Extracts the cyclical component: deviation from the Hodrick–Prescott trend, the Baxter–King or Christiano–Fitzgerald band-pass filter (cycles between the shortest and longest length, by default 1.5–8 years), the Hamilton (2018) regression filter (horizon h = 2 years, p = 1 year of lags) or the deviation from a linear trend. The '% deviation from trend' output gives the percentage deviation (computed on 100·ln x). Baxter–King leaves the first and last k observations empty (default k = 3 years), Hamilton the first h + p − 1. Band-pass and Hamilton filters need annual, semi-annual, quarterly or monthly data.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
method |
Method
Allowed values: hp – Hodrick–Prescott filter; bk – Baxter–King band-pass filter; cf – Christiano–Fitzgerald band-pass filter; hamilton – Hamilton regression filter; linear – Deviation from linear trend
|
choice from a list | hp |
lam |
Smoothing parameter λ Empty = by frequency (annual 100, quarterly 1600, monthly 129 600) ≥ 0 |
number | automatic |
low |
Shortest cycle (years)
≥ 0.01 |
number | 1.5 |
high |
Longest cycle (years)
≥ 0.01 |
number | 8.0 |
k |
Filter length k Baxter–King: leads/lags (default 3 years); Hamilton: horizon h (default 2 years) ≥ 1, ≤ 10000 |
integer | automatic |
output |
Output
Allowed values: abs – Deviation in the series' units; pct – % deviation from trend
|
choice from a list | abs |
cycle(s1, "hp")cycle(s1, "bk", low=1.5, high=8)cycle(s1, "hamilton", output="pct")
Seasonal adjustment
Removing seasonal effects (X-13ARIMA-SEATS, STL). Worked examples in the user guide →
Seasonal adjustment
TS 2.11.11sa(s, [method], [mode], [output])
· operation key seasonal_adjust
Removes seasonal effects from monthly or quarterly data. X-13ARIMA-SEATS (US Census Bureau: automatic ARIMA model, outlier detection, X-11 decomposition) is used when it is available on the server; otherwise, or when X-13 cannot adjust the series (it needs at least three full years), STL (seasonal-trend decomposition using LOESS) is used and the series history states this. 'Classical' is the ratio-to-moving-average method. Results: seasonally adjusted series, seasonal component, trend-cycle or irregular component. The multiplicative model suits positive series whose seasonal swings grow with the level; 'automatic' lets X-13 choose (STL and classical: multiplicative for positive series). At least two full years of data without gaps are required.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
method |
Method
Allowed values: x13 – X-13ARIMA-SEATS; stl – STL (LOESS decomposition); classical – Classical (ratio to moving average)
|
choice from a list | x13 |
mode |
Model
Allowed values: auto – Automatic; multiplicative – Multiplicative; additive – Additive
|
choice from a list | auto |
output |
Result
Allowed values: sa – Seasonally adjusted series; seasonal – Seasonal component; trend – Trend-cycle; irregular – Irregular component
|
choice from a list | sa |
sa(s1, "x13")sa(s1, "stl", "multiplicative")sa(s1, "x13", output="seasonal")
Smoothing
Smoothing by various methods, including the Hodrick–Prescott filter. Worked examples in the user guide →
Hodrick–Prescott filter
TS 2.11.12TS 2.11.9TS 2.11.10hp(s, [lam], [output])
· operation key hp_filter
Hodrick–Prescott filter with smoothing parameter λ (empty = by frequency: annual 100, quarterly 1600, monthly 129 600). Returns the smooth trend or the cycle (series minus trend).
| Parameter | Meaning | Type | Default |
|---|---|---|---|
lam |
Smoothing parameter λ Empty = by frequency (annual 100, quarterly 1600, monthly 129 600) ≥ 0 |
number | automatic |
output |
Output
Allowed values: trend – Trend; cycle – Cycle
|
choice from a list | trend |
hp(s1)hp(s1, 1600, "trend")hp(s1, 1600, "cycle")
Smoothing
TS 2.11.12smooth(s, [method], [window], [alpha], [frac], [lam])
· operation key smooth
Smooths the series with one of several methods: moving average of the last n observations, centred moving average (2×n for even n), exponential smoothing (factor α, default 2/(n+1)), LOESS local regression (share of observations used in each fit, default 0.25), the Hodrick–Prescott filter (λ) or the Henderson moving average (n terms, odd; default 13 for monthly and 5 for quarterly data).
| Parameter | Meaning | Type | Default |
|---|---|---|---|
method |
Method
Allowed values: ma – Moving average (last n); centered_ma – Centred moving average; ewma – Exponential smoothing; loess – LOESS local regression; hp – Hodrick–Prescott filter; henderson – Henderson moving average
|
choice from a list | ma |
window |
Window length n
≥ 1, ≤ 10000 |
integer | 3 |
alpha |
Smoothing factor α (0–1) Exponential smoothing; empty = 2/(n+1) ≥ 0, ≤ 1 |
number | automatic |
frac |
LOESS share of observations (0–1) Empty = 0.25 ≥ 0, ≤ 1 |
number | automatic |
lam |
Smoothing parameter λ Empty = by frequency (annual 100, quarterly 1600, monthly 129 600) ≥ 0 |
number | automatic |
smooth(s1, "ma", 3)smooth(s1, "centered_ma", 12)smooth(s1, "ewma", alpha=0.3)smooth(s1, "loess", frac=0.2)smooth(s1, "henderson", 13)
Arithmetic
Arithmetic calculations with time series. Worked examples in the user guide →
Absolute value
TS 2.11.13abs(s)
· operation key abs
Absolute value |x| of every value: negative values become positive.
abs(s1)
Add a number
TS 2.11.13add(s, value)
· operation key add
Adds a constant to every value: x + value. Series can also be added to each other in formulas (s1 + s2).
| Parameter | Meaning | Type | Default |
|---|---|---|---|
value required |
Number | number | — |
add(s1, 5)s1 + 5
Divide by a number
TS 2.11.13divide(s, value)
· operation key divide
Divides every value by a non-zero constant: x / value.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
value required |
Number | number | — |
divide(s1, 1000)s1 / 1000
Exponential (eˣ)
TS 2.11.13exp(s)
· operation key exp
Exponential function eˣ – the inverse of the natural logarithm.
exp(log(s1))
Natural logarithm
TS 2.11.13log(s)
· operation key log
Natural logarithm ln(x). Zero and negative values give empty results.
log(s1)
Base-10 logarithm
TS 2.11.13log10(s)
· operation key log10
Base-10 logarithm log₁₀(x). Zero and negative values give empty results.
log10(s1)
Multiply by a number
TS 2.11.13multiply(s, value)
· operation key multiply
Multiplies every value by a constant: x · value.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
value required |
Number | number | — |
multiply(s1, 100)s1 * 100
Change sign
TS 2.11.13negate(s)
· operation key negate
Changes the sign of every value: −x.
negate(s1)
Raise to a power
TS 2.11.13power(s, value)
· operation key power
Raises every value to a power: x^value. Results that are not real numbers (e.g. a fractional power of a negative value) are left empty.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
value required |
Exponent | number | — |
power(s1, 2)s1 ** 0.5
Reciprocal (1/x)
TS 2.11.13reciprocal(s)
· operation key reciprocal
Reciprocal 1/x, e.g. to invert an exchange rate (EUR per USD → USD per EUR). Zero values give empty results.
reciprocal(s1)
Round
TS 2.11.13round(s, [digits])
· operation key round
Rounds every value to the given number of decimal places; halves (e.g. 2.5) are rounded away from zero, as in Excel. A negative number of places rounds to tens, hundreds, … (−2 → nearest 100).
| Parameter | Meaning | Type | Default |
|---|---|---|---|
digits |
Decimal places
≥ -15, ≤ 15 |
integer | 0 |
round(s1, 1)
Scale (convert units)
TS 2.11.13scale(s, factor, [unit])
· operation key scale
Multiplies the series by a factor to change its unit, e.g. 0.001 converts millions to billions. Optionally sets the name of the new unit.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
factor required |
Factor | number | — |
unit |
New unit (optional) e.g. EUR billion |
text | automatic |
scale(s1, 0.001, "EUR billion")scale(s1, 100)
Square root
TS 2.11.13sqrt(s)
· operation key sqrt
Square root √x. Negative values give empty results.
sqrt(s1)
Subtract a number
TS 2.11.13subtract(s, value)
· operation key subtract
Subtracts a constant from every value: x − value.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
value required |
Number | number | — |
subtract(s1, 2)s1 - 2
Other transformations
Filling gaps, annualising and more. Worked examples in the user guide →
Annualise
TS 2.11.7annualize(s, [kind])
· operation key annualize
Expresses period values as annual rates: 'multiply' multiplies by the number of periods per year (e.g. a quarterly flow × 4, as in seasonally adjusted annual rates); 'compound' compounds a percentage growth rate over a year: 100·((1 + x/100)^p − 1).
| Parameter | Meaning | Type | Default |
|---|---|---|---|
kind |
Method
Allowed values: sum – Multiply by periods per year; compound – Compound a growth rate (%)
|
choice from a list | sum |
annualize(s1)annualize(qoq(s1), "compound")
Fill missing values
TS 2.11.1fill(s, [method], [limit])
· operation key fill
Fills gaps inside the series by linear interpolation, with the previous value, the next value or zero. 'Maximum consecutive values' limits how many missing values in a row are filled. No values are created before the first or after the last observation. For daily data this also fills non-trading days (weekends, holidays).
| Parameter | Meaning | Type | Default |
|---|---|---|---|
method |
Method
Allowed values: linear – Linear interpolation; ffill – Previous value; bfill – Next value; zero – Zero
|
choice from a list | linear |
limit |
Maximum consecutive values to fill Empty = fill all gaps ≥ 1 |
integer | automatic |
fill(s1, "linear")fill(s1, "ffill", 2)
Other formula-language functions
Besides the operations, formulas can use the following functions, constants and operators. Formula language guide →
Database series
S("key")
Loads any series from the MacroLens database by its key. The key is shown on the series page and in the search results; it must be written in quotes.
S("ESTAT/namq_10_gdp/Q.CLV10_MEUR.SCA.B1GQ.LT")yoy(S("ESTAT/namq_10_gdp/Q.CLV10_MEUR.SCA.B1GQ.LT"))
Saved series
U("code")
Loads a series that you saved in your library (or that was shared with you) by its code, written in quotes.
U("my_series")U("my_series") / S("ESTAT/namq_10_gdp/Q.CLV10_MEUR.SCA.B1GQ.LT")
Addition
a + b
Adds series or numbers. Series are matched period by period; if a value is missing in either series, the result for that period is missing too.
s1 + s2s1 + 100
Subtraction
a - b
Subtracts series or numbers, period by period.
s1 - s2s1 - lag(s1, 1)
Multiplication
a * b
Multiplies series or numbers, period by period.
s1 * 1000s1 * s2
Division
a / b
Divides series or numbers, period by period. Division by zero gives a missing value.
s1 / s2 * 100s1 / 1000
Power
a ** b
Raises to a power. The ^ sign can be used instead of **.
s1 ** 2(s1 / lag(s1, 4)) ^ 0.25
Change of sign
-a
Changes the sign of a series or number.
-s1
Brackets
(a + b) * c
Group parts of a formula. Order of operations: powers first, then multiplication and division, then addition and subtraction. Series combined with operators must have the same frequency; use convert() otherwise.
(s1 + s2) / 2
Replace missing values
if_missing(s, value)
Replaces the missing observations of a series with a number or with the values of another series of the same frequency for the same periods.
if_missing(s1, 0)if_missing(s1, s2)
Number π
pi
The number π (3.14159…).
s1 * pi
Number e
e
Euler's number e (2.71828…), the base of the natural logarithm.
e ** (s1 / 100)
Statistical analysis
Statistical analyses are run in the Statistics tab of the analysis workspace and saved with the analysis (Technical Specification 2.11.15).
Correlation analysis
TS 2.11.15.1Pearson, Spearman or Kendall correlation matrix of two or more series over their common periods, with p-values, number of observations and 95% confidence intervals (Pearson).
Select two or more series of the same frequency.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
method |
Correlation coefficient Pearson measures linear association; Spearman and Kendall are rank correlations that are robust to outliers and to non-linear monotonic relationships. Allowed values: pearson – Pearson; spearman – Spearman (rank); kendall – Kendall tau-b (rank)
|
choice from a list | pearson |
sample |
Observations used Common sample: only periods in which all selected series have values. Pairwise: for each pair, all periods in which both series have values. Allowed values: common – Common sample of all series; pairwise – Pairwise
|
choice from a list | common |
Cross-correlation
TS 2.11.15.1Correlation between series X shifted by k periods and series Y, for k = −K…K: shows which series leads and by how many periods.
Select exactly two series of the same frequency: first X, then Y.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
max_lag |
Maximum shift K (periods) Correlations are computed for shifts k = −K…K. Leave empty for an automatic value based on the frequency and the sample length. ≥ 1, ≤ 60 |
integer | automatic |
method |
Correlation coefficient Pearson measures linear association; Spearman and Kendall are rank correlations that are robust to outliers. Allowed values: pearson – Pearson; spearman – Spearman (rank); kendall – Kendall tau-b (rank)
|
choice from a list | pearson |
Descriptive statistics and standard deviation
TS 2.11.15.2Number of observations, mean, standard deviation (sample and population), variance, coefficient of variation, minimum, maximum, quartiles, median, skewness, kurtosis, Jarque–Bera normality test, first and last period of each series.
Select one or more series.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
common_sample |
Use only periods common to all series If ticked, statistics are computed only over periods in which all selected series have values (the series must have the same frequency). |
yes / no | No |
Linear regression – simple or multiple (OLS)
TS 2.11.15.3TS 2.11.15.4Simple (one explanatory variable) or multiple linear regression estimated by ordinary least squares: coefficients with standard errors, t-statistics, p-values and 95% confidence intervals, R², adjusted R², F-test, Durbin–Watson statistic, AIC, BIC, residual diagnostics, fitted values and residuals.
The first series is the dependent variable; the following series are the explanatory variables (one for a simple regression, several for a multiple regression).
| Parameter | Meaning | Type | Default |
|---|---|---|---|
constant |
Include a constant Recommended. Without a constant, R² is uncentred and not comparable with models that include one. |
yes / no | Yes |
trend |
Include a linear time trend Adds a deterministic trend (1, 2, 3, …) as an explanatory variable. |
yes / no | No |
lags |
Lags of explanatory variables Also include each explanatory variable lagged by 1…L periods (distributed lag model). 0 = values of the same period only. ≥ 0, ≤ 12 |
integer | 0 |
dep_lags |
Lags of the dependent variable Include the dependent variable lagged by 1…L periods as additional explanatory variables. ≥ 0, ≤ 12 |
integer | 0 |
cov_type |
Standard errors Classical OLS standard errors, White heteroskedasticity-robust (HC1) or Newey–West heteroskedasticity- and autocorrelation-consistent (HAC). Allowed values: nonrobust – Classical (OLS); hc1 – White, heteroskedasticity-robust (HC1); hac – Newey–West (HAC)
|
choice from a list | nonrobust |
Vector autoregression (VAR)
TS 2.11.15.5VAR model of two or more series: lag order selection (AIC, BIC, HQIC, FPE), coefficients of every equation, stability, Granger causality tests, impulse responses, forecast error variance decomposition and forecasts.
Select two to eight series of the same frequency. Their order matters for the orthogonalised impulse responses (Cholesky ordering).
| Parameter | Meaning | Type | Default |
|---|---|---|---|
lags |
Lag order p Leave empty to select the lag order automatically with the chosen information criterion. ≥ 1, ≤ 24 |
integer | automatic |
ic |
Lag selection criterion Information criterion used to choose the lag order when it is not fixed. Allowed values: aic – Akaike (AIC); bic – Schwarz / Bayesian (BIC); hqic – Hannan–Quinn (HQIC); fpe – Final prediction error (FPE)
|
choice from a list | aic |
max_lags |
Maximum lag for selection Largest lag order considered by the selection. Leave empty for an automatic value based on the frequency and the sample length. ≥ 1, ≤ 24 |
integer | automatic |
trend |
Deterministic terms Terms included in every equation. Allowed values: c – Constant; ct – Constant and linear trend; n – None
|
choice from a list | c |
horizon |
Horizon h (periods) Number of periods for impulse responses, variance decomposition and forecasts. Leave empty for an automatic value (e.g. 8 quarters, 12 months). ≥ 1, ≤ 60 |
integer | automatic |
irf_bands |
Show 95% confidence bands of impulse responses Asymptotic (analytic) standard errors. |
yes / no | Yes |
Principal component analysis (PCA)
TS 2.11.15.6Principal components of two or more series over their common periods (standardised data by default): eigenvalues, share of explained variance, loadings and component series.
Select two or more series of the same frequency.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
n_components |
Number of components Number of components shown in the loading tables and returned as series. Leave empty for all. ≥ 1, ≤ 30 |
integer | automatic |
standardize |
Standardise the series Recommended when the series have different units: the analysis then uses the correlation matrix. Without standardisation the covariance matrix is used. |
yes / no | Yes |
Unit root tests
TS 2.11.15.7Augmented Dickey–Fuller (ADF), Phillips–Perron (PP) and KPSS stationarity tests: test statistics, p-values, critical values and a plain-language conclusion.
Select one or more series; each is tested separately.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
test |
Tests Run all three tests or a single one. Allowed values: all – All (ADF, PP, KPSS); adf – Augmented Dickey–Fuller (ADF); pp – Phillips–Perron (PP); kpss – KPSS
|
choice from a list | all |
regression |
Deterministic terms Constant: stationarity around a constant mean. Constant and trend: around a linear trend. None: no constant (ADF and PP only). Allowed values: c – Constant; ct – Constant and linear trend; n – None
|
choice from a list | c |
order |
Test the series in Test the levels or the first or second differences (e.g. to check whether a series is integrated of order one). Allowed values: level – Levels; diff1 – First differences; diff2 – Second differences
|
choice from a list | level |
ic |
ADF lag selection Criterion for choosing the number of lagged differences in the ADF regression, or a fixed number. Allowed values: aic – Akaike (AIC); bic – Schwarz / Bayesian (BIC); tstat – t-statistic of the last lag; fixed – Fixed (= maximum lags)
|
choice from a list | aic |
max_lags |
ADF maximum lags Maximum number of lagged differences (or the fixed number). Leave empty for 12·(n/100)^¼. ≥ 0, ≤ 60 |
integer | automatic |
pp_lags |
PP bandwidth Newey–West bandwidth (Bartlett kernel) of the Phillips–Perron test. Leave empty for automatic selection. ≥ 0, ≤ 60 |
integer | automatic |
kpss_lags |
KPSS bandwidth Newey–West bandwidth (Bartlett kernel) of the KPSS test. Leave empty for automatic selection. ≥ 0, ≤ 60 |
integer | automatic |
Comparison of periods
TS 2.11.5Compares two or more periods of the same series side by side: number of observations, mean, median, standard deviation, minimum, maximum, total change and average annual growth rate.
Select one series and enter the periods to compare.
| Parameter | Meaning | Type | Default |
|---|---|---|---|
periods required |
Periods to compare Two or more periods separated by semicolons, each written as start:end, e.g. 2008-Q1:2012-Q4; 2015-Q1:2019-Q4 (annual data: 2005:2009; 2015:2019). |
text | — |
No functions match the filter.