[フレーム]

Learning Center

  1. Learning Center
  2. How to's

How to directly transform a time series?

A direct transformation of a time series can help you exploring your data and creating econometrics models in a blink of an eye. This is because you can use any variation of a time series in your model without having to insert the transformed time series in the spreadsheet. The list of transformations available in the Econometrics Toolbox is:

Exp

2nd_Difference

Power(n)

Log

Returns

Fitted_AR(p)

Sqrt

AccumulatedReturns

Fitted_MA(q)

Normalization

LogReturns

Fitted_ARIMA(p,d,q)

Abs

AccumulatedLogReturns

EWMA(lambda)

Lag

Square

Fitted_Garch(p,q)

Seasonal_Difference

Series-Mean_Squared

Error

1st_Difference

Using a transformation in your time series is just a matter of enclosing the transformation in the variable operators (Y[], X1[], X2[], ... ) . Multiple operators are allowed, just type the transformations followed by a semicolon. Evaluations are made from the left to the right. So, for instance, Y[power(2); exp] will first apply the function f(x) = x^2 to every data x of the series denoted by Y and then apply the function g(f(x)) = exp(f(x)). As you can note, transformations that contain parenthesis need to have the letters enclosed replaced by appropriate parameters.

There is also one special transformation, the "error" transformation. This transformation returns the difference between the original series and the subsequent transformations until its evocation. Therefore, a transformation like Y[power(2); error] returns a transformed series Z = Y - Y^2, where Y is the original series in the spreadsheet.

All transformations are also available through the function "sTimeSeriesTransform" where you can simply type a transformation string — ex: "Y[log;power(2)]" — as one of the function's arguments.

To practice the above concepts a little bit, we are going to build a transformation to explore how the volatility of the following time series of some stock prices behaves, considering the series below:

A

B

C

D

E

F

1

Apple Inc. (Adjusted close price)

2

3

2012年12月31日

71.03051

4

2013年01月02日

73.28087

5

2013年01月03日

72.3559

6

2013年01月04日

70.34045

7

2013年01月07日

69.92669

8

2013年01月08日

70.11489

9

2013年01月09日

69.01907

10

2013年01月10日

69.87463

11

2013年01月11日

69.44619

12

2013年01月14日

66.97025

13

2013年01月15日

64.85737

14

2013年01月16日

67.54952

...

...

...

746

2015年12月11日

112.5692

747

2015年12月14日

111.873

748

2015年12月15日

109.8937

749

2015年12月16日

110.7391

750

2015年12月17日

108.3918

751

2015年12月18日

105.4578

752

2015年12月21日

106.7507

753

2015年12月22日

106.6513

754

2015年12月23日

108.0238

755

2015年12月24日

107.447

756

2015年12月28日

106.2435

757

2015年12月29日

108.1531

758

2015年12月30日

106.7408

759

2015年12月31日

104.6919

760

We need the following chain of transformations: 1o- Transform price to log returns, 2o- Square the returns to get a measure of an instantaneous volatility, 3o smooth the volatility using the exponential weighted moving average model.

For the first transformation, we can use directly the "LogReturns" transformation or the pair 1st_Difference;Log. The second transformation can be done by the power(2) transformation or to be picky with volatility definition we can use the "Series-Mean_Squared" (the mean of logreturns is very close to zero for daily returns). Now, to smooth the results, we can apply an EWMA model with a decaying factor of 0.95, that is, use the transformation "EWMA(0.95)". Putting it all together, we come to the following transformation string: Y[LogReturns;Power(2);EWMA(0.95)]. The screenshot of insertion box and the result is displayed below:

And double clicking the chart to expand it:

As a final remark, please note that when you have only one time series the explicitness of the operator Y[] is not necessary. Besides, the command window is not case sensitive. So, typing "Power" and "POWER" will lead to the same results.

AltStyle によって変換されたページ (->オリジナル) /