# Kalman smoothing of returns vs. prices with dlmSmooth in R's dlm package?

So I am using the R code behind Fig. 3.14 in Dynamic Linear Models With R (p. 124-5) to make a dynamic version of a simple pair trading model:

$$Y = \alpha + \beta X.$$

If I use log returns (diff(log(P)) in R, P being a timeseries of equity prices) I get results that makes sense, they are pretty similar to the static regression of the whole dataset (comparable to the R code on p. 123). So far so good.

But if I instead use log prices (log(P) in R, P being a timeseries of equity prices), the results don't make sense at all, $\alpha$ has the wrong sign and $\beta$ is almost constant throughout the timeseries at half of what I would expect compared to the regular static regression.

So what am I doing wrong here? How can I change the code to produce better results for log prices?

I don't see why you expect the regressions to give you the same answers. Suppose you first perform a regression on the log prices to get $\log(p_t) \approx \alpha + \beta \log(q_t),$ where $p_t$ and $q_t$ are prices of two different assets. Now if you take the first difference, you should find that $\log(p_t) - \log(p_{t-1}) \approx \beta \left(\log(q_t) - \log(q_{t-1})\right)$. The $\alpha$ term has cancelled out. It only appeared in the log prices regression to take care of different 'DC levels' of the two assets.
Considering now the log return regression, if you find a significant $\alpha$ term, this looks like a 'drift' over time of one stock relative to the other. This does not show up in the log price regression unless you specifically model for it, i.e. $\log(p_t) \approx \nu + \alpha t + \beta \log(q_t)$. If you try the differencing trick on this regression, you should get back (approximately) your log return regression (the $\nu$ terms drops out).
Another way of viewing the $\alpha$ term in the log price regression is to imagine a different universe in which one of the stocks had a split in the past, and so the price in this alternate universe is exactly one half of the price in our universe. Up to the problem of having to hold integral numbers of shares (or round lots), there should not be a strategic edge in our universe or the alternate one. The $\alpha$ takes care of the choice of units in the log price regression.
• I don't expect them to have the same $\alpha$ and $\beta$. The log return regression is just fine, but the log prices regression results looks strange. Nov 17, 2011 at 9:58
• Interestingly enough, if I remove the intercept the results (ie the $\beta$) make more sense. Nov 18, 2011 at 2:46