On Wed, 3 Mar 2010, Research wrote:

Hello,

I have various datasets of zoo time series (merged into single frames
via the "merge" command)  such as

date    var0    var1    var2    var3
08/07/1996      652.54  0.223922        0.515819        0.502638
08/08/1996      662.59  0.997841        0.000383        0.999806
06/09/1996      655.68  0.901685        0.569763        0.866333
08/10/1996      700.64  0.268855        0.244701        0.329285
08/11/1996      730.82  0.438407        0.501427        0.461374
06/12/1996      739.6   0.432233        0.562175        0.052423
08/01/1997      748.41  0.616211        0.799211        5.96E-09
07/02/1997      789.56  0.378415        0.645088        0.93862
07/03/1997      804.97  0.142706        0.422156        0.145648
08/04/1997      766.12  0.999999        0.999435        0.998576
08/05/1997      820.26  0.810795        0.966044        0.000427
06/06/1997      858.01  0.998652        0.998287        0.994222
08/07/1997      918.75  0.951553        0.974251        0.89633



I am trying to put all these into a sort of a list so I can invoke them
via the list
and not individually so I can run a batch of statistical analyses on them.

I also want to have the specification of the analysis on a list of some
sort as well.

For example:

List "a" has 3 zoo data sets and list "b" has  2 specifications (calls)
for a function (say,  "analysis(specification, inputdata)" ) that runs
some statistical manipulations (regressions, nonlin models, etc. etc.)
on the elements of the zoo data frames. Thus I want to be able to run
(this is pseudo R code):

for (i in 1:3)
{
output1<-analysis(b[1], a[i])
output2<-analysis(b[2], a[i])
}

Thanks in advance for any pointers or help.

Not sure how exactly you want to organize these, but assume you have a multivariate zoo series like:

z <- structure(c(0.4, -0.84, 0.92, 0.41, -0.47, -0.07, 0.36, -1.48,
-1.39, 0.53, -0.65, -0.7), .Dim = c(4L, 3L), .Dimnames = list(
    NULL, c("a", "b", "c")), index = 1:4, class = "zoo")

Then you can easily compute column-wise (i.e., variable-wise) such as

sapply(z, mean)

Or if you want to apply a list of functions

lapply(list(mean, sd), function(f) sapply(z, f))

etc.

hth,
Z

Best,
Costas






        [[alternative HTML version deleted]]

______________________________________________
R-help@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.


______________________________________________
R-help@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.

Reply via email to