LR_rhythmicity: Likelihood-based Tests for Detecting Circadian Pattern.

View source: R/LR_rhythmicity.R

LR_rhythmicityR Documentation

Likelihood-based Tests for Detecting Circadian Pattern.

Description

Likelihood-based tests for circadian pattern detection.

Usage

LR_rhythmicity(tt, yy, period = 24, method = "LR", FN = TRUE)

Arguments

tt

Time vector

yy

Expression vector

period

Period of the since curve. Default is 24.

method

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

FN

Type of Test, finite sample if TRUE or large sample if FALSE. Default is TRUE.

Details

Test the significance of circadian curve fitting using likelihood-based tests.

Value

A list of amp, phase, offset, sigma02, sigmaA2, l0, l1, df, stat, 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

amp

Amplitude based on formula 1.

phase

Phase based on formula 1, phase is restricted within (0, period).

peakTime

Phase based on formula 1, peakTime is restricted within (0, period). phase + peakTime = period/4

offset

Basal level (vertical shift) based on formula 1 or on formula 2.

sigma02

Variance estimate under the null (intercept only).

sigmaA2

Variance estimate under the alternative (since curve fitting).

l0

Log likelihood under the null (intercept only).

l1

Log likelihood under the alternative (since curve fitting).

stat

Test statistic.

pvalue

P-value from the test.

R2

Pseudo R2 defined as (tss - rss)/tss.

Author(s)

Zhiguang Huo, Haocheng Ding

Examples

set.seed(32608)
n <- 50
tt <- runif(n,0,24) 
Amp <- 2
Phase <- 6
Offset <- 3
yy <- Amp * sin(2*pi/24 * (tt + Phase)) + Offset + rnorm(n,0,1)
LR_rhythmicity(tt, yy, period=24, method="LR", FN=TRUE)

diffCircadian/diffCircadian documentation built on Feb. 24, 2023, 9:07 a.m.