[R] combining two different matrizes

ThomasH thomas.hufnagel1 at gmx.de
Wed Jun 5 23:56:16 CEST 2013

Hello together,

this is ma first post, so please aplogize me if post this in the wrong

I have problem concerning ma two matrizes.

After a regressione and so on, I got two matrizes

Matrixres contains the results of ma calculation.

Matrixr contains my detiene, which where Aldo used for the regression.

Please ser the following code:

#Datei einlesen
residual = read.csv2("E:***Input-R_Renditen.csv",header=TRUE, sep=";")

alist <- list()
for (a in 2:11){

   #Länge Gesamtzeit
   t <- 243
   tx <- t-59

   #Länge Regression
   reglist <- list()
   for (i in 1:tx){
   j <- i+59

   x = residual[i:j,a]
   rm = residual[i:j,12]
   smb = residual[i:j,13]
   hml = residual[i:j,14]
   rf = residual[i:j,15]


   reg <- lm(ex~erm+smb+hml)
   reglist[[i]] <- coef(reg)

#Berechnung Residuum
      #Residual Berechnung
      rx = residual[(j-5):j,a]
      rrm = residual[(j-5):j,12]
      rsmb = residual[(j-5):j,13]
      rhml = residual[(j-5):j,14]
      rrf = residual[(j-5):j,15]

      rex = rx-rrf
      rerm = rrm-rrf

      res <-
      reglist[[i]] <- res

#Residuen auf alle Aktien
   alist[[a]] <- reglist
#Matrix mit Residuen
   matrixres <- do.call(cbind,alist)

s<- names(residual)[2:11]

matrixr <- do.call(cbind,residual[60:243,2:11])

Now I want to combines  the two matrizes in the following way:

Under every row of matrixres should stand the row of matrixr for excample:

Matrixres row1
Matrixr row1
Matrixres row2
Matrixr row 2

Can anybody help me? I was working on this problem the whole day, but have
no idea.

Thanks alot

View this message in context: http://r.789695.n4.nabble.com/combining-two-different-matrizes-tp4668766.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list