Re: [R] Help with permutation / loops

2010-08-12 Thread nikhil kaza
erreira, Thiago Alves [ICG-MKTS] > Cc: 'r-help@R-project.org' > Subject: Re: [R] Help with permutation / loops > > How about this? > > untested since no data is provided. > > a <- paste("x",1:6,sep="") > b<- combn(a,2) > >

Re: [R] Help with permutation / loops

2010-08-12 Thread Ferreira, Thiago Alves
ikhil Kaza [mailto:nikhil.l...@gmail.com] Sent: 11 August 2010 12:35 To: Ferreira, Thiago Alves [ICG-MKTS] Cc: 'r-help@R-project.org' Subject: Re: [R] Help with permutation / loops How about this? untested since no data is provided. a <- paste("x",1:6,sep="") b<- co

Re: [R] Help with permutation / loops

2010-08-11 Thread Nikhil Kaza
How about this? untested since no data is provided. a <- paste("x",1:6,sep="") b<- combn(a,2) coint<-function (x) { x1 <- get(x[1]) x2 <- get(x[2]) adfdata(x1) adfdata(x2) engle<-lm(x1~x2) residual<-resid(engle) adfresd(residual, k=1)

[R] Help with permutation / loops

2010-08-11 Thread Ferreira, Thiago Alves
Hi everyone, I am writing a code for cointegration between n (n=6 initially) pairs. I have done the whole thing for 2 variables. There is a function coint(x1,x2) that takes 2 inputs x1 and x2 and does the following: coint<-function (x1,x2) { adfdata(x1) adfdata(x2) engle