RAR: RAR: Extended Cosine Model

View source: R/RAR.r

RARR Documentation

RAR: Extended Cosine Model

Description

This function fits sigmoidally transformed extended cosine model to activity data, as seen in Marler et al. (2006).

Usage

RAR(df, act_column, time_column, transform = c("antilogit", "arctan",
  "hill"), id_column = NULL)

Arguments

df

dataframe containing actigraphy data and time.

act_column

name of the column within df that contains the activity count data.

time_column

name of the column that contains date and time of observation. Time must be a POSIX object.

transform

specifies which transformation to apply. Options include Hill Function ("hill"), Anti-Logistic ("antilogit"), or Arctangent ("arctan")

id_column

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

Details

Outputs from this function include: coefficient estimates for baseline cosine model and user-specificed extended cosine transformation, predicted values, and parameter estimates of interest.

Author(s)

Jessica Graves

References

1. Marler M.R., Gehrman P., Martin J.L., Ancoli-Israel S. (2006) The sigmoidally transformed cosine curve: a mathematical model for circadian rhythms with symmetric non-sinusoidal shapes. Stat Med. Nov 30;25(22):3893-904.

See Also

nls

Examples

data(age_wise)
d <- age_wise[age_wise$id==1,]
rar_ex <- RAR(d, act, date_time)
rar_ex$parameters # parameter estimates
rar_ex$messages # convergence message

# Multiple subjects
d4 <- age_wise[age_wise$id %in% c(1:4), ]
rar_ex4 <- RAR(d4, act, date_time, id_column=id)
rar_ex4$parameters # parameter estimates
rar_ex4$messages # convergence messages for each participant
rar_ex4$df_predicted # dataframe of obseved activity and predicted values
rar_ex4$df_interp # predictions based on interpolated data (i.e. missing data)

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