theorangedog.net

Tag: Time Series

Time Series Models with Multiple Time Series

by theorangedog on Feb.10, 2008, under Skills

Can least squares regression be used if we are creating a model that includes more than one time series? An example of a model with more than one time series would be as simple as a model that includes a dependent variable and a single independent variable that are both time series. Such as:
small y_t=b_0+b_1x_t+epsilon_t

Working with that example, there are five possible outcomes that dictate whether or not least squares is an appropriate method. Generating these outcomes begins by testing each variable, again the dependent variable and the single independent variable, for a unit root. This can be done by using the Dickey-Fuller test.

Outcome 1:
Neither variable has a unit root. In this case, least squares can be used to estimate the model.

Outcome 2:
The dependent variable has a unit root while the independent variable does not. This occurs by failing to reject the hypothesis of a unit root for the dependent variable. If this is the case, the error term is not covariance stationary and least squares is not appropriate for that specific model.

Outcome 3:
The dependent variable does not have a unit root while the independent variable does. Opposite of Outcome 2, this occurs by failing to reject the hypothesis of a unit root for the independent variable. Similar to Outcome 2, the error term is not covariance stationary and least squares is not an appropriate method.

The next two outcomes occur when both the dependent variable and independent variable have a unit root. In these cases, the next step would be to test for cointegration between the two time series. This can also be performed using a Dickey-Fuller test. The time series are said to be cointegrated if their divergence has some boundary.

Outcome 4:
Both variables have a unit root but they are not cointegrated. As in Outcome 2 and Outcome 3, the error term will not be covariance stationary and thus least squares is not an appropriate method.

Outcome 5:
Both variables have a unit root and they are cointegrated. In this case, the error term is covariance stationary so the model may be valid. However, this relationship models the long term, and short term results may not be as expected. That is primarily the cause of the fall of LTCM. While there may be boundaries to a divergence in the two time series, there are not necessarily natural rules in all models that dictate maximum time frames for desired changes in the divergence. In other words, if a trader is hoping for a wide divergence to narrow with the two time series meeting, there is not necessarily a time frame in which that must happen.

This is a quick overview of testing the quality of a model with two time series variables using least squares. The intent was to build upon my prior post, Test for Random Walk in Time Series. In an upcoming post, I will provide the results (and excel spreadsheets) that result in one of the five outcomes, and will provide additional detail and connection within the method.

2 Comments :, , more...

Test for Random Walk in Time Series

by theorangedog on Jan.27, 2008, under Skills

One of my most-viewed posts concerns the Dickey Fuller test, and the most downloaded document is the Dickey Fuller example.

So, I thought I’d expand on that in a series of posts as it is an area of interest for me, and obviously many others out there.

Let’s start with the idea of a Random Walk. A time series is a random walk if it is explained by the equation x_t=x_{t-1}+epsilon_t. This requires that the error term epsilon_t has a constant variance and is uncorrelated with previous error terms.

This equation states that the best predictor for any x is x_{t-1} for any period after t-1. So, let’s start by testing a set of financial time series to see if it is a random walk.

If you go to the Federal Reserve website, you can download data for a number of currencies. I downloaded the data for the Pound, and opted to use the dates Jan 01, 2007 to Dec 31, 2007. The spreadsheet used is attached here.

Notice that the t-value for the intercept is 1.72, meaning the intercept is not significantly different than zero. Also, the lagged variable slope coefficient is .977, which is very close to the value of 1 we would expect for a random walk. However, a random walk is not covariance stationary, meaning it does not have a fixed mean and variance, thus the t-test for this variable is unreliable.

So, how can we confirm out suspicion that this time series is a random walk? We can regress the first differences of the series. Essentially, we look at the equation:
y_t=b_0+b_1y_{t-1}+epsilon_t where y_t=x_t-x_{t-1}small.

If the series is indeed random, we would expect that b_0 and b_1 would be equal to zero. The results of that test are attached here. Notice that both regression coefficients are not statistically significantly different from zero. Also, I added an autocorrelation measure and t-test to go with the error terms. These measures show that there is no first lag autocorrelation in the model.

Thus, we can conclude that the exchange rate for the Great British Pound followed a random walk in 2007. That’s a good starting point.

4 Comments :, , , more...

Signal To Noise in High Frequency Trading

by theorangedog on Dec.20, 2007, under Skills

I was reading a little bit today about the signal to noise ratio as it applies to sound, which uses a general equation:
SNR(dB) = 10log_{10}(frac{P_{s}}{P_{n}}) = 20log_{10}(frac{A_{s}}{A_{n}}), where
P = average power
A = amplitude measured as a quadratic mean

Signal To Noise is often referred to in finance, specifically when it comes to Black’s paper “Noise.” (in the Papers section)

While glancing through that and JSTOR, I came across Truman’s Theory of Noise in Trading paper (also in the Papers section), which used a comparable line of thought to that found in O’Hara’s book Market Microstructure Theory.

I can refer to the equations when I get near the book, but it has a number of them built upon two period models, much like Truman, that determine how a market maker may adjust the bid/ask spread based upon their interpretation of informed trading. Magnitude would play a role, meaning when a market maker felt trading was informed to a scale that would impact their inventory, the bid/ask spread would adjust by a larger amount to handle that. That reasoning is very intuitive, assuming the market maker is risk neutral.

On a tick frequency, could we get a signal to noise ratio based upon larger-than-normal moves, using this logic? I’ll look to find out. If we have:
r_{i} = ln(frac{x_{i}}{x_{i-1}}),
then we could derive:
SNR = frac{r_{i}}{sigma_{r}},
which results in:
SNR = left{begin{array}{2}<br />
signal & mbox{ if $frac{r_{i}}{sigma_{r}} g 1$};\<br />
noise & mbox{if $frac{r_{i}}{sigma_{r}} leq 1$}.end{array} right.

The question then becomes if a ratio of 1 is the correct breakpoint, and whether or not the signal and noise measures should be aggregated over a set time bin. There are still a number of questions that relate to this, but it is a framework for starting.

14 Comments :, , , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Try Google.

Endurance

The best long distance runners eat raw meat, run naked, and sleep in the snow.