Title: | An Implementation of the Additive Polynomial Design Matrix |
---|---|
Description: | An implementation of the additive polynomial (AP) design matrix. It constructs and appends an AP design matrix to a data frame for use with longitudinal data subject to seasonality. |
Authors: | Tyler Matta [aut, cre], Quinn Lathrop [ctb], Yeow Meng Thum [ctb] |
Maintainer: | Tyler Matta <[email protected]> |
License: | GPL-3 |
Version: | 1.0.0 |
Built: | 2024-10-31 20:48:42 UTC |
Source: | CRAN |
apdesign
returns a data frame with additive polynomial codingapdesign: AP coding
apdesign
returns a data frame with additive polynomial coding
apdesign(data, id_var, time_var, center_time, cycle_var, center_cycle, max_degree = c(1, 1))
apdesign(data, id_var, time_var, center_time, cycle_var, center_cycle, max_degree = c(1, 1))
data |
A data frame. |
id_var |
A character that indicates the subject identifier in
|
time_var |
A character that indicates the within-cycle time indicator in
|
center_time |
A numeric specifying the within-cycle time to center on. |
cycle_var |
A character that indicates the cycle indicator in
|
center_cycle |
A numeric specifying the cycle to center on. |
max_degree |
A vector of numerics specifying the highest degree for each polynomial. |
Output will be a data frame.
id <- c(rep(1,10), rep(2, 10)) y <- c(c(10, 15, 21, 20, 23, 25, 27, 25, 28, 29), c(12, 16, 18, 20, 20, 22, 28, 27, 29, 31)) time <- c(c(0.2, 0.5, 0.7), c(0.3, 0.6, 0.75, 0.89), c(0.1, 0.3, 0.8), c(0.3, 0.6, 0.7, 0.85), c(0.2, 0.7, 0.79), c(0.2, 0.5, 0.75)) cycle <- c(rep(1, 3), rep(2, 4), rep(3, 3), rep(1, 4), rep(2, 3), rep(3, 3)) df <- data.frame(id, y, time, cycle) apdesign(data = df, id = "id", time_var = "time", cycle_var = "cycle", center_cycle = 1, center_time = 0, max_degree = c(2,1))
id <- c(rep(1,10), rep(2, 10)) y <- c(c(10, 15, 21, 20, 23, 25, 27, 25, 28, 29), c(12, 16, 18, 20, 20, 22, 28, 27, 29, 31)) time <- c(c(0.2, 0.5, 0.7), c(0.3, 0.6, 0.75, 0.89), c(0.1, 0.3, 0.8), c(0.3, 0.6, 0.7, 0.85), c(0.2, 0.7, 0.79), c(0.2, 0.5, 0.75)) cycle <- c(rep(1, 3), rep(2, 4), rep(3, 3), rep(1, 4), rep(2, 3), rep(3, 3)) df <- data.frame(id, y, time, cycle) apdesign(data = df, id = "id", time_var = "time", cycle_var = "cycle", center_cycle = 1, center_time = 0, max_degree = c(2,1))
apdesign_i: AP coding for a single subject
apdesign_i(data, cycle_var, center_cycle, time_var, center_time, max_degree = c(1, 1), matricies = FALSE)
apdesign_i(data, cycle_var, center_cycle, time_var, center_time, max_degree = c(1, 1), matricies = FALSE)
data |
A data frame. |
cycle_var |
A character that indicates the cycle indicator in
|
center_cycle |
A numeric specifying the cycle to center on. |
time_var |
A character that indicates the within-cycle time indicator in
|
center_time |
A numeric specifying the within-cycle time to center on. |
max_degree |
A vector of numerics specifying the highest degree for each polynomial. |
matricies |
If |
Output will be a matrix.
y <- c(10, 15, 21, 20, 23, 25, 27, 25, 28, 29) time <- c(c(0.2, 0.5, 0.7), c(0.3, 0.6, 0.75, 0.89), c(0.1, 0.3, 0.8)) cycle <- c(rep(1, 3), rep(2, 4), rep(3, 3)) df <- data.frame(y, time, cycle) apdesign_i(data = df, time_var = "time", cycle_var = "cycle", center_cycle = 1, center_time = 0, max_degree = c(2,1))
y <- c(10, 15, 21, 20, 23, 25, 27, 25, 28, 29) time <- c(c(0.2, 0.5, 0.7), c(0.3, 0.6, 0.75, 0.89), c(0.1, 0.3, 0.8)) cycle <- c(rep(1, 3), rep(2, 4), rep(3, 3)) df <- data.frame(y, time, cycle) apdesign_i(data = df, time_var = "time", cycle_var = "cycle", center_cycle = 1, center_time = 0, max_degree = c(2,1))
A dataset of longitudinal responses of 36 study participants over a three years span.
indv_change
indv_change
A data frame with 234 observations and 5 variables:
subject identifier
cycle number
time since the start of the cycle, in weeks
time since the start of the study, in weeks
outcome measure
A dataset of mean responses of study participants over a three years span.
mean_change
mean_change
A data frame with 9 observations and 4 variables:
cycle number
time since the start of the cycle, in weeks
time since the start of the study, in weeks
outcome measure