Learn R Programming

matrixTests (version 0.2.2)

cosinor: Cosinor

Description

Performs a Cosinor test for periodicity on each row/column of the input matrix.

Usage

row_cosinor(x, t, period = 24)

col_cosinor(x, t, period = 24)

Value

a data.frame where each row contains the results of a cosinor test performed on the corresponding row/column of x.

Each row contains the following information (in order):

1. obs - total number of observations

2. mesor - "Midline Estimating Statistic Of Rhythm" - the average value around which the variable oscillates

3. amplitude - difference between mesor and the peak of the rhythm

4. acrophase - time when rhythm reaches its peak

5. rsquared - R-squared

6. df.model - model terms degrees of freedom

7. df.residual - residual degrees of freedom

8. statistic - F statistic for the omnibus test against intercept-only model

9. pvalue - p-value

10. period - the period used within the model

Arguments

x

numeric matrix.

t

a vector specifying time variable for each observation of x.

period

oscillation period in the units of t (default = 24, suitable when inspecting diurnal rhythms with hourly data).

Author

Karolis Koncevičius

Details

row_cosinor - cosinor test on rows. col_cosinor - cosinor test on columns.

See Also

cosinor.lm

Examples

Run this code
wave <- sin(2*pi*1:24/24) + rnorm(24)
row_cosinor(wave, 1:24, 24)

Run the code above in your browser using DataLab