timeModelIntegral: Express the integral of a model in function of time only

timeModelIntegralR Documentation

Express the integral of a model in function of time only

Description

Compose the function of the model and the functions representing its variables, condModel a list a function reprensenting each variables.

Usage

timeModelIntegral(
  model,
  conditions,
  param = list(),
  control = list(),
  interpolation = "constant"
)

Arguments

model

character corresponding to the name of the rate model.

conditions

data.frame with columns named time and variables expected to correspond to those of the model.

param

list parameters of the model.

control

list of arguments that control the behaviour of the model.

interpolation

character corresponding to the name of the interpolating method of the model variables. Available methods include constant (default), linear and spline (for natural cubic splines).

Value

Return a new function that only depend on time (represented as x).

Examples

#Example of the integral of a rate model in function of time
conditions <- data.frame(time = seq(0,30,length.out = 10), temp = rnorm(10, 10, 5))
model <- "modelLinear"
param = list(a = 1, T0 = 10)

#Get the function representing the integral of the model, can be evaluated at any time within those of conditions
g <- timeModelIntegral(model, conditions, param)
x <- seq(0,30,length.out = 20)
g(x)

#Plot
x <- seq(0,30,length.out = 1000)
g <- timeModelIntegral(model, conditions, param)
plot(conditions$time,g(conditions$time))
lines(x,g(x))



aleblancbio/timescale documentation built on Aug. 27, 2022, 3:01 p.m.