[R-SIG-Finance] [R-sig-finance] Rolling Beta
Brian G. Peterson
brian at braverock.com
Mon Oct 19 18:27:51 CEST 2009
see PerformanceAnalytics functions
CAPM.beta
and
chart.RollingRegression
and
charts.RollingRegression
Cheers,
- Brian
ehxpieterse wrote:
> 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)
> }
> }
> }
>
>
>
--
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock
More information about the R-SIG-Finance
mailing list