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?