Feeds:
Posts

## From regression to dynamic linear model: GLD, NEM, and GSPC

One of the more annoying issues for analytics of futures is the fact that the futures contracts have to be rolled.  Fortunately, the gold ETF GLD has continuous returns.  Then there are some strong and well-known empirical relations between the commodity and gold mining companies as well as the stock market.  We can obtain the data using the quantmod library in R and obtain a basic regression relation (these are contemporaneous data):

lm(formula = GLD.R$GLD.Close ~ NEM.R$NEM.Close + GSPC.R$GSPC.Close + DJPRE1$DBAA)

Residuals:
Min        1Q    Median        3Q       Max
-0.070574 -0.004731  0.000132  0.005388  0.063796

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept)        0.0008786  0.0005083   1.728   0.0841 .
NEM.R$NEM.Close 0.3772582 0.0088180 42.783 <2e-16 *** GSPC.R$GSPC.Close -0.1871526  0.0163548 -11.443   <2e-16 ***
DJPRE1\$DBAA       -0.0002857  0.0003686  -0.775   0.4384

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.009365 on 1850 degrees of freedom
(13 observations deleted due to missingness)
Multiple R-squared:  0.4996,    Adjusted R-squared:  0.4988
F-statistic: 615.7 on 3 and 1850 DF,  p-value: < 2.2e-16

So we can see clearly some strong relations, with an R-squared close to 0.5.  A natural question is what happens when we consider a dynamic linear regression model instead.  The general form of such models is:

$y_t = F_t \theta_t + v_t, v_t \sim N(0,V)$

$\theta_t = G_t \theta_{t-1} + w_t, w_t \sim N(0,W)$

It is useful to consider what might be a reasonable way to consider the generalization to the linear regression model above.  An obvious sort of choice might be to set $F_t = X'_t$ where $X_t = ( NEM_t, GSPC_t)$ and $V$ is computed from the linear regression.  Then we might just set $W=0$ and $G_t=Id$.  A bit of thought shows that this will yield something equivalent to the linear regression model.  So we might next consider a slightly more interesting extension and insert a stochastic volatility factor into $\theta_t$.