View source: R/rpt_rhythmicity_new.R
rpt_rhythmicity_new | R Documentation |
Likelihood-based test for circadian pattern detection with repeated measurement.
rpt_rhythmicity_new(data, period = 24, type = "int", method = "LR", cov = NULL)
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. |
Test the significance of circadian curve fitting using mixed model with random intercept and likelihood-based test.
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. |
Haocheng Ding, Zhiguang Huo
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'))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.