Xd: Model prediction function from data.frame

Description Usage Arguments Value Examples

View source: R/prediction.R

Description

Model prediction function from data.frame

Usage

1

Arguments

data

data.frame with columns "name", "time", and row names that are taken as parameter names. The data frame can contain a column "value" to initialize the parameters.

condition

either NULL (generic prediction for any condition) or a character, denoting the condition for which the function makes a prediction.

Value

Object of class prdfn, i.e. a function x(times pars, deriv = TRUE, conditions = NULL), see also Xs. Attributes are "parameters", the parameter names (row names of the data frame), and possibly "pouter", a named numeric vector which is generated from data$value.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Generate a data.frame and corresponding prediction function
timesD <- seq(0, 2*pi, 0.5)
mydata <- data.frame(name = "A", time = timesD, value = sin(timesD), 
                     row.names = paste0("par", 1:length(timesD)))
x <- Xd(mydata)

# Evaluate the prediction function at different time points
times <- seq(0, 2*pi, 0.01)
pouter <- structure(mydata$value, names = rownames(mydata))
prediction <- x(times, pouter)
plot(prediction)

dMod documentation built on Jan. 27, 2021, 1:07 a.m.