RAR_Spectrum | R Documentation |
This function estimates and smooths the power spectrum of the residuals estimated from the extended cosine model (RAR()).
RAR_Spectrum(rar_object, method = c("pss", "whittle"),
log_transform = c(TRUE, FALSE), id_column = NULL, ...)
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 |
Outputs from this function include: spectrum estimates as well as predicted smooth estimates.
Haoyi Fu, Jessica Graves
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.
nls
dplyr
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.