cosinor
cosinor()
fits a regression model of a time variable to a
continuous outcome use trigonometric features. This approaches uses the
linearization of the parameters to assess their statistics and
distribution.
cosinor(t, ...)# S3 method for default
cosinor(t, ...)
# S3 method for data.frame
cosinor(t, y, tau, population = NULL, ...)
# S3 method for matrix
cosinor(t, y, tau, population = NULL, ...)
# S3 method for formula
cosinor(formula, data, tau, population = NULL, ...)
# S3 method for recipe
cosinor(t, data, tau, population = NULL, ...)
Represents the ordered time indices that provide the positions for the cosine wave. Depending on the context:
A data frame of a time-based predictor/index.
A matrix of time-based predictor/index.
A recipe specifying a set of preprocessing steps
created from recipes::recipe()
.
Not currently used, but required for extensibility.
When t
is a data frame or matrix, y
is the outcome
specified as:
A data frame with 1 numeric column.
A matrix with 1 numeric column.
A numeric vector.
A vector that determines the periodicity of the time index. The number of elements in the vector determine the number of components (e.g. single versus multiple cosinor).
A vector with a single element = single-component cosinor, e.g. period = c(24)
A vector with multiple elements = multiple-component cosinor, e.g. period = c(24, 12)
Represents the population to be analyzed with a
population-mean cosinor. Defaults to NULL, assuming individual cosinors are
being generated. When a recipe or formula is used, population
is
specified as:
A character name of the column contained in data
that contains
identifiers for each subject. Every row will have a subject name which
should be duplicated for each time index given.
When a data frame or matrix is used, population
is specified as:
A vector of the same length as t
, with values representing each
subject at the correct indices.
A formula specifying the outcome terms on the left-hand side, and the predictor terms on the right-hand side.
When a recipe or formula is used, data
is specified as:
A data frame containing both the predictors and the outcome.
A cosinor
object.
Other cosinor:
augment.cosinor()
,
ggcosinor()
# NOT RUN {
# Data setup
data("twins")
# Formula interface
model <- cosinor(rDYX ~ hour, twins, tau = 24)
# }
Run the code above in your browser using DataLab