monthmean | R Documentation |
Calculate the monthly mean or adjusted monthly mean for count data.
monthmean(data, resp, offsetpop = NULL, adjmonth = FALSE)
data |
data set as a data frame. |
resp |
response variable in the data set for which the means will be calculated. |
offsetpop |
optional population, used as an offset (default=NULL). |
adjmonth |
adjust monthly counts and scale to a 30 day month
(‘ |
For time series recorded at monthly intervals it is often useful to examine (and plot) the average in each month. When using count data we should adjust the mean to account for the unequal number of days in the month (e.g., 31 in January and 28 or 29 in February).
This function assumes that the data set (data
) contains variables for
the year and month called year and month, respectively.
Returns an object of class “Monthmean” with the following parts:
mean |
a vector of length 12 with the monthly means. |
Adrian Barnett a.barnett@qut.edu.au
Barnett, A.G., Dobson, A.J. (2010) Analysing Seasonal Health Data. Springer.
plot.Monthmean
# cardiovascular disease data data(CVD) mmean = monthmean(data=CVD, resp='cvd', offsetpop=expression(pop/100000), adjmonth='average') mmean plot(mmean)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.