1
votes

I have been trying to make epidemic curves in R with the epitools package. According to the documentation, you can automatically generate epidemiological weeks from a date variable, similar as I have been doing for long in STATA. Fyi, epidemiological weeks are different from yearly week numbers:

The first epi week of the year ends, by definition, on the first Saturday of January, as long as it falls at least four days into the month. Each epi week begins on a Sunday and ends on a Saturday.

This automatically generated a nice curve:

http://imgur.com/AG2P5mM

"Hurray!!", I thought. But, alas, being a scientist I double checked the data using STATA as well as manually and noticed that the data does not correspond!

  • Am I doing something wrong with epitool package that it gives me wrong epic weeks?
1
Welcome to SO. Please try to make a reproducible example. Most importantly, you should add some data using e.g. dput(DATE_variable).shadow
I also think that your implication that STATA's version is "scientifically correct" is subject to dispute. Relocating the weeks at the left side distorts the year information.IRTFM
After studying the ?epicurve.weeks page a bit, I see that your understanding of the "week" definition does not agree with the 'epitools' author's definition.IRTFM
Thank you for the comments. There are different countries/organisations using different epidemiological week definitions. I guess my organisation's definition does not follow that of EPITOOLS. [link(]wiki.ecdc.europa.eu/fem/f/1287/p/576/681.aspx#681).MJBOB
If you had followed the advice of @shadow we might have fixed your problem, nonetheless.IRTFM

1 Answers

2
votes

After some further discussion and research, there are differences in how epidemiological weeks can be calculated.

EPITOOLS as.week

In public health, reportable diseases are often reported by 'disease week' (either week of reporting or week of symptom onset). In R, weeks are numbered from 0 to 53 in the same year. The first day of week 1 starts with either the first Sunday or Monday of the year. Days before week 1 are numbered as 0s. In contrast to R, the as.week function generates weeks numbered from 1 to 53. The week before week 1 takes on the value (52 or 53) from the last week of the previous year. The as.week functions facilitates working with multiple years and generating epidemic curves.

MMWR week

Values for MMWR week range from 1 to 53, although most years consist of 52 weeks. The first day of any MMWR week is Sunday. MMWR week numbering is sequential beginning with 1 and incrementing with each week to a maximum of 52 or 53. MMWR week #1 of an MMWR year is the first week of the year that has at least four days in the calendar year. For example, if January 1 occurs on a Sunday, Monday, Tuesday or Wednesday, the calendar week that includes January 1 would be MMWR week #1. If January 1 occurs on a Thursday, Friday, or Saturday, the calendar week that includes January 1 would be the last MMWR week of the previous year (#52 or #53). Because of this rule, December 29, 30, and 31 could potentially fall into MMWR week #1 of the following MMWR year.

EPIWEEK for STATA

Each epidemiological week begins on a Sunday and ends on Saturday. And the first epidemiological week of year ends on the first Saturday of January, provided that it falls at least four or more days into the month

ISO (or business) week

An ISO week-numbering year (also called ISO year informally) has 52 or 53 full weeks. That is 364 or 371 days instead of the usual 365 or 366 days. The extra week is referred to here as a leap week, although ISO 8601 does not use this term. Weeks start with Monday. The first week of a year is the week that contains the first Thursday of the year

Week "u" in SAS

Each epidemiological week begins on a Sunday and ends on Saturday. And the first epidemiological week of year contains Sunday. Weeks range from 0 to 53 but do not always count 7 days