Hi:

I have a financial series data. For instance, one can take YHOO from the
quantmod package.

>library("quantmod")

>getSymbols("YHOO")

 

As you can see this series has date along with close prices. I want to do a
cross-sectional analysis of the time series and want to see if there are any
seasonal patterns in this. For instance, I want to see how the on average
close price behaves a few days prior to last business day of the month. So,
I want to see a cross sectional time series of average prices for the past
12-months. In other words, the resulting dataset would give me a series such
as following 

Days_Prior_To_Month_End             Avg_Price

10                                                           25

9                                                              24.3

8                                                              22

7                                                              21

6                                                              23

5                                                              24

4                                                              22.2

3                                                              24.8

2                                                              24.9

1                                                              25

0                                                              26

 

In the above series, "0"would indicate the last day of the month. And the 26
would correspond to average price on the last day of the month for the past
12-month.

 

Some issues with this kind of series:

1)      Number of business day in a month is not fixed. Some months have 22
working day and others may have 23 or 21. So, the weekend data is not
available. 

2)      Normally, one is interested in returns behavior, but for the sake of
simplicity I used the example of just seeing average. Once I know the
methodology, I can extend it to the returns.  

Any help would be greatly appreciated. 

 


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

Reply via email to