RAR_RegByTime: RAR Regression by Localized Measures

View source: R/RAR_RegByTime.R

RAR_RegByTimeR Documentation

RAR Regression by Localized Measures

Description

This function performs linear regression on localized RAR measures for an entire sample (mean, standard deviation, and relative activity) at each time bin against an outcome of interest. This function will take a dataframe that contains RAR_Localized() measures with an outcome of interest already merged in. Or, it will take two separate dataframes, one with the RAR_Localized() measures and one with the outcome. If using two dataframes, you must specifiy the ID column, which will be used to merge the two together within the funciton.

Usage

RAR_RegByTime(df_measures, df_outcome = NULL, id_column = NULL,
  y_variable, formula, model_name = NULL, time_type = NULL,
  plots = c(TRUE, FALSE))

Arguments

df_measures

dataframe containing columns from RAR_Localized() for each subject. Mean, Standard Deviation, and Relative Activity columns must be named mean.act, sd.act, and rel.act, respectively. This dataframe must also have an id column. If dataframe is already merged with outcome of interest, leave df_outcome

df_outcome

dataframe containing outcome of interest. This dataframe must also have an id column, which is named the same as df_measures id column.

id_column

specifies the column name in df_measures and df_outcome that corresponds to the id

y_variable

a string describing outcome of interest (e.g, "Depression score")

formula

formula to run lm model, e.g. score ~ mean.act.

model_name

a string describing the model predictors, e.g. "Mean Activity". Optional.

time_type

a string describing the time type, e.g. "Person Time" or "Clock Time". Optional.

plots

a logical specifying if the user would like plot to be outputted. Default is FALSE

Author(s)

Jessica Graves


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