[R] Problem with lapply and splitted variables

From: ivan <i.petzev_at_gmail.com>
Date: Tue, 26 Apr 2011 17:58:46 +0200


Dear Community,

I have the following two variables, which I have split according to a factor:

*y1*

 [1]

1
2
3 [2]

2
3
4

and

*y2*

A B [1]

1 4
2 5
3 6 [2]

2 5
3 6
4 7

Now I need the following Vector Autoregressive Models: VAR(cbind(y1[1],y2[1]$A)), VAR(cbind(y1[1],y2[1]$B)), VAR(cbind(y1[2],y2[2]$A)), VAR(cbind(y1[2],y2[2]$B)). My problem is that when using this argument: lapply(y2, function(x) VAR(cbind(x,y1),ic="SC", lag.max=5), I receive these models: VAR(cbind(y1[1],y1[2],y2[1]$A)), VAR(cbind(y1[1],y1[2],y2[1]$B)), VAR(cbind(y1[2],y1[1],y2[2]$A)), VAR(cbind(y1[2],y1[1],y2[2]$B)). Can anybody help me?

Thank you

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 26 Apr 2011 - 16:01:51 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 26 Apr 2011 - 16:10:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive