CircaPower: CircaPower

View source: R/CircaPower.R

CircaPowerR Documentation

CircaPower

Description

Analytical circadian power calculation based on a cosiner model.

Usage

CircaPower(
  n = NULL,
  power = NULL,
  r = NULL,
  phi = 0,
  period = 24,
  cts = NULL,
  ct_estimation = "expected",
  alpha = 0.05
)

Arguments

n

Sample size.

power

Statistical power.

r

Intrinsic effect size. r=A/\sigma, where A is the amplitude of the sinusoidal curve: y = A * sin(2\pi/period * (\phi + cts)) + M + \sigma, and \sigma is the noise level of the independent Normal error term N(0,\sigma^2).

phi

Phase shift \phi of the sinusoidal curve. Default is 0.

period

Period of the sinusoidal curve. Default is 24.

cts

Circadian times of the putative samples. If cts is NULL, evenly-spaced circadian time design will be used. If cts is not NULL, see more options on ct_estimation.

ct_estimation

If ct_estimation=='expected' (default), we will calculate the sampling design factor directly using the observed circadian time; if ct_estimation=='sampling', we will (1) perform kernel density estimation from the observed circadian time, (2) draw n circadian times from the kernel density estimation, (3) calculate the sampling design factor using these drawn samples.

alpha

Type I error control. Default is 0.05.

Details

Exactly one of the parameters 'n','power', 'r' and 'alpha' must be passed as NULL, and that parameter is determined from the others. Notice that alpha has non-NULL default so NULL must be explicitly passed if you want to compute it.

Value

A list of arguments (including the computed one) augmented.

Author(s)

Wei Zong, Zhiguang Huo

Examples

CircaPower(n=NULL, power=0.8, r=1.5)

n = 48
cts = seq(0,24,length.out = n+1)[-1]
A = 1
sigma = 1
r = A/sigma
CircaPower(n, r=r, phi=0, period = 24, cts=cts, alpha = 0.001)

circaPower/CircaPower documentation built on April 17, 2025, 3:28 a.m.