RAR_Spectrum: Spectral Analysis of Residuals of Extended Cosine Model

View source: R/RAR_Spectrum.R

RAR_SpectrumR Documentation

Spectral Analysis of Residuals of Extended Cosine Model

Description

This function estimates and smooths the power spectrum of the residuals estimated from the extended cosine model (RAR()).

Usage

RAR_Spectrum(rar_object, method = c("pss", "whittle"),
  log_transform = c(TRUE, FALSE), id_column = NULL, ...)

Arguments

rar_object

default output from RAR().

method

specifies the method of smoothing, penalized smoothing spline ("pss") or Whittle-likelihood ("whittle"). Default is "pss".

log_transform

specifies if power spectrum should be estimated on log or natural scale. Default is TRUE (log scale).

id_column

name of column containing id if multiple subjects exist in dataframe. Default is NULL.

...

additional parameters

Details

Outputs from this function include: spectrum estimates as well as predicted smooth estimates.

Author(s)

Haoyi Fu, Jessica Graves

References

1. Krafty, RT, Fu, H, Graves, JL, Bruce, SA, Hall, MH, & Smagula, SF (2019). Measuring Variability in Rest-Activity Rhythms from Actigraphy with Application to Characterizing Symptoms of Depression. Statistics in Biosciences, 1-20.

2. Whittle, P (1953). Estimation and information in stationary time series. Arkiv för matematik, 2(5), 423–434.

See Also

nls dplyr

Examples

data(age_wise)
d <- age_wise[age_wise$id==1,]
rar_ex <- RAR(d, act, date_time)
spec <- RAR_Spectrum(rar_ex, "pss", TRUE)
spec$spectrum_value # the estimated power spectrum
spec$predict.ss # the predicted smoothed power spectrum

# Multiple subjects
d4 <- age_wise[age_wise$id %in% c(1:4), ]
rar_ex4 <- RAR(d4, act, date_time, id_column=id)
spec4 <- RAR_Spectrum(rar_ex4, "pss", TRUE, id)
spec4$spectrum_value
spec4$predict.ss

JessLGraves/RAR documentation built on April 5, 2025, 3:42 p.m.