Jeffrey, Thanks. I apologize for not providing sample data. I think I need some more help.

Although I really did recognize that xts is a superior time series class, my initial efforts used standard R. I think I could eventually have produced the correct results, but probably not very efficiently.

Jan = subset(theReturnsData,months(theReturnsData[,1]) == "January")

Feb = subset(theReturnsData,months(theReturnsData[,1]) == "February")

Jansd = apply(Jan[,-1],2,sd, na.rm = TRUE)

Febsd = apply(Feb[,-1],2,sd, na.rm = TRUE)

rbind(Jansd, Febsd) # would have to do this for all months.

Below is the head and tail of the data and some other information.

WhatI am trying to do.

For each column, I want to determine the volatility for all of the Q1 data. Similarly for Q2, Q3, Q4. So I will have an output of just four rows for each column. I will also be doing this for the 12 months (need 12 rows) and for each of the years (unspecified in advance; I am writing a function).

I also have a second question. Say I wanted to break the data up by quarters. What would I do to produce correlations? For each pair of columns, each quarter would have a correlation. I would be looking to produce four correlation matrices. For example for Q1 there would be a 50 by 50 correlation matrix; and similarly for Q2, Q3, Q4.

theReturns = read.zoo("returns large.csv", sep = ",", header = TRUE, format = "%m/%d/%Y")

> dim(theReturns)

[1] 2386 50

> head(theReturnsData[,1:4]) # data frame format

Date SEC1 SEC2 SEC3

2001-10-04 0.0657 0.0249 0.0236

2001-10-05 -0.0237 -0.0106 -0.0070

2001-10-08 -0.0234 0.0027 0.0022

2001-10-09 0.0058 0.0013 0.0013

2001-10-10 0.0143 0.0022 0.0031

2001-10-11 0.0509 0.0360 0.0318

> tail(theReturnsData[,1:4])

Date SEC1 SEC2 SEC3

2011-04-14 0.011 0.0093 0.0092

2011-04-15 0.012 0.0143 0.0140

2011-04-18 -0.019 -0.0232 -0.0230

2011-04-19 0.008 0.0096 0.0055

2011-04-20 0.024 0.0305 0.0335

2011-04-21 0.014 0.0075 0.0075

----- Original Message -----

From: Jeffrey Ryan

To: Ira Sharenow

Cc:

[hidden email]
Sent: Thursday, August 25, 2011 5:20 PM

Subject: Re: [R-SIG-Finance] Combined seasonal data using xts

Its a bit hard to tell what you want as you haven't provided a reproducible example as requested in the posting guidelines.

Without that I can guess. First, there are no alternatives to xts ;-)

Second, you probably want to look at ?split.xts (which is just the xts method split) combined with lapply. A quick search of this list over the last month will get you examples of its use and power.

Aside from that, post a sample code and we can help further if need be.

Best,

Jeff

On Thu, Aug 25, 2011 at 5:37 PM, Ira Sharenow <

[hidden email]> wrote:

I have multivariate time series data and I am using xts but am open to alternatives. I am trying to write a function for a user.

For all years combined, I would like to find quarterly volatility (sd). I want to have just four outputs: Q1, Q2, Q3, Q4.

Can someone help me out?

If instead I wanted to find the volatility for each quarter of each year, I would use something like:

apply.quarterly(xInput, function(x) apply(x,2,sd))

This would give me results for 2008Q1, 2008Q2, ., 2009Q1, ., 2011Q2

[[alternative HTML version deleted]]

_______________________________________________

[hidden email] mailing list

https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first.

-- Also note that this is not the r-help list where general R questions should go.

--

Jeffrey Ryan

[hidden email]
www.lemnica.com

www.esotericR.com

[[alternative HTML version deleted]]

_______________________________________________

[hidden email] mailing list

https://stat.ethz.ch/mailman/listinfo/r-sig-finance-- Subscriber-posting only. If you want to post, subscribe first.

-- Also note that this is not the r-help list where general R questions should go.