rpt_diff: Likelihood-based Tests for Detecting Differential Circadian...

View source: R/rep_diff.R

rpt_diffR Documentation

Likelihood-based Tests for Detecting Differential Circadian Pattern with Repeated Measurement

Description

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

Usage

rpt_diff(tt1, yy1, tt2, yy2, id1, id2, group, period = 24, method = "LR")

Arguments

tt1

Time vector of condition 1.

yy1

Expression vector of condition 1.

tt2

Time vector of condition 2.

yy2

Expression vector of condition 2.

id1

Subject ID numbers in group 1.

id2

Subject ID numbers in group 2.

group

Group indicator of all subjects.

period

Period of the since curve. Default is 24.

method

Test used to detect differential circadian pattern. It can be chosen either "LR" or "F". Default is LR.

Details

Test differential rhythmicity of circadian curve fitting using random intercept linear mixed model and likelihood-based tests.

Value

A list, see details below.

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.

A1

Amplitude for group 1.

A2

Amplitude for group 2.

phi1

Phase for group 1.

phi2

Phase for group 2.

basal1

Basal level for group 1.

basal2

Basal level for group 2.

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)
n1 <- 12
n2 <- 12
m1 <- 10
m2 <- 10
id1 <- rep(1:n1,each=m1)
id2 <- rep((1+n1):(n1+n2),each=m2)
rho <- 0.2
offset1 <- runif(1,0,3)
offset2 <- runif(1,2,5)
amp1 <- 1
amp2 <- 2
phase1 <- 3
phase2 <- 6
sigmaMat1 <- ifelse(diag(m1)==1,1,rho)
sigmaMat2 <- ifelse(diag(m2)==1,1,rho)
t1 <- runif(m1,0,24)
tt1 <- rep(t1,n1)
yy1 <- as.vector(t(mvrnorm(n1,amp1*sin(2*pi/24*(phase1+t1))+offset1,sigmaMat1)))
t2 <- runif(m2,0,24)
tt2 <- rep(t2,n2)
yy2 <- as.vector(t(mvrnorm(n2,amp2*sin(2*pi/24*(phase2+t2))+offset2,sigmaMat2)))
group <- c(rep("group1",n1*m1),rep("group2",n2*m2))
rpt_diff(tt1,yy1,tt2,yy2,id1,id2,group)


Example 2

set.seed(32611)
n1 <- 12
n2 <- 12
m1 <- 10
m2 <- 10
id1 <- rep(1:n1,each=m1)
id2 <- rep((1+n1):(n1+n2),each=m2)
rho <- 0.2
offset1 <- offset2 <- runif(1,0,3)
sigmaMat1 <- ifelse(diag(m1)==1,1,rho)
sigmaMat2 <- ifelse(diag(m2)==1,1,rho)
t1 <- runif(m1,0,24)
tt1 <- rep(t1,n1)
yy1 <- as.vector(t(mvrnorm(n1,rep(offset1,m1),sigmaMat1)))
t2 <- runif(m2,0,24)
tt2 <- rep(t2,n2)
yy2 <- as.vector(t(mvrnorm(n2,rep(offset2,m2),sigmaMat2)))
group <- c(rep("group1",n1*m1),rep("group2",n2*m2))
rpt_diff(tt1,yy1,tt2,yy2,id1,id2,group)

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