Displaying 1 result from an estimated 1 matches for "beta_v".
Did you mean:
beta_1
2006 May 15
1
Object call
...331,12)
z <- rep(seq(0,331,by=11)+1, each=2)
zz <- z[-c(1,length(z))]
ind <- as.data.frame(matrix(zz, nr=2))
lapply(ind, function(x) mat[x[1]:x[2],])
cat("For",x/4,"month i.e",x,"week, number of windows is = ",length(ind),"\n")
jj<-length(ind)
beta_val<-matrix(0,jj,ncol(mat))
prc_chng<-matrix(0,jj,ncol(mat))
p<-x-1
for (j in 2:ncol(mat))
{
i<-1
k<-1
while (i<=jj)
{
beta_val[i,j]<-cov(mat[(k):(k+p),1],mat[(k):(k+p),j])/sd(mat[(k):(k+p),1])
prc_chng[i,j]<-((mat[(k+p),j]-mat[(k),j])/mat[(k),j])*100
k<-k+p
i<-i+1
}
}...