Description Usage Arguments Details Value References
Estimates amplitudes and phases along with confidence intervals and pvalues from a set of time series that may oscillate with a specified period. A model, per default
y = m + a cos(ω t) + b sin(ω t),
is fitted to the time series. This model is equivalent to the model
m + c cos(ω t  φ),
with amplitude c = √(a^2 + b^2) and phase φ = atan2(b, a). Pvalues for c > 0 (more precisely: either a or b > 0 ) are computed by an Ftest. Confidence intervals for the amplitudes and phases are computed by a linear error propagation approximation.
1 2 3  harmonic.regression(inputts, inputtime, Tau = 24, normalize = TRUE,
norm.pol = FALSE, norm.pol.degree = 1, trend.eliminate = FALSE,
trend.degree = 1)

inputts 
Matrix of time series. Rows correspond to time points, columns to samples. If a vector is provided, it is coerced to a matrix. 
inputtime 
Vector of the time points corresponding to the row in the time series matrix. 
Tau 
Scalar giving the oscillation period to estimate and test for. 
normalize 
Boolean, set to 
norm.pol 
Boolean, set to 
norm.pol.degree 
Scalar indicating the polynomial degree for the
normalization (ignored if 
trend.eliminate 
Boolean, set to 
trend.degree 
Integer indicading the polynomial degree for the trend
elimination, default is 1. Ignored when 
The default setting is that the time series are normalized with their mean values. Optionally a polynomial of degree 1 or more is first fitted to each time series, whereupon the original time series are normalized by dividing with the fitted values at each point, thus trends in a foldchange sense are assumed. Another option is trend elimination, in which case the same model plus a polynomial: y = m + a cos(ω t) + b sin(ω t) + et + ft^2 + ... is fitted to the (possibly normalized) data. In this case, returned pvalues still only concern the alternative c > 0 as defined above.
Values returned include normalized time series (if normalization is performed), normalization weights (means or polynomial coefficients if polynomial normalilzation is used), fitted normalized curves, fitted nonnormalized curves, a data frame of amplitudes and phases (in radians), pvalues according to an Ftest (Halberg 1967), BenjaminiHochberg adjusted pvalues, a data frame of approximately 1.96 standard deviations for the amplitude and phase estimates, a matrix of coefficients a and b and possibly c,... , the sum square resuduals after the fit for each time series, and the covariance matrix for the three independent variables (1, cos(ω t), and sin(ω t)). The latter can be used in postprocessing e.g. to obtain individual pvalues for coefficients by ttests.
A list containing:
means  Vector (if norm.pol=FALSE ) or matrix (otherwise) of
the means or coefficients of the fitted polynomial used for the
normalization 
normts  Matrix of meanscaled or normalizedbypolynomial time
series, same dimensionality as inputts 
fit.vals  Matrix of model fitted values to inputts 
norm.fit.vals  Matrix of model fitted values to the normalized (trend eliminated or mean scaled) time series 
pars  Data frame of estimated amplitudes and phases (in radians, between 0 and 2π) 
pvals  Vector of pvalues according to an Ftest of the model fit against a restricted model (meancentering only) 
qvals  Vector of BenjaminiHochberg adjusted pvalues 
ci  Data frame of onesided approximative 95% (2σ) confidence intervals for the estimated amplitudes and phases 
coeffs  Matrix of estimated model parameters a and b 
ssr  Vector of sum square residuals for the model fits 
df  Scalar if inputts does not contain NA s and
Vector otherwise, representing the degrees of freedom of the residual from
the fit 
ssx  Matrix (3 times 3, if inputts does not contain
NA s, a list of such matrices, one for each time series, otherwise) of
covariances for the dependent variables corresponding to (m, a
cos(ω t), and b sin(ω t), respecively) 
Halberg F, Tong YL, Johnson EA: Circadian System Phase – An Aspect of Temporal Morphology; Procedures and Illustrative Examples. in: The Cellular Aspects of Biorhythms, Springer 1967.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.