search for: restrictmat

Displaying 2 results from an estimated 2 matches for "restrictmat".

2007 May 08
2
Looking for a cleaner way to implement a setting certain indices of a matrix to 1 function
I wrote an ugly algorithm to set certain elements of a matrix to 1 without looping and below works and you can see what The output is below the code. K<-6 lagnum<-2 restrictmat<-matrix(0,nrow=K,ncol=K*3) restrictmat[((col(restrictmat) - row(restrictmat) >= 0 ) & (col(restrictmat)-row(restrictmat)) %% K == 0)]<-1 restrictmat[,(lagnum*K+1):ncol(restrictmat)]<-0 restrictmat [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [,15...
2007 May 23
1
I made some progress on my previous "systemfit" question but still not quite there
Surprisingly, I played around with some test code and below actually creates equations that look correct. tempmat<-matrix(10,nrow=6,ncol=6) restrictmat<-diag(6) colnames(tempmat)<-c("AUD.l1","CHF.l1","CAD.l1","GBP.l1","EUR.l1","JPY.l 1") rownames(tempmat)<-c("AUD","CHF","CAD","GBP","EUR","JPY") eqn<-list() for ( i...