Description Usage Arguments Details Value Author(s) References See Also Examples
Fits a cosinor model as part of a generalized linear model.
1 2 |
formula |
regression formula. |
date |
a date variable if type=“daily”, or an integer between 1 and 12 if type=“monthly”. |
data |
data set as a data frame. |
family |
a description of the error distribution and link function to be used in the model. Available link functions: identity, log, logit, cloglog. Note, it must have the parentheses. |
alpha |
significance level, set to 0.05 (default). |
cycles |
number of seasonal cycles per year. |
rescheck |
plot the residual checks (TRUE/FALSE), see
|
type |
“daily” for daily data (default), or “monthly” for monthly data. |
offsetmonth |
include an offset to account for the uneven number
of days in the month (TRUE/FALSE). Should be used for monthly counts
(with |
offsetpop |
include an offset for the population (optional), this should be a variable in the data frame. |
text |
add explanatory text to the returned phase value (TRUE) or
return a number (FALSE). Passed to the |
The cosinor model captures a seasonal pattern using a
sinusoid. It is therefore suitable for relatively simple seasonal
patterns that are symmetric and stationary. The default is to fit an
annual seasonal pattern (cycle
=1), but other frequencies are
possible (e.g., twice per year: cycle
=2). The model is fitted
using a sine and cosine term that together describe the
sinusoid. These parameters are added to a generalized linear model, so
the model can be fitted to a range of dependent data (e.g., Normal,
Poisson, Binomial). Unlike the nscosinor
model, the cosinor
model can be applied to unequally spaced data.
Returns an object of class “Cosinor” with the following parts:
call |
the original call to the cosinor function. |
glm |
an object of class |
fitted |
fitted values for intercept and cosinor only (ignoring other independent variables). |
fitted.plus |
standard fitted values, including all other independent variables. |
residuals |
residuals. |
date |
date variable (in Date format when type=‘daily’). |
Adrian Barnett a.barnett<at>qut.edu.au
Barnett, A.G., Dobson, A.J. (2010) Analysing Seasonal Health Data. Springer.
1 2 3 4 5 6 7 8 9 10 11 12 | ## cardiovascular disease data (offset based on number of days in...
## ...the month scaled to an average month length)
data(CVD)
res = cosinor(cvd~1, date=month, data=CVD, type='monthly',
family=poisson(), offsetmonth=TRUE)
summary(res)
# stillbirth data
data(stillbirth)
res = cosinor(stillborn~1, date=dob, data=stillbirth,
family=binomial(link='cloglog'))
summary(res)
plot(res)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.