Re: [R] Help with permutation / loops

2010-08-12 Thread Ferreira, Thiago Alves
[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- combn(a,2) coint-function (x) { x1 - get(x[1

Re: [R] Help with permutation / loops

2010-08-12 Thread nikhil kaza
point me in the right direction as to how to do that? Thank you! Thiago -Original Message- From: Nikhil 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

[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)

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)