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

View source: R/rpt_rhythmicity_new.R

rpt_rhythmicity_newR 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_new(data, period = 24, type = "int", method = "LR", cov = NULL)

Arguments

data

A data set with columns: y (gene expression value), t (circadian time), id (subjects IDs) and optional additional covariates.

period

Period of the since curve. Default is 24.

type

Types of testing model. 'lm' for linear model, 'int' for mixed model with random intercept only and 'slope' for mixed model with random slope. Default is 'int'.

method

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

cov

Optional vector of additional covariates adding to model fitting (e.g. cov=c('age','gender')). Default is NULL.

Details

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

Value

A list of test statistic, pvalue and parameter estimates. 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_null

Standard deviation for the null model under linear model setting (type='lm').

sigma_alt

Standard deviation for the alternative model unde linear model setting (type='lm').

sigma_0

Standard deviation for the fixed part of intercept under random intercept or random slope setting (type='int' or 'slope').

sigma_alpha

Standard deviation for the random part of intercept under random intercept or random slope setting (type='int' or 'slope').

coefficients

Coefficient table of fitted model.

Author(s)

Haocheng Ding, Zhiguang Huo

Examples

Example 1

library(MASS)
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)))
group <- factor(rep(c('A','B'),each=60),levels = c('A','B'))
age <- rep(sample(20:80,n,replace = T),each=m)
data <- data.frame(y=yy,t=tt,id=id,group=group,age=age)
rpt_rhythmicity_new(data, period=24, type='int', method="LR", cov=NULL)

Example 2

library(MASS)
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)))
group <- factor(rep(c('A','B'),each=60),levels = c('A','B'))
age <- rep(sample(20:80,n,replace = T),each=m)
data <- data.frame(y=yy,t=tt,id=id,group=group,age=age)
rpt_rhythmicity_new(data, type='int', period=24, method="LR",cov=c('group','age'))

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