Re: [R] Calculating monthly var-cov matrix on non-overlapping rooling window basis

From: Henrique Dallazuanna <wwwhsd_at_gmail.com>
Date: Wed, 27 Feb 2008 08:15:10 -0300

Perhaps something like this:

lapply(split(data1, format(index(data1), "%m")), cov)

On 27/02/2008, Megh Dal <megh700004_at_yahoo.com> wrote:
> let create a 'zoo' object :
>
> library(zoo)
> date.data = seq(as.Date("01/01/01", format = "%m/%d/%y"), as.Date("06/25/02", format = "%m/%d/%y"), by = 1)
> len = length(date.data)
> data1 = zoo(matrix(rnorm(2*len), nrow = len), date.data )
> head(data1)
>
> Now I want to create an 3 dimensional array (suppose name " var.cov") where, var.cov[,,i] gives the Variance-covariance matrix for i-th month of data1. That is I want to calculate monthly variance-covariance matrix on non-overlapping rolling window basis.
>
> Any suggestion?
>
>
>
> ---------------------------------
>
> [[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.
>

-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

______________________________________________
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 Wed 27 Feb 2008 - 11:17:46 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 Thu 28 Feb 2008 - 05:30:17 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