sysmod: Dose-response modeling

Description Usage Arguments Details Value Note Author(s) References Examples

View source: R/functions.R

Description

This function trains a dose-response model \insertCitebusso2003variablesysmod with or without validation procedure.

Usage

1
2
3
4
5
6
7
8
9
sysmod(
  data,
  vars,
  target,
  date_ID,
  specify = NULL,
  validation.method = "none",
  specs = NULL
)

Arguments

data

A data frame object that contains at least training loads, performances and time between two consecutive sessions.

vars

A list that contains input (i.e. session training loads, numeric) and time (i.e. the time between two consecutive inputs) vectors.

target

A character that indicates the performances column name.

date_ID

A character that indicates the date time object name.

specify

Default is "NULL". Alternatively, a list that contains "theta_init" numeric vector that contains initial values for P0, k1, k3, tau1, tau2, tau3 parameters, a numeric vector for lower and upper bounds named "lower" and "upper" respectively, a character defining the method used for parameter optimization "optim.method" (see details). Hence, PO denotes the initial level of performance. The first performance can be extracted through the function init_perf.

validation.method

Default is "none". Alternatively, simple data splitting or cross-validation can be specified (see details).

specs

Default is "NULL". If a validation method is specified, a list that contains splitting arguments has to be specified (see details)

Details

validation.method can be used to train and evaluate model within a cross-validation procedure. Methods available are "none", "simple" and "TS-CV" for no validation, a simple data split into training / testing sets and time-series cross-validation respectively. specs lets define data splitting specifications. For the "simple" method, specify decimals as the proportion of the data to be used for model training in "initialWindow", the proportion of data used for model evaluation in "horizon" and logical term for the "fixedWindow" within a list. For the "TS-CV" method, specify numeric values for "initialWindow", "horizon" and logical term for the "fixedWindow" within a list. Each of the optimization algorithm with constraints and used by optimx can be used in "optim.method".

Value

A list describing the model output and its performances.

Note

Model performances (RMSE, MAE and R squared) are calculated on data used for validation = c("simple", "TS-CV").

Author(s)

Frank Imbach frankimbach@gmail.com

References

\insertAllCited

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
## Not run: No validation, default optimization specs.
model_results <- sysmod(data = example_data,
      vars = list("input" = example_data$training_load, "time" = example_data$rest),
      target = "perf", date_ID = "datetime",
      validation.method = "none")

P0_init = init_perf(data = example_data, target = "perf")
theta_init <- c(P0_init = P0_init, k1_init = 0.5, k3_init = 0.1, tau1_init = 40, tau2_init = 20, tau3_init = 5)
lower <- c(P0_init - 0.10 * P0_init, 0, 0, 10, 1, 1)
upper <- c(P0_init, 1, 1, 80, 40, 10)

## Not run: No validation, custom optimization.
model_results <- sysmod(data = example_data,
     vars = list("input" = example_data$training_load, "time" = example_data$rest),
     target = "perf", date_ID = "datetime",
     specify = list("theta_init" = theta_init, "lower" = lower, "upper" = upper, "optim.method" = "nlm"),
     validation.method = "none")

## Not run: Simple split example, custom optimization.
model_results <- sysmod(data = example_data,
    vars = list("input" = example_data$training_load, "time" = example_data$rest),
    target = "perf", date_ID = "datetime",
    specify = list("theta_init" = theta_init, "lower" = lower, "upper" = upper, "optim.method" = "nlm"),
    validation.method = "simple",
    specs = list("initialWindow" = 0.8, "horizon" = 0.2, "fixedWindow" = FALSE))

## Not run: TS-CV example, custom optimization.
model_results <- sysmod(data = example_data,
     vars = list("input" = example_data$training_load, "time" = example_data$rest),
     target = "perf", date_ID = "datetime",
     specify = list("theta_init" = theta_init, "lower" = lower, "upper" = upper, "optim.method" = "nlm"),
     validation.method = "TS-CV",
     specs = list("initialWindow" = 50, "horizon" = 15, "fixedWindow" = FALSE))

fimbach/sysmod documentation built on Jan. 1, 2021, 1:21 a.m.