rpt_rhythmicity: Likelihood-based Test for Detecting Circadian Pattern with...

View source: R/rep_rhythmicity.R

rpt_rhythmicityR Documentation

Likelihood-based Test for Detecting Circadian Pattern with Repeated Measurement.

Description

Likelihood-based test for circadian pattern detection with repeated measurement.

Usage

rpt_rhythmicity(tt, yy, id, period = 24, method = "LR")

Arguments

tt

Time vector.

yy

Expression vector.

id

Subject ID numbers.

period

Period of the since curve. Default is 24.

method

Testing methods can be "LR" or "F". Default is "LR".

Details

Test the significance of circadian curve fitting using mixed model with random intercept and likelihood-based test.

Value

A list of test statistic and pvalue. Formula 1: yy = amp * sin(2π/period * (phase + tt)) + offset Formula 2: yy = A * sin(2π/period * tt) + B * cos(2*π/period * tt) + offset

stat

Test statistic.

pvalue

P-value from the test.

A

Amplitude estimate.

phi

Phase estimate.

basal

Basal level estimate.

sigma_0

Standard deviation for the fixed part of intercept.

sigma_alpha

Standard deviation for the random part of intercept.

Author(s)

Haocheng Ding, Zhiguang Huo

Examples

Example 1

set.seed(32611)
m <- 10
n <- 12
id <- rep(1:n,each=m)
rho <- 0.2
offset <- runif(1,0,3)
sigmaMat <- ifelse(diag(m)==1,1,rho)
tt <- rep(runif(m,0,24),n)
yy <- as.vector(t(mvrnorm(n,rep(offset,m),sigmaMat)))
rpt_rhythmicity(tt, yy, id, period=24, method="LR")

Example 2
set.seed(32611)
m <- 10
n <- 12
id <- rep(1:n,each=m)
rho <- 0.2
amp <- 1
phase <- 3
offset <- runif(1,0,3)
sigmaMat <- ifelse(diag(m)==1,1,rho)
t <- runif(m,0,24)
tt <- rep(t,n)
yy <- as.vector(t(mvrnorm(n,amp*sin(2*pi/24*(phase+t))+offset,sigmaMat)))
rpt_rhythmicity(tt, yy, id, period=24, method="LR")

RepeatedCircadian/RepeatedCircadian documentation built on Jan. 4, 2023, 11:11 p.m.