[R-SIG-Finance] [R-sig-finance] Rolling Beta

ehxpieterse eduard.pieterse at macquarie.com
Mon Oct 19 18:10:41 CEST 2009


Hi, 

I have had a *very* rough attempt at estimating the beta between indices. I
am convinced that someone on this list has had experience with this before,
but my search yielded little information. I have daily log returns from
01/01/2000 on 13 different equity indices. I am just looking for an
efficient way to produce a rolling beta for all index pairs.

I would appreciate any advice.

Thanks,
Eduard

CODE:

IndexLocal <- read.csv("IndexLocal.csv", header=TRUE, sep = ",")
MyLag <- 30
IndexDim <- dim(IndexLocal)
Results <- NULL
reg <- NULL
k <- 0

for (i in 2:14)
{
	for (j in 2:14)
	{
			k <- k + 1
			for (r in MyLag :IndexDim[1])
			{
				x. <- IndexLocal[(r-MyLag+1):r,i]
				y. <- IndexLocal[(r-MyLag+1):r,j]				
				glm.linear<-coef(glm(y. ~ x.))
				reg[r] <- glm.linear[2]
			}
				if (j >= i)
				{
					Results <- cbind(Results,reg)
				}
	}
}


-- 
View this message in context: http://www.nabble.com/Rolling-Beta-tp25961048p25961048.html
Sent from the Rmetrics mailing list archive at Nabble.com.



More information about the R-SIG-Finance mailing list