[R-SIG-Finance] Calculating Hasbrouck's information share and Gonzalo-Granger weights on R

Drew Harris drew.harris.nz at gmail.com
Wed Jul 4 06:34:52 CEST 2012


Hi Nidhi,

I have been attempting to expand your code above into an n dimensional
format. I am having a bit of trouble getting my Beta and Alpha orthogonal
components to generate and they are giving me (I believe) extremely
unbalanced IS measures. The following is what I tried to implement:

    ## the beta_orthogonal and alpha_orthogonal vectors :
	beta_ortt <- matrix(0, nrow = n, ncol=n)
	for (l in 1:n) {
		for (j in 1:n) {
			beta_ortt[j, l] <- if((n+1-j)==l) {cointest at V[(n+1-j),l]}
			else { -cointest at V[(n+1-j),l]	}
			}}
	
	alpha_ortt <- matrix(0, nrow = n, ncol=n)
	for (l in 1:n) {
		for (j in 1:n) {
			alpha_ortt[j, l] <- if((n+1-j)==l) {cointest at W[(n+1-j),l]}
			else { -cointest at W[(n+1-j),l]	}
			}}
	
   ## Gamma matrix construction
	gammat <- matrix(0, nrow = n, ncol=n)
	Identity <- diag(1, n)
    for (l in 1:n) {
		for (j in 1:n) {
			for (i in 1:(k-2)) {
				gammat[j,l] <- gammat[j,l] +vecm$rlm$coefficients[((n*i)+(l-1)),j]			
	}}}

--
View this message in context: http://r.789695.n4.nabble.com/Calculating-Hasbrouck-s-information-share-and-Gonzalo-Granger-weights-on-R-tp2395838p4635353.html
Sent from the Rmetrics mailing list archive at Nabble.com.



More information about the R-SIG-Finance mailing list