How to create a time series from a data set where some days are skipped

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to create a time series from a data set where some days are skipped

Charles Thuo
I have a data set with daily claim numbers. I group with monthly totals and
create a time series as follows


v.ts<- ts(v, start=2008,frequency=12)

How can the daily data be converted into a time series where there is no
claim number for sundays and public holidays.


Charles.

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: How to create a time series from a data set where some days are skipped

arun kirshna


Hi,

You may check ?isWeekday, ?isBizday, from library(timeDate)
library(timeDate)
tS <- timeSequence(as.Date("2008/1/1"), as.Date("2014/4/21"))
tWd <- tS[isWeekday(tS)]
length(tWd)
#[1] 1645

 pubHolUS <- holiday(2008:2014,listHolidays("US"))

tS1 <- tS[isBizday(tS, holidays = holidayNYSE(2008:2014), wday = 1:5)]
length(tS1)
#[1] 1588


 tS2 <- tS[isBizday(tS,holidays=holiday(2008:2014,listHolidays("US")), wday=1:5)]
 length(tS2)
#[1] 1552

A.K.



On Wednesday, May 21, 2014 3:08 AM, Charles Thuo <[hidden email]> wrote:
I have a data set with daily claim numbers. I group with monthly totals and
create a time series as follows


v.ts<- ts(v, start=2008,frequency=12)

How can the daily data be converted into a time series where there is no
claim number for sundays and public holidays.


Charles.

    [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.

______________________________________________
[hidden email] 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.