| Title: | An Implementation of the Additive Polynomial Design Matrix | 
| Version: | 1.0.0 | 
| 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. | 
| Depends: | R (≥ 3.2.3) | 
| License: | GPL-3 | 
| LazyData: | true | 
| Imports: | Matrix (≥ 1.2) | 
| RoxygenNote: | 5.0.1 | 
| Suggests: | testthat | 
| NeedsCompilation: | no | 
| Packaged: | 2016-11-14 16:49:49 UTC; tylerm | 
| Author: | Tyler Matta [aut, cre], Quinn Lathrop [ctb], Yeow Meng Thum [ctb] | 
| Maintainer: | Tyler Matta <tyler.matta@gmail.com> | 
| Repository: | CRAN | 
| Date/Publication: | 2016-11-15 07:16:42 | 
apdesign: AP coding
apdesign returns a data frame with additive polynomial coding
Description
apdesign: AP coding
apdesign returns a data frame with additive polynomial coding
Usage
apdesign(data, id_var, time_var, center_time, cycle_var, center_cycle,
  max_degree = c(1, 1))
Arguments
| 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. | 
Value
Output will be a data frame.
Examples
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
Description
apdesign_i: AP coding for a single subject
Usage
apdesign_i(data, cycle_var, center_cycle, time_var, center_time,
  max_degree = c(1, 1), matricies = FALSE)
Arguments
| 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  | 
Value
Output will be a matrix.
Examples
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))
Repeated measures data over three years
Description
A dataset of longitudinal responses of 36 study participants over a three years span.
Usage
indv_change
Format
A data frame with 234 observations and 5 variables:
- id
- subject identifier 
- cycle
- cycle number 
- cycle_time
- time since the start of the cycle, in weeks 
- start_time
- time since the start of the study, in weeks 
- response
- outcome measure 
Data for a single time trend over three years
Description
A dataset of mean responses of study participants over a three years span.
Usage
mean_change
Format
A data frame with 9 observations and 4 variables:
- cycle
- cycle number 
- cycle_time
- time since the start of the cycle, in weeks 
- start_time
- time since the start of the study, in weeks 
- response
- outcome measure