# Stepwise Cointegration

This is more of a general question at this point, but if my thought process makes sense I will follow up with an R implementation. I have read a number of papers on cointegration analysis for pairs trading. My thought was to apply cointegration to an analysis of investment manager returns. Typically investment-manager returns are regressed on factor returns to estimate risk exposures and alpha (intercept). Instead, I would like to use cointegration analysis to estimate risk exposures and alpha based on the level of cumulative wealth invested in a manager's strategy vs. various risk exposures.

I am using R. My thought was to use a stepwise regression-type procedure based on AIC to find a good fit for manager returns with a parsimonious model. Basically the idea was to create a function that would step through various cointegration vectors, and arrive at the vector tested with the lowest AIC that results in stationary residuals based on an ADF test. I could then test for significant alpha using Newey-West standard errors. I have a few questions:

1. Is this a reasonable thing to do?

2. Given my knowledge of the risk exposures and investment managers, I think there exists only one cointegrating vector. Given this, does it make sense to use the Engle-Granger method? This is much easier to work with in R for what I am trying to do.

3. If it is reasonable to use the Engle-Granger method with lm(), in order to estimate alpha (a positive/negative drift in level of wealth over time), can I just add a vector of lenght N to the regression, where each value is equal to t? Then the estimated weight of this term would be equal to added wealth per period not explained by risk (manager skill).

Edit sample code is below. I haven't included an algorithm to step through different regression factors as I just included a simple equity manager, and adding and removing factors becomes more useful I think as you delve into alternatives and are looking at many more possible risk factors.

require(tseries)
require(sandwich)
require(lmtest)

#---------------- Data--------------------------------------------------------------

managerReturns<-ts(c(-0.008,0.022,0.061,0.013,-0.076,-0.041,0.063,-0.030,0.071
,0.036,-0.010,0.055,0.018,0.039,0.002,0.036,0.003,-0.014
,-0.033,-0.018,-0.055,0.069,0.004,0.019,0.028,0.018,0.028
,-0.008,-0.037,0.048,0.003,0.019,0.025,-0.020,0.013,0.007),
start = c(2010,01),frequency=12)

mkt<-ts(c(-0.0336,0.034,0.0632,0.02,-0.0789,-0.0556,0.0692,-0.0477,0.0954,0.0388,
0.0061,0.0682,0.0201,0.0349,0.0048,0.029,-0.0127,-0.0175,-0.0234,-0.06,
-0.076,0.1134,-0.0026,0.0074,0.0506,0.0443,0.0311,-0.0084,-0.062,0.0388,
0.0079,0.0256,0.0274,-0.0175,0.0077,0.0118),start = c(2010,01),frequency=12)

value<-ts(c(0.0019,0.0142,0.0157,0.0493,-0.0009,-0.0212,0.0013,-0.0289,0.0383,
0.0103,0.0366,0.0075,-0.0246,0.0165,0.0259,-0.003,-0.0066,-0.0008,
-0.0144,-0.0329,-0.0371,0.0357,-0.0025,-0.0055,0.0253,-0.0161,-0.0022,
-0.0061,-0.0009,0.0083,-0.0257,0.0073,0.0045,-0.0104,0.0069,0.0165),
start = c(2010,01),frequency=12)

size<-ts(c(0.0061,0.0273,0.0206,0.0314,-0.0234,-0.0427,0.002,-0.017,-0.0305,
-0.0228,-0.0051,0.036,0.0084,0.0167,-0.0119,-0.0227,-0.0214,-0.0045,
-0.0112,-0.0146,-0.0091,-0.0102,-0.001,0.0154,-0.0221,-0.0003,-0.0003,
-0.0019,0.0017,0.0039,-0.0003,0.0056,0.0159,0.0408,-0.0112,0.0329),
start = c(2010,01),frequency=12)

rf<-ts(c(0,0,0.0001,0,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,
0.0001,0.0001,0.0001,0,0,0,0,0.0001,0,0,0,0,0,0,0,0,0.0001,0,0,0.0001,
0.0001,0.0001,0.0001,0.0001),start = c(2010,01),frequency=12)

mangerReturns<-log(managerReturns+1)
mkt<-log(mkt+1)
value<-log(value+1)
size<-log(size+1)
rf<-log(rf+1)
managerExcess<-managerReturns-rf

# ----------------------------------- Returns based Factor Analysis----------------

fit<-lm(managerExcess~mkt+value+size)
summary(fit)

# ----------------------------------- Cointegration Analysis ----------------------

lvlManager<-cumsum(managerExcess)
lvlMkt<-cumsum(mkt)
lvlValue<-cumsum(value)
lvlSize<-cumsum(size)
alpha<-seq(1,length(lvlManager))

fit2<-lm(lvlManager~lvlMkt+lvlValue+lvlSize+alpha)
#Coefficient test with Newey-West Standard Errors
coeftest(fit2,NeweyWest(fit2))
#Check for stationarity

I would recommend using the Johansen-Procedure for determining the cointegration vector, the ca.jo-function from library(urca). After determining the cointegration rank, a normalized cointegration vector is produced by estimating a restricted VECM with the command cajorls().