Detrend

Overview

The Detrend analysis removes trends from time series by either subtracting or dividing, depending on the chosen method. This is useful when you want to concentrate on the cyclical component of a series.

The cyclical component is one of four components of a time series. It refers to (regular or periodic) fluctuations around the trend, excluding the irregular component, revealing a succession of phases of expansion and contraction.

Settings

Method

Here, you can define which statistical measure should be used as the trend that will be removed. The available measures are:

  • Mean
  • Median
  • Min
  • Max
  • Linear trend
  • Exponential trend

Operation

This is the calculation that will be used to remove the trend. For the linear and exponential trend methods, you can select between subtract (the statistical measure will be subtracted from the time series) and multiply (the series will be divided by the statistical measure). For the other methods, subtract is the chosen operation.

From & To

You can set a date range for removing a trend.

Examples

United States GDP detrend

In this example, we subtracted the linear trend from the US real GDP (expressed in log).

Detrend median

Here, we used median as the trend to subtract from the series.

Questions

How to find a trend with Detrend analysis?

Detrend finds cyclical component of time series. To see a trend use Statistics analysis with 'Method: Trend' before adding Detrend.

Rebase

Overview

To index or compare series with different scales, one way to make the comparison easier is to apply Rebase analysis. It also allows you to show the change from a specific date.

Method

The Rebase analysis allows you to attribute a base value – usually 100 – at a specific point in time for the time series and calculates all observations relative to your chosen reference point as in: (x/xt)*100. In other words, the analysis performs a multiplicative scaling of the series from the date you have chosen.

Negative values

When xt (in (x/xt)*100) is a negative number, the series is multiplied and divided by negative number - making all of the negative numbers positive and other way around.

Settings

Absolute Method

Assigns a base value at a specific point in time by which all observations are calculated.

Relative Method

Assigns a base value equal to another series at a specified point in time. Useful when you want to compare a time series to another one without changing the scale on all of them.

Point in time

This refers to the date at which the base value is assigned.

The way the date is entered may affect the calculation:

  • Absolute date: typing the year only (i.e., '2000') as the point in time for a series with a higher frequency than annual will rebase the series using the average value of the year. This principle is also applied if you type only the year and month (i.e., '2000-01') to rebase a series with a higher frequency than monthly: the rebase will then be performed using the average value of the month.
  • Relative date: you can rebase series using a relative date. For instance, typing '-5y' will rebase the series 5 years prior to its last observation (or prior last observation in common calendar if there are more series). The base date will therefore change every time a new value is available.

If you do not specify a point in time, Macrobond will use the first observation of the series as base value.

Examples

Absolute rebase

This document compares the GDP of several Euro Area countries by rebasing all series to Q1 2008 at 100. This provides an indication of how the GDP of these countries has recovered from pre-crisis levels

Relative rebase

This example compares two equity indices: the FTSE 100 and the S&P 500.

Since these series have different scales, one way to compare them would be to rebase the FTSE 100 relative to the value of the S&P 500 on January 1st 2000 (meaning that we will assign to the FTSE 100 the value of the S&P 500 on January 1st 2000, and rebase it accordingly).

Rebase starting from 0

It's not possible to set '0' in Rebase analysis but using Statistics and Arithmetic you can achieve this.

Note, it is also possible to recreate such analysis in Slice with Additive rebase with base value functionality.

Aggregate

Overview

The Aggregate analysis transforms a time series so that the values are summed either periodically (each year for instance) or continuously, starting from a specified date. Aggregate is useful when you are working with 'flow' series.

Settings

In this analysis, you can define the following settings to determine how the calculation is done:

Period

The window of the calculation is set by the period you choose. If you select 'All' a continuous sum will be performed and you can set a date at which the sum should start.

Percentage

Selecting this option will express the result as a percentage, so it will calculate the sum and divide by 100.

Rolling

If you’ve chosen a period other than 'All', you can select 'rolling' to perform the sum on a rolling basis. The window of the rolling sum is the same as the period you have chosen.

Examples

Rolling aggregate

In this example, the aggregate analysis is used to calculate an annual rolling sum of the German current account. In other words, the sum is performed on a rolling window of 1 year.

Aggregate by fiscal year

How to calculate fiscal year rolling aggregate on a series from country which doesn't report it like calendar year?

Questions

How do I calculate a rolling sum?

There are two main possibilities to calculate a rolling sum:

  • The Aggregate analysis:


Set the 'Period' to the desired rolling length, and to not forget to tick the setting 'Rolling'.

  • Formula:

You can also use the formula

sum(series, window)

Example:

sum(usflof8344, YearsLength(2))

This will calculate a 2-years rolling sum on 'usflof8344'.

For more about formulas and how formula language in Macrobond works see  Formula analysis.

How to keep series as is and start aggregating it from certain point in time?

Use formula (on Series list or in Formula analysis):

AggregateSum(CutStart(series, Date(YYYY, MM, DD)))

in

join(older_series, newer_series, Start(newer_series))

CutStart() will create series from fragment you wish to aggregate. AggregateSum() will cumulate values. Then you need to connect that cumulated fragment with regular series using join(). As in below example:

join(sek, AggregateSum(CutStart(sek, Date(2024, 4, 2))), Start(AggregateSum(CutStart(sek, Date(2024, 4, 2)))))

Sorting

Overview

The Sorting analysis ranks the values of a series in an ascending or descending order. It’s most useful after calculating output series using another analysis such as Scalar or Cross section. You can then use sorting to rank categories and for arranging output series order.

Settings

Direction

Here, set the order in which values of the series are sorted. When you have one input series, you have the options of Ascending and Descending.

When working with multiple series, you can select a main series to rank, and sort the other series by the sorting off the main series.  You can do so by selecting 'by [series name]' under direction.

Observation limit

This sets the limit for the number of 'items' (i.e., observations or categories) to which the sorting should be applied.

This is very useful when you only want to display a smaller number of observations / categories than you have in the document.

Example: In a document containing 50 series, you would set the observation limit to 10 if you only want to display the top ten observations.

Missing values

You can choose to exclude values that are missing values in the master series by selecting this option.

Examples

Descending order

Here, we created two category series using the scalar analysis, one with the last available values and one with the values at 2015. We sorted the last available values series in descending order and sorted the second series by the order set for the first series.

Sorting with limit

See solutions for getting top X categories while using Descending order in Sorting analysis.

Questions

Why I see numbers instead of categories?

Sorting analysis needs to have all data sets pointed in some way, it can't be left with 'None'. If one data set has Direction set to Ascending/Descending, then the other(s) data set must follow that one:

How to show the top 10 highest values in Descending order?

For Category chart 'Limit' is always calculated from the right, and for Bar chart from the bottom.

There are three solutions:

  1. Sorting after Sorting (recommended) - use first analysis with Ascending order to filter out top 10, and second analysis to reverse the order to Descending.
  2. Flip sorting - change the presentation's order in the chart from Descending to Ascending.
  3. Display range (only Category chart) - sort without the limit and set display range on axis.

See these examples in a file Sorting with limit.

I set Observation limit number but it doesn't work?

You need to set Observation limit to all data sets:

Please use down arrow next to column's name to apply value to all fields below.

 

Slice

Overview

The Slice analysis cuts a time series into several pieces to compare different periods of time on a graph. For instance, to compare GDP recovery after each recession period you would use this functionality.

Settings

Period

is the first setting that you should specify. You have 3 main options to slice the series:

Set to year/quarter/month

this setting cuts series into calendar periods. The time series will therefore be sliced on a yearly/quarterly/monthly basis, meaning that one series per period will be produced. You can then specify the calculation range, which refers to the time horizon on which you want to slice the series.

Custom ranges

This setting slices time series for specific ranges of observations that you set manually.

The ranges can be open-ended.

Custom points in time

Series will be cut into several periods that are defined by:

  1. a referenced 'point in time'
  2. the length, that is specified in terms of number of observations
  3. the relation between the length set and the referenced point in time: after / around / before.

Calendar mode

This setting determines how to align the different years (or quarter or months, depending on your selection of the period). It makes a difference for series that are daily or have skipped dates.

If the mode is set to 'date' the observations for each slice are align based on the month and day of the observations.
If the mode is set to 'ordinal' the observations are aligned purely based on the order within the period. This mode is recommended for daily series.

Include only periods available in all series

It will exclude periods that are not available in all series. Recommended for removing gap when there's a leap year.

Rebase

Rebase with base value

When selected, this setting will rebase all series produced at their starting point with chosen base value, typically 100.

Additive rebase with base value

This feature is available in Macrobond 1.30 and later.

Each value of the timeseries in the underlying segment will be subtracted with the first value of the segment minus the value you input. This is particularly useful when you want to have result of each segment starting at 0.

Use legacy format

Checking this option will enable legacy output meaning the analysis won't group slices into lists. Please note that by enabling this option all following analyses will lose their settings.

Examples

Periods set to year/quarter/month

In this example, we look at average monthly performance of S&P Index since 1928.

Custom range

In this example, we chose to have 3 sliced series starting respectively in 1929-09-01, 1987-09-01 and 2008-08-15, with a length of 2500 observations after these dates. Here, we used the S&P 500, and comparing it after the 3 main financial crises. The sliced series are rebased to 100 to facilitate the comparison.

Custom points in time

Here, we listed the periods between US recessions. We ticked the rebase option to ensure sliced series are comparable - they all will start at 100. This way we will see how jobless claims evolved after each recession period.

Lag

Overview

When you are investigating the relationship between series, it can happen that their movements are not synchronized. This is where the Lag analysis becomes useful. It moves values of a series backward or forward in time by the number of observations that you specify. This functionality relates to another analysis, Correlation, which helps you identify the optimal lag setting to get the highest correlation between two series.

Settings

Method

You decide in which direction you want to move the values of the series:

  • Lag: moves a series forward by specified length.
  • Lead: moves a series backwards by specified length.

Base

Here you specify by how many observations you want to move the series.

Example

Lagged by 3 observations

In this example, we used the output from the Correlation analysis to decide which settings to apply in the Lag analysis. As a result, we lagged the US ISM PMI by 3 observations the. In the chart, we can now make assumptions on the future movements of Industrial Production, based on the current values of the ISM PMI.

Questions

How do I lag or lead a series?

There are two main possibilities to lead or lag a time series.

  • In Lag analysis:

Set the direction as 'Method' and length as 'Base'.

NOTE: 'Lead' moves values backwards in time, while 'Lag' moves values forward.

  • With formula:

You can also use the formula:

Lag(series, length)
  • The function returns the series lagged by the number of observations specified with the variable 'length'. The 'length' variable is rounded to an integer.

Examples:

Lag(sek, -2)

This will move the series 2 observations backward (meaning 'Lead').

Lag(sek, YearLength())

This will move the series 1 year forward (meaning 'Lag').

For more about Formula and how it's working see Formula analysis.

Analyses

Find out more about the analyses available in the Application.

Get answers to the following questions:

  • What is the purpose of a particular analysis?
  • How is the calculation performed?
  • What are the settings available and what do they mean?

Specific examples can also be downloaded as Macrobond documents, to give you an idea of how to use these analyses.

Customizing your workspace

The workspace in analytics is divided into four different segments, the Series browser, the Analysis tree, Presentation area, and Command bar. You can adjust the size and/or visibility of these segments to suit your needs.

Maximize the presentation area

Use Ctrl+M or select the relevant option from the View menu.

To return to the normal size just use the short cut again or deselect the relevant option in the View menu.

Adjust segment sizes

The Series browser, Analysis tree, and Presentation area can be made wider. Drag the vertical margins separating them to the left or right.

The next time you open the application the sizing will be the same.

Hide segments

You’ll see pins on the top right corners of the Series browser and Analysis tree.

Click on the pin to dock the segment you want to hide to the left of the workspace.

Click the hidden segment to access its features. If you want to reattach the hidden segment to its initial position, click on the pin again. You can also use the view menu to hide these segments, as well as the command bar.

Document series – adding external data

What is it for?

Every now and then you might want to use a non-Macrobond series in your analyses, for a one-off calculation. In cases like this, we have a function that allows you to quickly add an external series straight to your document. These are called Document series. In this article, we’ll go through how to use the document series feature.

About document series

The Document series tab is located in the Series list. Series you add via this tab can only be used in that document. There are three options for adding series this way:

  1. Manually enter the values & dates
  2. Paste data sets
  3. Copy time series from a document, and paste

How to create a document series

Manually enter the values & dates

  1. Click on the Document series tab.
  2. Select the bottom left button called 'Create document series'.
  3. On the left side of the window, add the required information: series name and document name, both should start with a letter and contain only lower-case letters & numbers and contain between 2 and 24 characters. The rest of the settings are optional.
  4. Add all the values in the field provided on the right side of the window. Press enter to create a new line.

NOTE:

If you have specified the frequency and start date of the series, you don’t need to enter the dates manually, as the application will automatically assign dates according to those settings.

Using 'Paste document series'

Alternatively, you can use ‘Paste document series’ button.

First copy a series from an Excel file. You can decide to include the date column or not. Then click 'Paste document series' to upload the series automatically (including detecting the frequency if you have copied the dates column) into the new edit window. You can then just adjust the settings and confirm with 'OK' button.

Paste data set

  1. Copy multiple series from an Excel file
  2. Click on the document series tab in Macrobond
  3. Select the bottom left button called 'Create document series'

  4. Click 'Paste data set' in new window button to upload a data set

NOTE:
The application automatically detects the frequency based on the information entered. If you wish to add more series, you can do it in Edit window by clicking 'Add new series' button.

Using document series

Once you’ve created a document series, you should add it to the 'Series and expressions' tab to make it available for analysis and charting. This is done by clicking the red plus sign next to the series name.

Document series are only available in the document you added them to. If other users need to access the document, they will need to download the series after opening the file.

A yellow banner will pop up to inform users of this, as well as what to do next.

If you’re planning on frequently working with external data sets or want to use a series in a number of documents, it’s best to add and organize the data using our two in-house-data functions.